# transcodeVideo
压缩视频。(仅iOS,Android压缩视频方法参考:compressedVideo)
# 输入
继承标准对象输入,扩展属性描述
| 名称 | 数据类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| params | Object | 是 | 详情见params参数说明 |
params参数说明:
| 名称 | 数据类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| inputFile | string | 是 | 设备上视频的路径 | |
| outputFile | string | 是 | 输出文件路径 |
# 输出
继承标准对象输出,无扩展属性
# 示例代码
app.link.transcodeVideo((res) => {
bui.alert(res);
}, (error) => {
bui.alert('error' + error);
}, {
fileUri: path,
outputFileName: fileName,
outputFileType: 1,
saveToLibrary: true,
maintainAspectRatio: true,
width: 640, //可选
height: 640, //可选
audioChannels: 1,
progress: function (info) {
// 压缩进度
}
})