# chooseVideo

从系统相册中选择视频,或使用相机拍摄视频。

# 支持说明

应用能力 Android iOS PC 预览效果
小程序 3.7.0 3.7.0 3.8.0
扫码预览
用BoosHi扫码或PC端点击
网页应用 待开发 待开发 待开发 待提供

# 输入

继承标准对象输入,扩展属性描述:

名称 数据类型 必填 默认值 描述
sourceType string[] ['album', 'camera'] 指定视频来源为相册或/和相机
示例值:['album']
可选值有
* ['album']
* ['camera']
* ['album','camera']
PC暂不支持camera
maxDuration number 60 暂不支持
compressed boolean true 是否对选取视频进行压缩
暂不支持

# 输出

继承标准对象输入,扩展属性描述:

success返回对象的扩展属性:

名称 数据类型 描述
duration number 视频时长,单位:秒/s
PC端暂不支持
tempFilePath string 视频地址
size number 视频大小,单位:字节/Bytes
width number 视频宽度
PC端暂不支持
height number 视频高度
PC端暂不支持

# 示例代码

bz.chooseVideo({
    sourceType: [
        "album"
    ],
    maxDuration: 80,
    compressed: true,
    success(res) {
      console.log(JSON.stringify(res));
    },
    fail(res) {
      console.log(`chooseVideo fail: ${JSON.stringify(res)}`);
    }
});
1
2
3
4
5
6
7
8
9
10
11
12
13

success返回对象示例:

{
    "duration": 8,
    "height": 600,
    "size": 594655,
    "tempFilePath": "",
    "width": 600,
    "errMsg": "chooseVideo:ok"
}
1
2
3
4
5
6
7
8
最后更新于 : 2/22/2023, 4:59:54 PM