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

<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>

补充 封面、视频铺满整个video 

    video {
      object-fit: cover; //视频 背景图铺满
    }

 

Logo

一站式 AI 云服务平台

更多推荐