mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 01:01:55 +01:00
Fix early skips on firefox when seeking while playing
This commit is contained in:
parent
f764869cc8
commit
3f7f671a3b
1 changed files with 16 additions and 18 deletions
|
@ -964,25 +964,23 @@ function updateVirtualTime() {
|
|||
if (utils.isFirefox()) {
|
||||
let count = 0;
|
||||
let lastTime = lastKnownVideoTime.videoTime;
|
||||
if (lastKnownVideoTime.fromPause) {
|
||||
currentVirtualTimeInterval = setInterval(() => {
|
||||
if (lastTime !== video.currentTime) {
|
||||
count++;
|
||||
lastTime = video.currentTime;
|
||||
}
|
||||
currentVirtualTimeInterval = setInterval(() => {
|
||||
if (lastTime !== video.currentTime) {
|
||||
count++;
|
||||
lastTime = video.currentTime;
|
||||
}
|
||||
|
||||
if (count > 1) {
|
||||
const delay = lastKnownVideoTime.fromPause && lastKnownVideoTime.approximateDelay ?
|
||||
lastKnownVideoTime.approximateDelay : 0;
|
||||
|
||||
lastKnownVideoTime.videoTime = video.currentTime + delay;
|
||||
lastKnownVideoTime.preciseTime = performance.now();
|
||||
|
||||
clearInterval(currentVirtualTimeInterval);
|
||||
currentVirtualTimeInterval = null;
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
if (count > 1) {
|
||||
const delay = lastKnownVideoTime.fromPause && lastKnownVideoTime.approximateDelay ?
|
||||
lastKnownVideoTime.approximateDelay : 0;
|
||||
|
||||
lastKnownVideoTime.videoTime = video.currentTime + delay;
|
||||
lastKnownVideoTime.preciseTime = performance.now();
|
||||
|
||||
clearInterval(currentVirtualTimeInterval);
|
||||
currentVirtualTimeInterval = null;
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue