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