reduce changes and switch input device on sync device

Signed-off-by: Timo K <toger5@hotmail.de>
This commit is contained in:
Timo K
2025-07-03 16:22:39 +02:00
parent 88710688f8
commit 2752df1c15
2 changed files with 5 additions and 10 deletions

View File

@@ -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<SelectedDevice | undefined>,
): 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
) {

View File

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