diff --git a/components/video-player/Controls.tsx b/components/video-player/Controls.tsx index 9cdf85f1..c6047aa8 100644 --- a/components/video-player/Controls.tsx +++ b/components/video-player/Controls.tsx @@ -123,17 +123,6 @@ export const Controls: React.FC = ({ const wasPlayingRef = useRef(false); - const updateTimes = useCallback( - (currentProgress: number, maxValue: number) => { - const current = ticksToSeconds(currentProgress); - const remaining = ticksToSeconds(maxValue - currentProgress); - - setCurrentTime(current); - setRemainingTime(remaining); - }, - [] - ); - const { showSkipButton, skipIntro } = useIntroSkipper( item.Id, currentTime, @@ -180,6 +169,23 @@ export const Controls: React.FC = ({ router.replace("/play-video"); }, [nextItem, settings]); + const updateTimes = useCallback( + (currentProgress: number, maxValue: number) => { + const current = ticksToSeconds(currentProgress); + const remaining = ticksToSeconds(maxValue - currentProgress); + + setCurrentTime(current); + setRemainingTime(remaining); + + if (currentProgress === maxValue) { + setShowControls(true); + // Automatically play the next item if it exists + goToNextItem(); + } + }, + [goToNextItem] + ); + useAnimatedReaction( () => ({ progress: progress.value,