CameraContext

CameraContext 实例,可通过 mc.createCameraContext 获取,与页面内的 camera 组件对应。

方法

CameraContext.takePhoto(Object object)

拍摄照片

Object object 参数
属性 类型 默认值 必填 说明
quality String normal 成像质量, high / normal / low
success Function 接口调用成功的回调函数
fail Function 接口调用失败的回调函数
complete Function 接口调用结束的回调函数(调用成功、失败都会执行)

Object.success(Object res) | 属性 | 类型 | 说明 | | :--------------- | :------ | :----------------------- | | tempImagePath | String | 照片文件的临时路径 (本地路径) jpg图片格式 |

CameraContext.setZoom(Object object)

设置缩放级别

Object object 参数
属性 类型 默认值 必填 说明
zoom Number 缩放级别,范围[1, maxZoom]。zoom 可取小数,精确到小数后一位。maxZoom 可在 bindinitdone 返回值中获取。
success Function 接口调用成功的回调函数
fail Function 接口调用失败的回调函数
complete Function 接口调用结束的回调函数(调用成功、失败都会执行)

CameraContext.startRecord(Object object)

开始录像

Object object 参数
属性 类型 默认值 必填 说明
timeout Number 30 录像时长。
timeoutCallback Function 超过时长或页面 onHide 时会结束录像。
success Function 接口调用成功的回调函数
fail Function 接口调用失败的回调函数
complete Function 接口调用结束的回调函数(调用成功、失败都会执行)

Object.timeoutCallback | 属性 | 类型 | 说明 | | :--------------- | :------ | :----------------------- | | tempThumbPath | String | 封面图片文件的临时路径 (本地路径) | | tempVideoPath | String | 视频的文件的临时路径 (本地路径) |

CameraContext.stopRecord(Object object)

结束录像

Object object 参数
属性 类型 默认值 必填 说明
compressed Boolean false 录像时长。
success Function 接口调用成功的回调函数
fail Function 接口调用失败的回调函数
complete Function 接口调用结束的回调函数(调用成功、失败都会执行)

Object.success(Object res) | 属性 | 类型 | 说明 | | :--------------- | :------ | :----------------------- | | tempThumbPath | String | 封面图片文件的临时路径 (本地路径) | | tempVideoPath | String | 视频的文件的临时路径 (本地路径) |

results matching ""

    No results matching ""

    results matching ""

      No results matching ""