fix danmaku seek

This commit is contained in:
DIYgod
2017-08-05 01:11:45 +08:00
parent 1e21471519
commit 7a8a2ac7ba
3 changed files with 21 additions and 13 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
+19 -11
View File
@@ -830,6 +830,14 @@ class DPlayer {
}
this.video.currentTime = time;
for (let i = 0; i < this.dan.length; i++) {
if (this.dan[i].time >= time) {
this.danIndex = i;
return;
}
this.danIndex = this.dan.length;
}
}
/**
@@ -1140,17 +1148,17 @@ class DPlayer {
flvPlayer.load();
}
if (this.option.danmaku) {
this.video.addEventListener('seeking', () => {
for (let i = 0; i < this.dan.length; i++) {
if (this.dan[i].time >= this.video.currentTime) {
this.danIndex = i;
return;
}
this.danIndex = this.dan.length;
}
});
}
// if (this.option.danmaku) {
// this.video.addEventListener('seeking', () => {
// for (let i = 0; i < this.dan.length; i++) {
// if (this.dan[i].time >= this.video.currentTime) {
// this.danIndex = i;
// return;
// }
// this.danIndex = this.dan.length;
// }
// });
// }
/**