現在のアプレットの再生長さと映像の長さの合計を取得し、長い休止に再生したりするときのビデオを停止することができます

  方法:{
     // ビデオの長さの更新
    timeupdate(E){ 
      はconsole.log(E)
      のlet DURATION = e.detail.duration 
      せCURRENTTIME = e.detail.currentTime 
      にconsole.log(DURATION)
      はconsole.log(CURRENTTIME)
      IF(CURRENTTIME > DURATION - 2.925 ){ 
          // ビデオ停止 
        wx.createVideoContext(この .data.indexCurrent、この).stop()
          // ビデオ一時停止
        // wx.createVideoContext(this.data.indexCurrentを、この).pause() 
        コンソール。ログ( "中断さ" 
      } 
    }
  }

wxml

< ビデオbindtimeupdate = "timeupdate" bindtap = "video_play" ID = "{{item.sid}}" ポスター= "{{item.thumbnail}}" 自動ポーズIF-オープンネイティブWX:ELIF = "{{ item.type == 'ビデオ'}}」SRC = "{{item.images}}" SRC = "{{item.video}}" > </ ビデオ>

 

おすすめ

転載: www.cnblogs.com/zwnsyw/p/12536015.html