fix danmaku seek

This commit is contained in:
DIYgod 2017-08-05 01:11:45 +08:00
parent 1e21471519
commit 7a8a2ac7ba
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
3 changed files with 21 additions and 13 deletions

2
dist/DPlayer.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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;
// }
// });
// }
/**