From 09c6ad47d5dbb537db75547114170c879f306ac1 Mon Sep 17 00:00:00 2001 From: Alex Kim Date: Sat, 12 Oct 2024 19:07:16 +1100 Subject: [PATCH] Update visual playback when exiting video --- app/(auth)/play-video.tsx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/app/(auth)/play-video.tsx b/app/(auth)/play-video.tsx index cce91dcc..89502154 100644 --- a/app/(auth)/play-video.tsx +++ b/app/(auth)/play-video.tsx @@ -15,6 +15,7 @@ import { getAuthHeaders } from "@/utils/jellyfin/jellyfin"; import { secondsToTicks } from "@/utils/secondsToTicks"; import { Api } from "@jellyfin/sdk"; import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api"; +import { useQueryClient } from "@tanstack/react-query"; import * as Haptics from "expo-haptics"; import { useFocusEffect } from "expo-router"; import { useAtomValue } from "jotai"; @@ -105,7 +106,36 @@ export default function page() { videoRef.current?.pause(); }, [videoRef]); + const queryClient = useQueryClient(); + const stop = useCallback(() => { + queryClient.invalidateQueries({ + queryKey: ["item", playSettings?.item?.Id], + }); + queryClient.invalidateQueries({ + queryKey: ["resumeItems"], + }); + queryClient.invalidateQueries({ + queryKey: ["continueWatching"], + }); + queryClient.invalidateQueries({ + queryKey: ["nextUp-all"], + }); + queryClient.invalidateQueries({ + queryKey: ["nextUp"], + }); + queryClient.invalidateQueries({ + queryKey: ["episodes"], + }); + queryClient.invalidateQueries({ + queryKey: ["seasons"], + }); + queryClient.invalidateQueries({ + queryKey: ["nextUp-all"], + }); + queryClient.invalidateQueries({ + queryKey: ["home"], + }); setIsPlaybackStopped(true); videoRef.current?.pause(); reportPlaybackStopped();