Commit 955b6477 authored by Chen Jiping's avatar Chen Jiping

feat:增加视频播放状态监控

parent ef38bd4c
......@@ -120,6 +120,19 @@ class PlayView {
_this.curIndex++;
_this.showVideo();
})
const video = $("#video")[0];
//添加播放完成事件
video.addEventListener('ended', function () {
//如果当前序号大于解锁的索引,则表示解锁了新视频
if(_this.curIndex > _this.unlock){
_this.unlock = _this.curIndex;
}
// 监听视频播放结束
_this.refreshBtnStatus();
});
}
showVideo(){
......@@ -134,21 +147,22 @@ class PlayView {
$("#video").attr('src', videoArr[this.curIndex]) ;
const video = $("#video")[0];
video.play();
video.muted = false;
//video.controls = true;
_this.refreshBtnStatus();
let i = setInterval(() => {
//添加播放完成事件
video.addEventListener('ended', function () {
if (video.readyState > 0) {
video.play();
//如果当前序号大于解锁的索引,则表示解锁了新视频
if(_this.curIndex > _this.unlock){
_this.unlock = _this.curIndex;
clearInterval(i);
}
// 监听视频播放结束
}, 100);
_this.refreshBtnStatus();
});
}
refreshBtnStatus(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment