From 7bdb63399911659e6c2e6a13ecffd06d49d5fbaa Mon Sep 17 00:00:00 2001 From: Timo K Date: Tue, 10 Oct 2023 12:30:56 +0200 Subject: [PATCH] improve comment Signed-off-by: Timo K --- src/livekit/useLiveKit.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/livekit/useLiveKit.ts b/src/livekit/useLiveKit.ts index cc9aefaf..d4b8a9bd 100644 --- a/src/livekit/useLiveKit.ts +++ b/src/livekit/useLiveKit.ts @@ -145,8 +145,11 @@ export function useLiveKit( .catch((e) => logger.error("Failed to sync video mute state with LiveKit", e) ) - // Run the check recursively. Because the user can update the state (presses mute button) - // while the device is enabling itself we need to check after we are done if its still in sync. + // Run the check again after the change is done. Because the user + // can update the state (presses mute button) while the device is enabling + // 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. .then(() => syncMuteStateAudio()); } };