methods: { // 视频时长更新 timeupdate(e){ console.log(e) let duration = e.detail.duration let currentTime = e.detail.currentTime console.log(duration) console.log(currentTime) if (currentTime > duration - 2.925){ // 停止视频 wx.createVideoContext(this.data.indexCurrent, this).stop() // 暂停视频 // wx.createVideoContext(this.data.indexCurrent, this).pause() console.log("可以暂停了") } } }
wxml
<video bindtimeupdate="timeupdate" bindtap="video_play" id="{{item.sid}}" poster="{{item.thumbnail}}" auto-pause-if-open-native wx:elif="{{item.type==\'video\'}}" src="{{item.images}}" src="{{item.video}}"></video>
请发表评论