# takePicture(OBJECT)
调用拍照
this.$app.takePicture({
filename : '_doc/yuapp_temp_0000001/video/',
format : 'mp4',//iOS mp4
index : "0",//1 后置 0 前置
sizeType : '1'
}).then(res => {
console.log(res)
})
入参说明
参数名 类型 必填 说明 filename string 否 拍照文件保存的路径,默认_doc/gallery/ format string 否 拍照的文件格式,默认JPG,只支持JPG、JPEG和PNG(不区分大小写) index string 否 拍照默认使用的摄像头 index( 1:后置摄像头 2:前置摄像头)默认为1 sizeType string 否 图片控制,0返回原图路径,1返回缩略图路径,2原图和缩率图路径都返。默认为2 - 返回参数说明
参数名 类型 说明 captureFile Object 多选返回字段,为多路径的数组 captureFile返回参数说明
参数名 类型 说明 size String 图片大小单位bite。原图大小 path String 图片本地相对路径 name String 图片名字 compressSize String 图片大小单位bite。 缩略图大小 comperessPath String 缩略图相对路径 comperessName String 缩略图名字
# takeVideo(OBJECT)
调用录制视频
this.$app.takeVideo({
options: {
filename : '_doc/yuapp_temp_0000001/video/',
format : 'mp4',//iOS mp4
index : "0",//1 后置 0 前置
videoMaximumDuration : '3'
}
}).then(res => {
console.log(res)
})
入参说明
参数名 类型 必填 说明 filename String 否 摄像文件保存的路径,可设置具体文件名(如"_doc/camera/a.mp4");也可只设置路径,以"/"结尾则表明是路径(如"_doc/camera/"),filename默认_doc/gallery/(传空和不传都是默认) format String 否 摄像的文件格式(仅支持mp4,默认mp4) index String 否 摄像头默认使用的摄像头(1后置摄像头,2前置摄像头),默认1 videoMaximumDuration String 是 视频长度,单位秒,默认10s - 返回参数说明
参数名 类型 说明 captureFile Object 多选返回字段,为多路径的数组 captureFile返回参数说明
参数名 类型 说明 size String 图片大小单位bite path String 图片本地相对路径 name String 图片名字 width String 视频宽度 height String 视频高度 duration String 时长s # getCamera()
获取摄像头管理对象
this.$app.getCamera({ index: '1' }).then(res => {
console.log('app/getCamera===', JSON.stringify(res));
})
入参说明
参数名 类型 必填 说明 data Object 是 获取摄像头管理参数
data参数说明
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
index | String | 是 | 指定要获取摄像头的索引值,1表示主摄像头,2表示辅摄像头。默认为1,只支持1和2 其他参数报53002「参数错误」 |
返回参数说明
参数名 | 类型 | 说明 |
---|---|---|
supportedImageResolutions | 字符串数组 | 摄像头支持的拍照分辨率,IOS设备此参数为空 |
supportedVideoResolutions | 字符串数组 | 摄像头支持的摄像分辨率,IOS设备此参数为空 |
supportedImageFormats | 字符串数组 | 摄像头支持的拍照文件格式["PNG","JPG","JPEG","HEVC".] |
supportedVideoFormats | 字符串数组 | 摄像头支持的摄像文件格式 |