From daf97fb22e3c87dc64c15634048f16f1c3d671ab Mon Sep 17 00:00:00 2001 From: Timo K Date: Tue, 10 Oct 2023 12:32:45 +0200 Subject: [PATCH] "unswap" audio/video Signed-off-by: Timo K --- src/livekit/useLiveKit.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/livekit/useLiveKit.ts b/src/livekit/useLiveKit.ts index d4b8a9bd..22edd9b5 100644 --- a/src/livekit/useLiveKit.ts +++ b/src/livekit/useLiveKit.ts @@ -139,11 +139,11 @@ export function useLiveKit( const participant = room.localParticipant; const syncMuteStateAudio = () => { - if (participant.isCameraEnabled !== muteStates.video.enabled) { + if (participant.isMicrophoneEnabled !== muteStates.audio.enabled) { participant - .setCameraEnabled(muteStates.video.enabled) + .setMicrophoneEnabled(muteStates.audio.enabled) .catch((e) => - logger.error("Failed to sync video mute state with LiveKit", e) + logger.error("Failed to sync audio mute state with LiveKit", e) ) // Run the check again after the change is done. Because the user // can update the state (presses mute button) while the device is enabling @@ -154,11 +154,11 @@ export function useLiveKit( } }; const syncMuteStateVideo = () => { - if (participant.isMicrophoneEnabled !== muteStates.audio.enabled) { + if (participant.isCameraEnabled !== muteStates.video.enabled) { participant - .setMicrophoneEnabled(muteStates.audio.enabled) + .setCameraEnabled(muteStates.video.enabled) .catch((e) => - logger.error("Failed to sync audio mute state with LiveKit", e) + logger.error("Failed to sync video mute state with LiveKit", e) ) // see above .then(() => syncMuteStateVideo());