Vue 实现 H5video 视频标签 禁止快进 最优

Posted 奥特曼 

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Vue 实现 H5video 视频标签 禁止快进 最优相关的知识,希望对你有一定的参考价值。

 可以拖动滚动条 但是还是松开鼠标还是停留在当前位置,如果后退的话还是可以快进到最快的位置,这点还是比较优化较好的

<template>
 <video
          ref="video"
          @timeupdate="timeupdate"
        >
</template>

<script>
export default {
  data() {
    return {
      currTime: null,
      maxTime:0,
    };
  },
  methods: {
    timeupdate(e) {
      console.log(e.srcElement.currentTime - this.currTime);
      if (e.srcElement.currentTime - this.currTime > 1) {
        e.srcElement.currentTime = this.currTime>this.maxTime?this.currTime:this.maxTime;
        console.log("快进了");
      }
      this.currTime = e.srcElement.currentTime;
      this.maxTime = this.currTime>this.maxTime?this.currTime:this.maxTime;
      console.log("视频记录", e.srcElement.currentTime);
      console.log("本地记录", this.currTime);
    },
    toggleCom(num) {
      this.comNum = num;
    },
  },
};
</script>

以上是关于Vue 实现 H5video 视频标签 禁止快进 最优的主要内容,如果未能解决你的问题,请参考以下文章

vue-video-player怎么禁止快进 可以后退?

Html5新增标签video视频,实现音视频的播放暂停快进慢进倍速等操作

Video/Audio禁止快进(退)

用java读取本地磁盘视频资源,OutputStream输出的视频文件在html的video标签播放时不能点快进

Vue——video标签实现不静音自动播放

关于前端video标签视频无法拖动进度条快进问题(Django)