diff --git a/frontend/src/components/PlexPlayer.tsx b/frontend/src/components/PlexPlayer.tsx index 7d9f0f9a..fabbe953 100644 --- a/frontend/src/components/PlexPlayer.tsx +++ b/frontend/src/components/PlexPlayer.tsx @@ -42,6 +42,7 @@ import { import { Ctrl, PanelHead, Skip10 } from "./plexPlayerControls"; import { PlexPlayerSettings } from "./PlexPlayerSettings"; import { PlexStatsOverlay } from "./PlexStatsOverlay"; +import { UpNextCard } from "./UpNextCard"; import { useAutoSkip, useControlsVisibility, @@ -177,6 +178,12 @@ export default function PlexPlayer({ itemId, onClose, queue }: Props) { const [statsOpen, setStatsOpen] = useState(false); const statsOpenRef = useRef(false); statsOpenRef.current = statsOpen; + // Up-next end-card: shown at episode end (with a next item) instead of an instant jump (S4). + const [upNextOpen, setUpNextOpen] = useState(false); + const upNextOpenRef = useRef(false); + upNextOpenRef.current = upNextOpen; + const upNextPrefRef = useRef(prefs.upNext); + upNextPrefRef.current = prefs.upNext; const now = useWallClock(); durationRef.current = duration; @@ -520,7 +527,11 @@ export default function PlexPlayer({ itemId, onClose, queue }: Props) { // (absRef 0) — its stray 'ended' must not mark anything watched or cascade another advance. if (absRef.current <= 0) return; api.plexSetState(id, "watched").catch(() => {}); - if (nextId) go(nextId); + // With a next item and the up-next pref on, surface the end-card (poster + countdown + Cancel) + // and let IT advance — binge stays in the viewer's control (S4/D6-A). The card only appears here, + // on play-to-the-end; credits-auto-skip advances earlier and this handler never fires for it. + if (nextId && upNextPrefRef.current) setUpNextOpen(true); + else if (nextId) go(nextId); // Nothing queued next → dismiss the player back to the previous page (same as Stop/Escape), // instead of stranding a black, ended