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

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

浏览量:3234 时间: 来源:「已注销」
<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 class="button" @tap="playVideo">开始学习</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
},
小程序

版权声明

即速应用倡导尊重与保护知识产权。如发现本站文章存在版权问题,烦请提供版权疑问、身份证明、版权证明、联系方式等发邮件至197452366@qq.com ,我们将及时处理。本站文章仅作分享交流用途,作者观点不等同于即速应用观点。用户与作者的任何交易与本站无关,请知悉。

产品经理

手机 : 13312967497

擅长 : 小程序流量变现

扫码领取礼包

最新资讯

热门模板

  • 头条
  • 搜狐
  • 微博
  • 百家
  • 一点资讯
  • 知乎