Fix segments with small gaps

This commit is contained in:
Ajay
2022-06-15 13:05:44 -04:00
parent 9a7baa7325
commit c61c97ccad

View File

@@ -545,6 +545,7 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?:
// Don't skip if this category should not be skipped // Don't skip if this category should not be skipped
if (!shouldSkip(currentSkip) && !sponsorTimesSubmitting?.some((segment) => segment.segment === currentSkip.segment)) return; if (!shouldSkip(currentSkip) && !sponsorTimesSubmitting?.some((segment) => segment.segment === currentSkip.segment)) return;
const skipBuffer = 0.003;
const skippingFunction = (forceVideoTime?: number) => { const skippingFunction = (forceVideoTime?: number) => {
let forcedSkipTime: number = null; let forcedSkipTime: number = null;
let forcedIncludeIntersectingSegments = false; let forcedIncludeIntersectingSegments = false;
@@ -553,7 +554,7 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?:
if (incorrectVideoCheck(videoID, currentSkip)) return; if (incorrectVideoCheck(videoID, currentSkip)) return;
forceVideoTime ||= Math.max(video.currentTime, getVirtualTime()); forceVideoTime ||= Math.max(video.currentTime, getVirtualTime());
if (forceVideoTime >= skipTime[0] && forceVideoTime < skipTime[1]) { if (forceVideoTime >= skipTime[0] - skipBuffer && forceVideoTime < skipTime[1]) {
skipToTime({ skipToTime({
v: video, v: video,
skipTime, skipTime,
@@ -574,7 +575,7 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?:
startSponsorSchedule(forcedIncludeIntersectingSegments, forcedSkipTime, forcedIncludeNonIntersectingSegments); startSponsorSchedule(forcedIncludeIntersectingSegments, forcedSkipTime, forcedIncludeNonIntersectingSegments);
}; };
if (timeUntilSponsor < 0.003) { if (timeUntilSponsor < skipBuffer) {
skippingFunction(currentTime); skippingFunction(currentTime);
} else { } else {
const delayTime = timeUntilSponsor * 1000 * (1 / video.playbackRate); const delayTime = timeUntilSponsor * 1000 * (1 / video.playbackRate);