mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-09 04:57:09 +03:00
Fix it sometimes looping instead of going to next video when autoskipping at the end for playlists
Fix #1804
This commit is contained in:
@@ -24,7 +24,7 @@ import SubmissionNotice from "./render/SubmissionNotice";
|
||||
import { Message, MessageResponse, VoteResponse } from "./messageTypes";
|
||||
import { SkipButtonControlBar } from "./js-components/skipButtonControlBar";
|
||||
import { getStartTimeFromUrl } from "./utils/urlParser";
|
||||
import { getControls, getExistingChapters, getHashParams, isVisible } from "./utils/pageUtils";
|
||||
import { getControls, getExistingChapters, getHashParams, isPlayingPlaylist, isVisible } from "./utils/pageUtils";
|
||||
import { CategoryPill } from "./render/CategoryPill";
|
||||
import { AnimationUtils } from "./utils/animationUtils";
|
||||
import { GenericUtils } from "./utils/genericUtils";
|
||||
@@ -1592,8 +1592,11 @@ function skipToTime({v, skipTime, skippingSegments, openNotice, forceAutoSkip, u
|
||||
// for some reason you also can't skip to 1 second before the end
|
||||
if (v.loop && v.duration > 1 && skipTime[1] >= v.duration - 1) {
|
||||
v.currentTime = 0;
|
||||
} else if (navigator.vendor === "Apple Computer, Inc." && v.duration > 1 && skipTime[1] >= v.duration) {
|
||||
} else if (v.duration > 1 && skipTime[1] >= v.duration
|
||||
&& (navigator.vendor === "Apple Computer, Inc." || isPlayingPlaylist())) {
|
||||
console.log("doing workaround")
|
||||
// MacOS will loop otherwise #1027
|
||||
// Sometimes playlists loop too #1804
|
||||
v.currentTime = v.duration - 0.001;
|
||||
} else {
|
||||
if (inMuteSegment(skipTime[1], true)) {
|
||||
|
||||
@@ -94,3 +94,7 @@ export function getExistingChapters(currentVideoID: VideoID, duration: number):
|
||||
|
||||
return chapters;
|
||||
}
|
||||
|
||||
export function isPlayingPlaylist() {
|
||||
return !!document.URL.includes("&list=");
|
||||
}
|
||||
Reference in New Issue
Block a user