chooseVideo 后 compressVideo

- 发布:2021-12-31 14:00
- 更新:2022-01-04 11:04
- 阅读:1030
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win10
HBuilderX类型: 正式
HBuilderX版本号: 3.2.16
手机系统: Android
手机系统版本号: Android 11
手机厂商: 小米
手机机型: xiaomi 11 Ultra MIUI 12.5
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
压缩成功
压缩成功
实际结果:
压缩失败
压缩失败
bug描述:
uni.compressVideo({
src: tempFilePath,
quality: 'low', //'low':低,'medium':中,'high':高
success: (res) => {
uni.hideLoading()
console.log('压缩后',res)
this.videoUrl = res.tempFilePath
},
fail: function (err) {
uni.hideLoading()
console.log(err)
uni.showToast({
title:'视频压缩失败',
icon:'none'
},2000)
}
})
let realFilePath = ''
if(tempFilePath.indexOf("file://") !== -1) {
realFilePath = tempFilePath.split('file://').join('')
}
console.log(realFilePath)
plus.zip.compressVideo({
src: realFilePath?realFilePath:tempFilePath,
quality: 'low'
},(res) => {
uni.hideLoading()
console.log('压缩后',res)
this.videoUrl = res.tempFilePath
},(err) => {
uni.hideLoading()
console.log(err)
uni.showToast({
title:'视频压缩失败111',
icon:'none'
},2000)
})
以上两种压缩方式均失败
报错:
{
"code": -99,
"message": "extractor does not contain video and/or audio tracks."
}
2 个回复
FullStack - 【插件开发】【专治疑难杂症】【ios上架、马甲包、白包、过审、已成功上架过几百个】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=22130】【非诚勿扰】QQ:543610866
文件路径有问题
如果有中文编码的,要反编码
DCloud_Android_ST
看下压缩的文件路径是否正确。看错误信息是没找到video类型的文件
1***@qq.com (作者)
file:///storage/emulated/0/DCIM/ScreenRecorder/Screenrecorder-2022-01-04-10-39-11-204.mp4 这是我choosevideo后的临时路径,别的手机都行,就是这个手机不行
2022-01-05 14:32
DCloud_Android_ST
回复 1***@qq.com: 已转给相关同学
2022-01-05 20:12
cnnjcl
回复 DCloud_Android_ST: 我也有同样问题
2022-08-30 19:24