提交 704b6827 编写于 作者: fxy060608's avatar fxy060608

Merge branch 'dev' of https://github.com/dcloudio/uni-app into dev

<template> <template>
<uni-page :data-page="$route.meta.pagePath"> <uni-page :data-page="$route.meta.pagePath">
<page-head <page-head
v-if="navigationBar.type!=='none'" v-if="navigationBar.type!=='none'"
v-bind="navigationBar" /> v-bind="navigationBar" />
<page-refresh <page-refresh
v-if="enablePullDownRefresh" v-if="enablePullDownRefresh"
...@@ -195,7 +195,7 @@ export default { ...@@ -195,7 +195,7 @@ export default {
let offset = upx2px(refreshOptions.offset) let offset = upx2px(refreshOptions.offset)
if (titleNView.type !== 'transparent') { if (titleNView.type !== 'none' && titleNView.type !== 'transparent') {
offset += NAVBAR_HEIGHT + safeAreaInsets.top offset += NAVBAR_HEIGHT + safeAreaInsets.top
} }
......
...@@ -50,7 +50,7 @@ export function chooseVideo ({ ...@@ -50,7 +50,7 @@ export function chooseVideo ({
size: file.size, size: file.size,
duration: 0, duration: 0,
width: 0, width: 0,
height: 0, height: 0,
name: file.name name: file.name
} }
...@@ -58,11 +58,20 @@ export function chooseVideo ({ ...@@ -58,11 +58,20 @@ export function chooseVideo ({
if (video.onloadedmetadata !== undefined) { if (video.onloadedmetadata !== undefined) {
// 尝试获取视频的宽高信息 // 尝试获取视频的宽高信息
video.onloadedmetadata = function () { video.onloadedmetadata = function () {
callbackResult.duration = video.duration || 0 invoke(callbackId, Object.assign({}, callbackResult, {
callbackResult.width = video.videoWidth || 0 duration: video.duration || 0,
callbackResult.height = video.videoHeight || 0 width: video.videoWidth || 0,
invoke(callbackId, callbackResult) height: video.videoHeight || 0
}))
} }
// 部分浏览器(如微信内置浏览器)未播放无法触发loadedmetadata事件
setTimeout(() => {
invoke(callbackId, Object.assign({}, callbackResult, {
duration: 0,
width: 0,
height: 0
}))
}, 300)
video.src = filePath video.src = filePath
} else { } else {
invoke(callbackId, callbackResult) invoke(callbackId, callbackResult)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册