diff --git a/src/components/VideoPlayer/index.vue b/src/components/VideoPlayer/index.vue index 55f7f6c9..922e3ab9 100644 --- a/src/components/VideoPlayer/index.vue +++ b/src/components/VideoPlayer/index.vue @@ -22,6 +22,8 @@ tabindex="0" width="100%" height="100%" + @waiting="onWaiting" + @playing="onPlaying" > @@ -358,6 +360,20 @@ export default { }); }, methods: { + //当视频由于需要缓冲下一帧而停止,解决一直计时的问题 + onWaiting(){ + console.log('触发了onWairing'); + this.$emit('onPlayerEnded', {}) + }, + //当音频/视频在已因缓冲而暂停或停止后已就绪时 + onPlaying(){ + console.log('触发缓存结束onPlaying'); + if(this.videoDom.paused){ + this.$emit('onPlayerEnded', {}) + }else{ + this.$emit('onPlayerPlay', {}); + } + }, /* 切换播放状态 */ togglePlayStatus() { @@ -372,6 +388,7 @@ export default { this.isPlaying = true; this.isInit = true; this.$emit('onPlayerPlay', {});//播放(播放时会调用) + console.log('播放'); } else { this.videoDom.pause(); this.isPlaying = false; diff --git a/src/views/study/coursenew.vue b/src/views/study/coursenew.vue index 06457d30..a15c90df 100644 --- a/src/views/study/coursenew.vue +++ b/src/views/study/coursenew.vue @@ -1477,10 +1477,10 @@ //如果当前追加开始时间不为空 let now = new Date(); let m = now.getTime() - this.appendStartTime.getTime(); //相差的毫秒数 - console.log(m/1000,'时间'); + // console.log(m/1000,'时间'); let sen = Math.round(m / 1000); //计算秒数 - console.log('定时器时间',sen); + // console.log('定时器时间',sen); // 每次添加的是定时器计时的时间 duration = duration + sen;//追加的是秒 if (duration >= 60) { //一分钟保存一次