diff --git a/app/(auth)/player/direct-player.tsx b/app/(auth)/player/direct-player.tsx index 915505d5..12daaf5e 100644 --- a/app/(auth)/player/direct-player.tsx +++ b/app/(auth)/player/direct-player.tsx @@ -230,16 +230,11 @@ export default function page() { videoRef.current?.pause(); }, [videoRef]); - const stop = useCallback(() => { - setIsPlaybackStopped(true); - videoRef.current?.stop(); - reportPlaybackStopped(); - }, [videoRef]); - const reportPlaybackStopped = useCallback(async () => { if (offline) return; const currentTimeInTicks = msToTicks(progress.value); + await getPlaystateApi(api!).onPlaybackStopped({ itemId: item?.Id!, mediaSourceId: mediaSourceId, @@ -250,6 +245,12 @@ export default function page() { revalidateProgressCache(); }, [api, item, mediaSourceId, stream]); + const stop = useCallback(() => { + reportPlaybackStopped(); + setIsPlaybackStopped(true); + videoRef.current?.stop(); + }, [videoRef, reportPlaybackStopped]); + const reportPlaybackStart = useCallback(async () => { if (offline) return; @@ -340,7 +341,6 @@ export default function page() { useFocusEffect( React.useCallback(() => { return async () => { - await reportPlaybackStopped(); videoRef.current?.stop(); }; }, [])