js限制video拉动进度条

2020-09-03 10:47:51 浏览数 (1)

代码语言:javascript复制
   function notdrag() {
      var video = document.getElementById("myvideo");
      var last = 0;
      video.ontimeupdate = function() {
        var current = video.currentTime;
        if (current - last > 2) {
          video.currentTime = last;
        } else {
          last = current;
        }
      }
    }

0 人点赞