From 5c90f7dce7b24069ecfaeedb4be3f4892f380963 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Mon, 15 Jul 2024 16:52:34 -0500 Subject: [PATCH] Check if camera is active before disabling liveReady (#12461) --- web/src/components/player/LivePlayer.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web/src/components/player/LivePlayer.tsx b/web/src/components/player/LivePlayer.tsx index 1ff5c5f37..180017eb9 100644 --- a/web/src/components/player/LivePlayer.tsx +++ b/web/src/components/player/LivePlayer.tsx @@ -79,7 +79,15 @@ export default function LivePlayer({ } if (!cameraActive) { - setTimeout(() => setLiveReady(false), 500); + const timer = setTimeout(() => { + if (!cameraActive) { + setLiveReady(false); + } + }, 500); + + return () => { + clearTimeout(timer); + }; } // live mode won't change // eslint-disable-next-line react-hooks/exhaustive-deps