Skip to content

Commit

Permalink
sponsorblock: fix back-to-back skips by increasing lookback window...
Browse files Browse the repository at this point in the history
  • Loading branch information
Informatic committed Jun 9, 2021
1 parent f724ca4 commit 4910cff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sponsorblock.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class SponsorBlockHandler {
// Sometimes timeupdate event (that calls scheduleSkip) gets fired right before
// already scheduled skip routine below. Let's just look back a little bit
// and, in worst case, perform a skip at negative interval (immediately)...
const nextSegments = this.segments.filter(seg => seg.segment[0] > this.video.currentTime - 0.1 && seg.segment[1] > this.video.currentTime - 0.1);
const nextSegments = this.segments.filter(seg => seg.segment[0] > this.video.currentTime - 0.3 && seg.segment[1] > this.video.currentTime - 0.3);
nextSegments.sort((s1, s2) => s1.segment[0] - s2.segment[0]);

if (!nextSegments.length) {
Expand All @@ -184,6 +184,7 @@ class SponsorBlockHandler {
}

const skipName = barTypes[segment.category]?.name || segment.category;
console.info(this.videoID, 'Skipping', segment);
showNotification(`Skipping ${skipName}`);
this.video.currentTime = end;
this.scheduleSkip();
Expand Down

0 comments on commit 4910cff

Please sign in to comment.