diff options
author | Ajay <[email protected]> | 2022-05-18 15:43:51 -0400 |
---|---|---|
committer | Ajay <[email protected]> | 2022-05-18 15:43:51 -0400 |
commit | f1839eef94be478792bf507c272105854b37310e (patch) | |
tree | bcc02ddb2c4865ac6b02ab8b9620c480002f6053 | |
parent | 3e3abf36e5a17bcef124e9885f0a864a641d0035 (diff) | |
download | SponsorBlock-f1839eef94be478792bf507c272105854b37310e.tar.gz SponsorBlock-f1839eef94be478792bf507c272105854b37310e.zip |
Added another warning related to buffering
-rw-r--r-- | src/content.ts | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/content.ts b/src/content.ts index b2f25194..a4770bd4 100644 --- a/src/content.ts +++ b/src/content.ts @@ -656,6 +656,8 @@ function setupVideoListeners() { if (!Config.config.disableSkipping) { switchingVideos = false; + let startedWaiting = false; + video.addEventListener('play', () => { // If it is not the first event, then the only way to get to 0 is if there is a seek event // This check makes sure that changing the video resolution doesn't cause the extension to think it @@ -686,6 +688,12 @@ function setupVideoListeners() { }); video.addEventListener('playing', () => { updateVirtualTime(); + + if (startedWaiting) { + startedWaiting = false; + console.warn(`[SB] Starting schedule after buffering: ${Math.abs(lastCheckVideoTime - video.currentTime) > 0.3 + || (lastCheckVideoTime !== video.currentTime && Date.now() - lastCheckTime > 2000)}`); + } // Make sure it doesn't get double called with the play event if (Math.abs(lastCheckVideoTime - video.currentTime) > 0.3 @@ -726,9 +734,10 @@ function setupVideoListeners() { }; video.addEventListener('pause', () => paused()); video.addEventListener('waiting', () => { - paused(); - console.warn("[SB] Not skipping due to buffering"); + startedWaiting = true; + + paused(); }); startSponsorSchedule(); |