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

Correctly apply elementVolume on attach for webaudioMix #922

Merged
merged 2 commits into from
Nov 3, 2023
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/dirty-parrots-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"livekit-client": patch
---

Correctly apply elementVolume on attach for webaudioMix
10 changes: 7 additions & 3 deletions src/room/track/RemoteAudioTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ export default class RemoteAudioTrack extends RemoteTrack {
} else {
super.attach(element);
}
if (this.elementVolume) {
element.volume = this.elementVolume;
}

if (this.sinkId && supportsSetSinkId(element)) {
/* @ts-ignore */
element.setSinkId(this.sinkId);
Expand All @@ -114,6 +112,12 @@ export default class RemoteAudioTrack extends RemoteTrack {
element.volume = 0;
element.muted = true;
}

if (this.elementVolume) {
// make sure volume setting is being applied to the newly attached element
this.setVolume(this.elementVolume);
}

return element;
}

Expand Down
Loading