video中bindtimeupdate的返回值超出视频总时长?
发布于 4 年前 作者 yong80 6039 次浏览 来自 问答
<video id="video"wx:if="{{!itemShow}}" src="{{video}}" initial-time="{{videoReady}}" object-fit="contain"  show-progress="{{false}}" bindtimeupdate="videoUpdate" bindloadedmetadata="videoLen" bindended="overLook" bindplay="hideLine" catchtap="hidesline" bindpause="stopVideo" enable-progress-gesture="{{false}}"></video>
videoUpdate:function(e){
    var sliderValue = e.detail.currentTime / e.detail.duration * 1000;
    var slider = e.detail.currentTime;
    var percent = (e.detail.currentTime/e.detail.duration*100);
    var sliderValue1 = Math.floor(slider/60);
    var sliderValue2 = Math.floor(slider%60);
    if(sliderValue1 <10){
      sliderValue1= '0'+sliderValue1
    }
    if(sliderValue2 <10){
      sliderValue2= '0'+sliderValue2
    }
    sliderValue = sliderValue1+':'+sliderValue2;
    this.setData({
      sliderValue: sliderValue,
      percent:percent,
      study_time:Math.round(e.detail.currentTime),
    })
  },
1 回复

你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)

回到顶部