Some more debug logs

This commit is contained in:
Ajay
2022-05-23 21:41:35 -04:00
parent 61535fac95
commit 2b3c812f8a

View File

@@ -575,6 +575,8 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?:
// 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);
logDebug(`Starting setInterval skipping ${video.currentTime} to skip at ${skipTime[0]}`);
currentSkipInterval = setInterval(() => { currentSkipInterval = setInterval(() => {
const intervalDuration = performance.now() - startIntervalTime; const intervalDuration = performance.now() - startIntervalTime;
if (intervalDuration >= delayTime || video.currentTime >= skipTime[0]) { if (intervalDuration >= delayTime || video.currentTime >= skipTime[0]) {
@@ -589,6 +591,8 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?:
} }
}, 1); }, 1);
} else { } else {
logDebug(`Starting timeout to skip ${video.currentTime} to skip at ${skipTime[0]}`);
// Schedule for right before to be more precise than normal timeout // Schedule for right before to be more precise than normal timeout
currentSkipSchedule = setTimeout(skippingFunction, Math.max(0, delayTime - 100)); currentSkipSchedule = setTimeout(skippingFunction, Math.max(0, delayTime - 100));
} }