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 视频标签 禁止快进 最优的主要内容,如果未能解决你的问题,请参考以下文章
Html5新增标签video视频,实现音视频的播放暂停快进慢进倍速等操作