Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
Fix rare error skips.    e.g.Notice appears earlier than the set time or error skip occurs
  • Loading branch information
etherfun committed Nov 22, 2024
1 parent d8cadc5 commit b46212d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1858,7 +1858,7 @@ function skipToTime({ v, skipTime, skippingSegments, openNotice, forceAutoSkip,
//防止重复调用导致反复横跳
const Check = readySkip.readySkipCheck != skipTime[0];
readySkip.readySkipCheck = skipTime[0];
if (!Check) return;
if (!Check || !(getVideo().currentTime < 5 || getVideo().currentTime + howLongToSkip(skipTime) >= skipTime[0])) return;
clearTimeout(readySkip.readySkip);

const handleSkip = () => {
Expand Down Expand Up @@ -2056,13 +2056,13 @@ function reskipSponsorTime(segment: SponsorTime, forceSeek = false) {
openNotice: skipInfo.openNotice,
});
} else {
const skippedTime = Math.max(segment.segment[1] - getVideo().currentTime, 0);
const segmentDuration = segment.segment[1] - segment.segment[0];
const fullSkip = skippedTime / segmentDuration > manualSkipPercentCount;
const skippedTime = Math.max(segment.segment[1] - getVideo().currentTime, 0);
const segmentDuration = segment.segment[1] - segment.segment[0];
const fullSkip = skippedTime / segmentDuration > manualSkipPercentCount;

getVideo().currentTime = segment.segment[1];
sendTelemetryAndCount([segment], skippedTime, fullSkip);
startSponsorSchedule(true, segment.segment[1], false);
getVideo().currentTime = segment.segment[1];
sendTelemetryAndCount([segment], skippedTime, fullSkip);
startSponsorSchedule(true, segment.segment[1], false);
}
}
}
Expand Down

0 comments on commit b46212d

Please sign in to comment.