<view class="video_item">
<video v-for="(item,index) in video_url"
:key="index"
:id="'myVideo'+index"
:src="item.name"
@fullscreenchange="fullscreenchange"
@play="saveplay(index)"
class="classvideo"
@click="videoPlay(index)"
:show-fullscreen-btn='false'
object-fit="contain"
></video>
</view>
fullscreenchange (e){
if(!e.detail.fullScreen){ //退出全屏
console.log("感受到了3")
uni.createVideoContext(`myVideo${this.videoindex}`).stop() //暂停播放
this.videoPlays = false
this.videoindex = -1
}
},
videoPlay(index){
if(this.videoPlays==false){
this.videoindex = index
uni.createVideoContext(`myVideo${index}`).requestFullScreen()
uni.createVideoContext(`myVideo${index}`).play()
this.videoPlays = true
}
有几个没有的api 我没删 根据方法里面的哪些用到了 就用哪个就好 因为id是唯一的 所以id要循环出来