修改视频时长的拖拽计时问题

This commit is contained in:
nisen
2023-11-03 14:56:19 +08:00
parent 0938aa7fea
commit c34546ae3f
2 changed files with 42 additions and 4 deletions

View File

@@ -292,6 +292,8 @@ export default {
fullTimeFormat: "00:00:00", // 视频总长度的文字
barrageTimelineStart: 0, // 弹幕时间轴的起始时间点(手动调整进度条触发更新)
isInit:false, // 是否初始化过
videoTime:0,
oldVideoTime:0,
};
},
created() {
@@ -376,6 +378,9 @@ export default {
this.videoDom.pause();
this.isPlaying = false;
this.$emit('onPlayerPause', {})//暂停(暂停时调用)
// 清楚记录的时间
this.videoTime = 0
this.oldVideoTime = 0
}
this.isShowCover = false;
},
@@ -551,12 +556,23 @@ export default {
},
currentProgress: function () {
// 进度条到终点时修改播放状态
//console.log('播放中', this.videoDom.currentTime)
this.$emit('onPlayerPlaying', this.videoDom.currentTime,this.videoDom.duration)
if (this.currentProgress === 1) {
this.isPlaying = false;
this.$emit('onPlayerEnded', {})
}
// 拉伸进度条计时长
if(this.isPlaying){
this.videoTime = this.videoDom.currentTime
let sendTime = this.videoTime -this.oldVideoTime
// console.log('sendTime', sendTime)
// 超过两秒就算是拉进度了
if(sendTime > 2 && this.oldVideoTime !== 0){
console.log('开始计时发送sendTime',sendTime);
this.$emit('onPlayerSendTime', sendTime)
}
this.oldVideoTime = this.videoDom.currentTime
}
},
// notePlay: function(val) {
// if(val) {