From b46212d0a9fd999d19948116e5f444bfdd4fbbee Mon Sep 17 00:00:00 2001 From: etherfun <124044584+etherfun@users.noreply.github.com> Date: Fri, 22 Nov 2024 22:12:47 +0800 Subject: [PATCH] Fix bug Fix rare error skips. e.g.Notice appears earlier than the set time or error skip occurs --- src/content.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/content.ts b/src/content.ts index 43d12db8..e8424d24 100644 --- a/src/content.ts +++ b/src/content.ts @@ -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 = () => { @@ -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); } } }