2***@qq.com
2***@qq.com
  • 发布:2022-10-11 14:11
  • 更新:2022-10-11 17:48
  • 阅读:304

华为荣耀真机调试全屏播放视频,退出全屏后闪退

分类:uni-app

一个nvue页面,里面没有复杂代码,就一个video组件和cover-view,全屏播放视频再退出全屏时会闪退,没有报错。
最新版本HBuilder X 3.6.4
安卓10

2022-10-11 14:11 负责人:无 分享
已邀请:
2***@qq.com

2***@qq.com (作者)

<template> <view :style="'width: 100%;height: ' + screenHeight + 'px;'"> <view> <video id="videoDetail" :src="url" codec="software" autoplay enable-progress-gesture="false" :show-fullscreen-btn="false" @fullscreenchange="fullscreenchange" @click="changeControls()"> <cover-view v-if="controlsConfig.show" @click="changeControls()">
<cover-image src="@/static/full2.png" style="width:34rpx;height:34rpx;margin: 50rpx;"
@click="exitFullScreen()" />
</cover-view>
</video>
</view>
</view>
</template>

<script>
export default {
data() {
return {
globalData: null,
url: '',
liveVideoContext: null,
screenHeight: '',
controlsConfig: {
lock: 0,
show: false
}
}
},
onReady(res) {
this.liveVideoContext = uni.createVideoContext('videoDetail')
this.liveVideoContext.requestFullScreen()
this.changeControls(1000 * 6)
},
onLoad(options) {
this.screenHeight = uni.getSystemInfoSync().windowHeight
this.globalData = getApp().globalData
this.url = options.url
},
methods: {
// 展开收起操作栏
changeControls(time = 5000) {
const config = {
lock: this.controlsConfig.lock + 1,
show: !this.controlsConfig.show
}
this.controlsConfig = Object.assign({}, config)
// 如果是开启则设置定时任务关闭
if (config.show) {
const that = this
setTimeout(() => {
if (that.controlsConfig.lock === config.lock) {
that.controlsConfig.show = false
that.$forceUpdate()
}
}, time)
}
},
fullscreenchange(e) {
// 退出全屏,返回直播详情
if (!e.detail.fullScreen) {
this.globalData.utils.goto(1, 3)
}
},
exitFullScreen() {
this.liveVideoContext.exitFullScreen()
},
}
}
</script>

<style scoped>
</style>

DCloud_Android_DQQ

DCloud_Android_DQQ

使用hello uni 能否复现问题?

要回复问题请先登录注册