polite-oil-10264
09/26/2025, 1:49 PMtall-airline-16756
09/26/2025, 1:49 PMtall-airline-16756
09/26/2025, 1:50 PMAudioSession.configureAudio() to choose your preferred audio output (like speaker or earpiece), and then call AudioSession.startAudioSession() before connecting to the room.
• Swift (iOS/macOS): Just set AudioManager.shared.isSpeakerOutputPreferred to decide if you'd like the speaker or receiver for audio output before connecting.
• Web (JavaScript/TypeScript): Use room.setAudioOutput() to pick the default audio output device for remote participant audio tracks—just make sure the necessary device permissions are granted.
If you'd like, I can provide specific code examples or walk you through any part of this for your platform. Just let me know—I'm here to help!
Sources: Sources/LiveKit/Audio/AudioSessionEngineObserver.swift | src/room/Room.ts | Pipeline nodes and hooks | LiveKit Docs | Docs::Agents | livekit-agents/livekit/agents/voice/room_io/room_io.pypolite-oil-10264
09/26/2025, 1:51 PMtall-airline-16756
09/26/2025, 1:51 PMusePreviewDevice. I'm here to help!polite-oil-10264
09/26/2025, 1:52 PMtall-airline-16756
09/26/2025, 1:54 PMusePreviewDevice hook in the LiveKit Web SDK! It’s a great tool for previewing your input devices like the microphone and camera. However, it doesn’t support setting the audioOutput device. But no worries—we can definitely set the audio output (like your speaker) before joining a session using the Room.switchActiveDevice method with kind set to 'audiooutput'.
Here’s a simple way to do it:
1. First, get a list of all available audio output devices:
const devices = await navigator.mediaDevices.enumerateDevices();
const audioOutputs = devices.filter(device => device.kind === 'audiooutput');
1. Then, set the audio output device you want by using its `deviceId`:
await room.switchActiveDevice('audiooutput', deviceId);
Just a quick heads-up: this works if your browser supports the setSinkId API, which isn’t available everywhere yet. If you run into any issues or want me to walk you through this, please don’t hesitate to ask—I’m here to help!
Sources: lib/src/track/options.dart | packages/react/src/prefabs/PreJoin.tsx | examples/demo/index.html