From 2752df1c15a224efcad9ad9d7ccde5f9007ef17e Mon Sep 17 00:00:00 2001 From: Timo K Date: Thu, 3 Jul 2025 16:22:39 +0200 Subject: [PATCH] reduce changes and switch input device on sync device Signed-off-by: Timo K --- src/livekit/useLivekit.ts | 13 ++++--------- src/room/MuteStates.ts | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/livekit/useLivekit.ts b/src/livekit/useLivekit.ts index 8f302e7a..1eca80f6 100644 --- a/src/livekit/useLivekit.ts +++ b/src/livekit/useLivekit.ts @@ -245,6 +245,7 @@ export function useLivekit( audioMuteUpdating.current = true; trackPublication = await participant.setMicrophoneEnabled( buttonEnabled.current.audio, + room.options.audioCaptureDefaults, ); audioMuteUpdating.current = false; break; @@ -252,6 +253,7 @@ export function useLivekit( videoMuteUpdating.current = true; trackPublication = await participant.setCameraEnabled( buttonEnabled.current.video, + room.options.videoCaptureDefaults, ); videoMuteUpdating.current = false; break; @@ -315,13 +317,7 @@ export function useLivekit( logger.error("Failed to sync video mute state with LiveKit", e); }); } - }, [ - room, - muteStates, - connectionState, - devices.audioInput.selected$, - devices.videoInput.selected$, - ]); + }, [room, muteStates, connectionState]); useEffect(() => { // Sync the requested devices with LiveKit's devices @@ -331,14 +327,13 @@ export function useLivekit( selected$: Observable, ): Subscription => selected$.subscribe((device) => { - logger.warn( + logger.info( "[LivekitRoom] syncDevice room.getActiveDevice(kind) !== d.id :", room.getActiveDevice(kind), " !== ", device?.id, ); if ( - !(kind === "audioinput" && platform === "ios") && device !== undefined && room.getActiveDevice(kind) !== device.id ) { diff --git a/src/room/MuteStates.ts b/src/room/MuteStates.ts index 3a38fe9c..2cacb1ef 100644 --- a/src/room/MuteStates.ts +++ b/src/room/MuteStates.ts @@ -90,7 +90,7 @@ export function useMuteStates(isJoined: boolean): MuteStates { useEffect(() => { // If audio is enabled, we need to request the device names again, // because iOS will not be able to switch to the correct device after un-muting. - // This is one of the main changes that makes iOS work bluetooth audio devices. + // This is one of the main changes that makes iOS work with bluetooth audio devices. if (audio.enabled) { devices.requestDeviceNames(); }