Add warning messages to catch weird not skipping bug

This commit is contained in:
Ajay
2022-05-17 13:33:26 -04:00
parent 52dc697635
commit 793c16a21b

View File

@@ -456,6 +456,7 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?:
// Reset lastCheckVideoTime // Reset lastCheckVideoTime
lastCheckVideoTime = -1; lastCheckVideoTime = -1;
lastCheckTime = 0; lastCheckTime = 0;
console.warn("[SB] Ad playing, pausing skipping");
return; return;
} }
@@ -548,7 +549,7 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?:
} else { } else {
const delayTime = timeUntilSponsor * 1000 * (1 / video.playbackRate); const delayTime = timeUntilSponsor * 1000 * (1 / video.playbackRate);
if (delayTime < 300) { if (delayTime < 300) {
// For Firefox, use interval instead of timeout near the end to combat imprecise video time // Use interval instead of timeout near the end to combat imprecise video time
const startIntervalTime = performance.now(); const startIntervalTime = performance.now();
const startVideoTime = Math.max(currentTime, video.currentTime); const startVideoTime = Math.max(currentTime, video.currentTime);
currentSkipInterval = setInterval(() => { currentSkipInterval = setInterval(() => {
@@ -709,8 +710,12 @@ function setupVideoListeners() {
cancelSponsorSchedule(); cancelSponsorSchedule();
}; };
video.addEventListener('pause', paused); video.addEventListener('pause', () => paused());
video.addEventListener('waiting', paused); video.addEventListener('waiting', () => {
paused();
console.warn("[SB] Not skipping due to buffering");
});
startSponsorSchedule(); startSponsorSchedule();
} }