This commit is contained in:
wdssmq
2020-11-13 12:33:16 +08:00
parent 9ca151eebf
commit fcd95905d8
3 changed files with 24 additions and 2 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+22
View File
@@ -531,6 +531,7 @@ class DPlayer {
if (this.qualityIndex === index || this.switchingQuality) {
return;
} else {
this.prevIndex = this.qualityIndex;
this.qualityIndex = index;
}
this.switchingQuality = true;
@@ -574,6 +575,27 @@ class DPlayer {
this.events.trigger('quality_end');
}
});
this.on('error', () => {
if (!this.video.error) {
return;
}
if (this.prevVideo) {
this.template.videoWrap.removeChild(this.video);
this.video = this.prevVideo;
if (!paused) {
this.video.play();
}
this.qualityIndex = this.prevIndex;
this.quality = this.options.video.quality[this.qualityIndex];
this.noticeTime = setTimeout(() => {
this.template.notice.style.opacity = 0;
this.events.trigger('notice_hide');
}, 3000);
this.prevVideo = null;
this.switchingQuality = false;
}
});
}
notice(text, time = 2000, opacity = 0.8) {