小程序双击暂停事件 分别给播放和暂停一种状态 处理两种状态下的不同情况...

<video id="my-video" src="{{currentVideo.file_url}}" @timeupdate="timeupdate" custom-cache="{{false}}" show-center-play-btn="{{false}}" controls @fullscreenchange="fullScreen" @tap.native="testTap"
@play="setPlayStatus"
@pause="setPauseStatus">
<cover-image class="return" src="{{imageUrl}}/image/video/return.png" wx:if="{{fullScreen}}" @tap="quitFullScreen">cover-image>
<cover-image src="{{teacherInfo.course_img_url}}" wx:if="{{!playing}}">cover-image>
<cover-view class="cover-text" wx:if="{{!playing}}">
<cover-view class="text">已有{{teacherInfo.course_study}}人学习了该视频cover-view>

cover-view>
<cover-view class="button" @tap="playVideo" wx:if="{{showBtn}}">开始学习cover-view>
video>

setPlayStatus() {
this.isPlaying = true
},
setPauseStatus() {
this.isPlaying = false
},
testTap() {
// 这个里面才能拿到相应的值this.isPlaying 做处理
this.currentTime = Date. now()
if (!this.firstTime) {
this.firstTime = this.currentTime
setTimeout(() => {
this.firstTime = null
}, 350)
}
var mul = (this.currentTime - this.firstTime)
console.log(mul)

if (mul !== 0 && mul < 350) {
console.log('进入函数===', this.isPlaying)
this.isPlaying ? this.videoContext.pause() : this.videoContext.play()
}
return false
},

你可能感兴趣的:(小程序双击暂停事件 分别给播放和暂停一种状态 处理两种状态下的不同情况...)