acceptable-dream-85180
08/26/2025, 1:18 PMcannot switch audio output, the current browser does not support it I would like to disconnect the room and show my users a friendly disclaimer, but I don't know where the error is coming from and what I should catch. I am using RoomContext.Provider and AudioTrackComponent, AudioTrackComponent is already wrapped in an ErrorBoundary, but that does not seem to catch the error, the app does not fail, but the room disconnect callback does not trigger:
<ErrorBoundary onError={onAudioOutputError}>
<AudioTrackComponent trackRef={track} />
</ErrorBoundary>tall-airline-16756
08/26/2025, 1:18 PMtall-airline-16756
08/26/2025, 1:19 PMcannot switch audio output, the current browser does not support it pops up when you try to change the audio output device in a browser that doesn’t support the setSinkId API—like Safari or any Safari-based browsers (including iOS). Here’s how you can handle it:
• Check Browser Compatibility: Before switching the audio output, it’s a good idea to check if the browser actually supports setSinkId. You can use supportsSetSinkId() to do this easily.
• Prevent Unsupported Actions: Add some logic to avoid trying to switch audio output in browsers that don’t support it, like Safari. For example, check the browser name and OS before making the switch.
• Display User-Friendly Messages: When the error happens, catch it and gently let users know that switching audio output isn’t supported in their current browser, and maybe suggest trying a supported one like Chrome.
• Graceful Fallback: Make sure your app keeps running smoothly by sticking with the current audio output if switching doesn’t work.
Since your AudioTrackComponent is already wrapped in an ErrorBoundary, double-check that the error is actually being caught there. If it’s not triggering the boundary, you might want to catch the error explicitly where you try to switch the audio output and handle it right there.
Sources: src/room/Room.ts | packages/core/src/components/mediaDeviceSelect.ts