11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

处理多个视频播放问题

处理多个视频在播放视频A时又去播放视频B解决重复播放多个视频问题

元素

<video :id="'myvideo'+item.id" class="yourSendVideo" :src="item.Content" @ended="ended" :show-fullscreen-btn="false" controls="false" />
<view class="yourVideoBtn" @click="videoshow(item)"></view> <!-- 视频上层 -->


js代码

// 播放结束
ended(){
	console.log('播放结束---')
	this.videoContext = null;
},
// 播放视频
videoshow(e) {
	
	const is_id = this.myvideo_time?.id == e.id;
	
	this.myvideo_time = e;
	if(this.videoContext){
		this.videoContext.pause();
		this.videoContext = null;
		if(is_id){
			return;
		}
	}
	
	this.videoContext = uni.createVideoContext('myvideo'+e.id);
	console.log('切换视频全屏 -- 2---',e, this.videoContext)
	// this.videoContext.requestFullScreen({
	// 	direction: 0
	// }); //direction: 90  控制全屏的时候视屏旋转多少度 
	this.videoContext.play();
},    


-->