diff --git a/frontend/src/components/PlexPlayer.tsx b/frontend/src/components/PlexPlayer.tsx index 4cfceb9..7a96947 100644 --- a/frontend/src/components/PlexPlayer.tsx +++ b/frontend/src/components/PlexPlayer.tsx @@ -796,6 +796,9 @@ export default function PlexPlayer({ itemId, onClose, queue }: Props) { const [skipProgress, setSkipProgress] = useState(null); skipProgressRef.current = skipProgress; const cancelledMarkerRef = useRef(null); + // The running countdown interval, so cancelAutoSkip can actually STOP it — clearing skipProgress + // alone left the interval ticking, which re-set the progress ~100ms later and skipped anyway. + const skipTimerRef = useRef(null); const doSkip = useCallback( (m: PlexMarker) => { setSkipProgress(null); @@ -807,6 +810,10 @@ export default function PlexPlayer({ itemId, onClose, queue }: Props) { const cancelAutoSkip = useCallback(() => { const m = activeMarkerRef.current; if (m) cancelledMarkerRef.current = `${m.type}-${m.start_s}`; // don't re-arm this same marker + if (skipTimerRef.current) { + window.clearInterval(skipTimerRef.current); // actually stop the countdown, not just blank it + skipTimerRef.current = null; + } setSkipProgress(null); }, []); cancelAutoSkipRef.current = cancelAutoSkip; @@ -828,10 +835,15 @@ export default function PlexPlayer({ itemId, onClose, queue }: Props) { setSkipProgress(p); if (p >= 1) { window.clearInterval(iv); + skipTimerRef.current = null; doSkip(m); } }, 100); - return () => window.clearInterval(iv); + skipTimerRef.current = iv; + return () => { + window.clearInterval(iv); + skipTimerRef.current = null; + }; // eslint-disable-next-line react-hooks/exhaustive-deps }, [activeMarker?.type, activeMarker?.start_s, prefs.autoSkipIntro, prefs.autoSkipCredits, prefs.autoSkipDelay, doSkip]);