From 04bc4175f4ee02a610a01f3839d2622b38d08940 Mon Sep 17 00:00:00 2001 From: Timo K Date: Tue, 29 Jul 2025 17:10:40 +0200 Subject: [PATCH] Set available devices to empty map on safari. Signed-off-by: Timo K --- src/livekit/MatrixAudioRenderer.tsx | 4 ++-- src/room/InCallView.tsx | 2 +- src/state/MediaDevices.ts | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/livekit/MatrixAudioRenderer.tsx b/src/livekit/MatrixAudioRenderer.tsx index 1afa53e5..d59bb127 100644 --- a/src/livekit/MatrixAudioRenderer.tsx +++ b/src/livekit/MatrixAudioRenderer.tsx @@ -182,7 +182,7 @@ interface StereoPanAudioTrackProps { /** * This wraps `livekit.AudioTrack` to allow adding audio nodes to a track. * It main purpose is to remount the AudioTrack component when switching from - * audiooContext to normal audio playback. + * audioContext to normal audio playback. * As of now the AudioTrack component does not support adding audio nodes while being mounted. * @param param0 * @returns @@ -202,7 +202,7 @@ function AudioTrackWithAudioNodes({ const [trackReady, setTrackReady] = useReactiveState( () => false, // We only want the track to reset once both (audioNodes and audioContext) are set. - // for unsetting the audioContext its enough if one of the the is undefined. + // for unsetting the audioContext its enough if one of the two is undefined. [audioContext && audioNodes], ); diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index f99e368b..5f8e7c28 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -150,7 +150,7 @@ export const ActiveCall: FC = (props) => { ?.disconnect() .then(() => { logger.info( - `[Lifecycle] Disconnected from livekite room, state:${livekitRoom?.state}`, + `[Lifecycle] Disconnected from livekit room, state:${livekitRoom?.state}`, ); }) .catch((e) => { diff --git a/src/state/MediaDevices.ts b/src/state/MediaDevices.ts index 3a09bf91..a81df9b1 100644 --- a/src/state/MediaDevices.ts +++ b/src/state/MediaDevices.ts @@ -211,7 +211,7 @@ class AudioOutput public readonly available$ = this.scope.behavior( availableRawDevices$("audiooutput", this.usingNames$, this.scope).pipe( map((availableRaw) => { - const available: Map = + let available: Map = buildDeviceMap(availableRaw); // Create a virtual default audio output for browsers that don't have one. // Its device ID must be the empty string because that's what setSinkId @@ -221,6 +221,10 @@ class AudioOutput type: "default", name: availableRaw[0]?.label || null, }); + if (navigator.userAgent.includes("Safari")) { + // set to empty map if we are on Safari, because it does not support setSinkId + available = new Map(); + } // Note: creating virtual default input devices would be another problem // entirely, because requesting a media stream from deviceId "" won't // automatically track the default device.