提交 e5160b7a 编写于 作者: Q qiang

fix: 修复微信内置浏览器uni.chooseVideo回调不触发的问题

上级 1e451f00
......@@ -50,7 +50,7 @@ export function chooseVideo ({
size: file.size,
duration: 0,
width: 0,
height: 0,
height: 0,
name: file.name
}
......@@ -58,11 +58,20 @@ export function chooseVideo ({
if (video.onloadedmetadata !== undefined) {
// 尝试获取视频的宽高信息
video.onloadedmetadata = function () {
callbackResult.duration = video.duration || 0
callbackResult.width = video.videoWidth || 0
callbackResult.height = video.videoHeight || 0
invoke(callbackId, callbackResult)
invoke(callbackId, Object.assign({}, callbackResult, {
duration: video.duration || 0,
width: video.videoWidth || 0,
height: video.videoHeight || 0
}))
}
// 部分浏览器(如微信内置浏览器)未播放无法触发loadedmetadata事件
setTimeout(() => {
invoke(callbackId, Object.assign({}, callbackResult, {
duration: 0,
width: 0,
height: 0
}))
}, 300)
video.src = filePath
} else {
invoke(callbackId, callbackResult)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册