fix sync loop by adding a 20ms break for the next mute sync

Signed-off-by: Timo K <toger5@hotmail.de>
This commit is contained in:
Timo K
2023-10-11 19:01:00 +02:00
parent 5900b76be2
commit 1e995c4061

View File

@@ -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();
}
};