---------------------------------------------------------------------- 跳转nvue页面----------------------------------------------------------------------
// #ifdef APP-PLUS
uni.navigateTo({
url: '../../components/videoPlayer?src=' + this.resUrl + 'lnR0g864zMXyfGvd74na5ID8FNts-720.mp4'
})
return new Promise((resolve, reject) => {
uni.$once("AppVideoPlayerCancel", () => {
uni.$off("AppVideoPlayerConfirm")
console.log("退出播放")
console.log("AppVideoPlayerCancel")
resolve("AppVideoPlayerCancel")
})
uni.$once("AppVideoPlayerConfirm", () => {
uni.$off("AppVideoPlayerCancel")
console.log("播放")
console.log("AppVideoPlayerConfirm")
resolve("AppVideoPlayerConfirm")
})
});
// #endif
----------------------------------------------------------------------nvue页面----------------------------------------------------------------------
// nvue 页面
<template>
<div bubble="true">
<view class="mask">
<view class="content">
<video class="video" :src="src" controls autoplay ></video>
</view>
<div class="cancel-btn" style="display: flex; align-items: center;">
<image style="width:50rpx;height:50rpx;" src="https://qn.hotel.wuyuqizhu.com/upload_cancel.png" @click="close"></image>
</div>
</view>
</div>
</template>
<script>
export default {
data() {
return {
src: ''
}
},
onLoad: function (option) {
this.src = option.src
},
methods: {
close(e) {
uni.$emit('AppVideoPlayerCancel')
uni.navigateBack()
}
}
}
</script>
<style>
.mask {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
/ #ifndef APP-NVUE /
display: flex;
/ #endif /
justify-content: center;
align-items: center;
background-color: rgba(0,0,0,0.8);
}
.video {
height: 400rpx;
}
.content {
margin-top: 150rpx;
width: 630rpx;
/* height: 868rpx; */
border-radius: 10rpx;
}
.cancel-btn {
width: 562rpx;
height: 50rpx;
margin-top: 80rpx;
text-align: center;
}
</style>
3 个回复
1***@qq.com
我也遇到了同样的问题,Android正常,iOS有问题,播放了就无法停止,退出页面了还在后台播放。
jxtian
直接点返回存在这个问题吗?我直接返回没有复现,iOS端会播放视频会播放不出画面?
物遇 (作者)
不是,视频能播放,但是返回(uni.navigateBack())之后,视频还在播放,关闭不了
2020-07-09 09:16
1***@qq.com
是ios端返回时,视频还是后台播放的,再次进去就会出现两个声音
2020-07-09 09:16
c***@163.com
手动播放,黑屏没画面但是有声音,加上自动播放属性后,有画面在播放,播放画面上有loading转圈,无法暂停
2020-07-09 09:17
jxtian
回复 c***@163.com: 已确认bug,等待修复
2020-07-09 10:30
jxtian
回复 c***@163.com: 回复 物遇: 是cuiyalei163@163.com的这种情况
2020-07-09 10:31
1***@qq.com
loading的时候也无法暂停