From b4890d7c0665397e5fa6b46002b14d28535bd572 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 15 Apr 2024 07:12:39 -0600 Subject: [PATCH] Set loading when switching cameras --- web/src/components/player/dynamic/DynamicVideoPlayer.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/src/components/player/dynamic/DynamicVideoPlayer.tsx b/web/src/components/player/dynamic/DynamicVideoPlayer.tsx index 598aa919e..7576a90cb 100644 --- a/web/src/components/player/dynamic/DynamicVideoPlayer.tsx +++ b/web/src/components/player/dynamic/DynamicVideoPlayer.tsx @@ -89,7 +89,13 @@ export default function DynamicVideoPlayer({ if (!isScrubbing) { setLoadingTimeout(setTimeout(() => setIsLoading(true), 1000)); } - }, [isScrubbing]); + + return () => { + if (loadingTimeout) { + clearTimeout(loadingTimeout) + } + } + }, [camera, isScrubbing]); const onPlayerLoaded = useCallback(() => { if (!controller || !startTimestamp) {