diff --git a/src/content.ts b/src/content.ts index 6dfea5fb..ad39b0b6 100644 --- a/src/content.ts +++ b/src/content.ts @@ -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)) { diff --git a/src/utils/pageUtils.ts b/src/utils/pageUtils.ts index ab4d5619..2b79c2ec 100644 --- a/src/utils/pageUtils.ts +++ b/src/utils/pageUtils.ts @@ -93,4 +93,8 @@ export function getExistingChapters(currentVideoID: VideoID, duration: number): } return chapters; +} + +export function isPlayingPlaylist() { + return !!document.URL.includes("&list="); } \ No newline at end of file