aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay <[email protected]>2022-06-15 13:05:44 -0400
committerAjay <[email protected]>2022-06-15 13:05:44 -0400
commitc61c97ccadc81b0e4189f9a5a8cfad1738eaecd4 (patch)
tree5d079a3b2f2ae2befdfc97471e12e30cbfe83413
parent9a7baa73250cd935600c66d792a2ab7bcfc3afdb (diff)
downloadSponsorBlock-c61c97ccadc81b0e4189f9a5a8cfad1738eaecd4.tar.gz
SponsorBlock-c61c97ccadc81b0e4189f9a5a8cfad1738eaecd4.zip
Fix segments with small gaps
-rw-r--r--src/content.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/content.ts b/src/content.ts
index 40eea756..b36b715a 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -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);