Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit ActiveDeviceChanged event also for audio-output #1372

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/gorgeous-kings-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"livekit-client": patch
---

Emit ActiveDeviceChanged event also for audio-output
8 changes: 6 additions & 2 deletions src/room/Room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1184,8 +1184,12 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
throw e;
}
}
if (needsUpdateWithoutTracks) {
this.localParticipant.activeDeviceMap.set(kind, deviceId);
if (needsUpdateWithoutTracks || kind === 'audiooutput') {
// if there are not active tracks yet or we're switching audiooutput, we need to manually update the active device map here as changing audio output won't result in a track restart
this.localParticipant.activeDeviceMap.set(
kind,
(kind === 'audiooutput' && this.options.audioOutput?.deviceId) || deviceId,
);
this.emit(RoomEvent.ActiveDeviceChanged, kind, deviceId);
}

Expand Down
Loading