Skip to content

Commit

Permalink
Make sure that processorElement stays muted after attach (#984)
Browse files Browse the repository at this point in the history
* Make sure that processorElement stays muted after attach

* Create afraid-humans-visit.md
  • Loading branch information
lukasIO authored Jan 4, 2024
1 parent 75b0abd commit 8a980dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/afraid-humans-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"livekit-client": patch
---

Make sure that processorElement stays muted after attach
5 changes: 4 additions & 1 deletion src/room/track/LocalTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ export default abstract class LocalTrack extends Track {
}

attachToElement(newTrack, this.processorElement);
// ensure the processorElement itself stays muted
this.processorElement.muted = true;
await this.processor.restart({
track: newTrack,
kind: this.kind,
Expand Down Expand Up @@ -415,9 +417,10 @@ export default abstract class LocalTrack extends Track {
throw TypeError('cannot set processor on track of unknown kind');
}
this.processorElement = this.processorElement ?? document.createElement(this.kind);
this.processorElement.muted = true;

attachToElement(this._mediaStreamTrack, this.processorElement);
this.processorElement.muted = true;

this.processorElement
.play()
.catch((error) => log.error('failed to play processor element', { error }));
Expand Down

0 comments on commit 8a980dc

Please sign in to comment.