mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 09:07:45 +01:00
make skip to next chapter go to next endpoint and fix reskip stackoverflow
This commit is contained in:
parent
b1ef8a5d47
commit
fdbcf47149
1 changed files with 6 additions and 3 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue