Does webAudioMix only mix output sound tracks?
# ask-ai
a
Does webAudioMix only mix output sound tracks?
t
Thanks for reaching out, Anne. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
The
webAudioMix
option in LiveKit brings together all audio tracks (both input and output) within the Web Audio API context. So, it’s not just mixing the output sound tracks—it handles everything. This makes managing audio way easier for both incoming (remote) and outgoing (local) tracks. Plus, it helps tackle those pesky browser autoplay issues and gives you smoother control over audio playback and syncing. Sources: src/room/Room.ts
a
are there any downside / risks in setting it to true?
t
Enabling
webAudioMix
in LiveKit is generally safe and stable, but there are a few things to keep in mind: • Volume control needs to be handled through the
setVolume
methods on
RemoteParticipant
or `RemoteAudioTrack`—setting volume directly on HTMLAudioElements won’t work as expected. • On iOS, the
AudioContext
starts off in a "suspended" state and needs a user interaction to resume, so audio playback might be delayed or won’t start if this isn’t managed properly. • Switching audio output devices depends on
setSinkId
in the
AudioContext
, but keep in mind this might not be supported in all browsers or setups. • Using this feature means relying on the Web Audio API, so it’s important to manage the
AudioContext
lifecycle carefully. These aren’t big hurdles, but they might mean tweaking your implementation a bit—especially if you’re working with mobile devices or need more advanced audio controls. If you have any questions or need a hand with this, just let me know! Sources: src/room/track/options.ts | SDK migration from v1 to v2 | LiveKit Docs