mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-15 16:07:06 +03:00
make skip to next chapter go to next endpoint and fix reskip stackoverflow
This commit is contained in:
@@ -605,6 +605,8 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?:
|
|||||||
} else {
|
} else {
|
||||||
forcedSkipTime = forceVideoTime + 0.001;
|
forcedSkipTime = forceVideoTime + 0.001;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
forcedSkipTime = forceVideoTime + 0.001;
|
||||||
}
|
}
|
||||||
|
|
||||||
startSponsorSchedule(forcedIncludeIntersectingSegments, forcedSkipTime, forcedIncludeNonIntersectingSegments);
|
startSponsorSchedule(forcedIncludeIntersectingSegments, forcedSkipTime, forcedIncludeNonIntersectingSegments);
|
||||||
@@ -2082,13 +2084,14 @@ function updateActiveSegment(currentTime: number): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function nextChapter(): void {
|
function nextChapter(): void {
|
||||||
const chapters = sponsorTimes.filter((time) => time.actionType === ActionType.Chapter);
|
const chapters = sponsorTimes.filter((time) => time.actionType === ActionType.Chapter)
|
||||||
|
.sort((a, b) => a.segment[1] - b.segment[1]);
|
||||||
if (chapters.length <= 0) return;
|
if (chapters.length <= 0) return;
|
||||||
|
|
||||||
const nextChapter = chapters.findIndex((time) => time.actionType === ActionType.Chapter
|
const nextChapter = chapters.findIndex((time) => time.actionType === ActionType.Chapter
|
||||||
&& time.segment[0] > video.currentTime);
|
&& time.segment[1] > video.currentTime);
|
||||||
if (nextChapter !== -1) {
|
if (nextChapter !== -1) {
|
||||||
unskipSponsorTime(chapters[nextChapter], null, true);
|
reskipSponsorTime(chapters[nextChapter], true);
|
||||||
} else {
|
} else {
|
||||||
video.currentTime = video.duration;
|
video.currentTime = video.duration;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user