<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要循环出来
这段代码展示了如何在移动端使用uni-app进行视频播放和全屏切换的处理。当退出全屏时,视频会暂停并重置播放状态。点击视频可以播放,并在已播放状态下请求全屏。使用了uni.createVideoContext进行视频操作。
1247

被折叠的 条评论
为什么被折叠?



