From 1e995c406182b87dbd56ce32803b92940e9a0e63 Mon Sep 17 00:00:00 2001 From: Timo K Date: Wed, 11 Oct 2023 19:01:00 +0200 Subject: [PATCH] fix sync loop by adding a 20ms break for the next mute sync Signed-off-by: Timo K --- src/livekit/useLiveKit.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/livekit/useLiveKit.ts b/src/livekit/useLiveKit.ts index 5396d4b3..d36894e5 100644 --- a/src/livekit/useLiveKit.ts +++ b/src/livekit/useLiveKit.ts @@ -171,6 +171,7 @@ export function useLiveKit( // itself we need might need to update the mute state right away. // This async recursion makes sure that setCamera/MicrophoneEnabled is // called as little times as possible. + await new Promise((r) => setTimeout(r, 20)); syncMuteStateAudio(); } }; @@ -187,6 +188,7 @@ export function useLiveKit( } videoMuteUpdating.current = false; // see above + await new Promise((r) => setTimeout(r, 20)); syncMuteStateVideo(); } };