From 8a980dc52952189f6ca3a9127ad73f855e05504e Mon Sep 17 00:00:00 2001 From: lukasIO Date: Thu, 4 Jan 2024 01:29:56 +0100 Subject: [PATCH] Make sure that processorElement stays muted after attach (#984) * Make sure that processorElement stays muted after attach * Create afraid-humans-visit.md --- .changeset/afraid-humans-visit.md | 5 +++++ src/room/track/LocalTrack.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/afraid-humans-visit.md diff --git a/.changeset/afraid-humans-visit.md b/.changeset/afraid-humans-visit.md new file mode 100644 index 0000000000..f4fdceb4e8 --- /dev/null +++ b/.changeset/afraid-humans-visit.md @@ -0,0 +1,5 @@ +--- +"livekit-client": patch +--- + +Make sure that processorElement stays muted after attach diff --git a/src/room/track/LocalTrack.ts b/src/room/track/LocalTrack.ts index 88aa3e2239..0e5f6f1302 100644 --- a/src/room/track/LocalTrack.ts +++ b/src/room/track/LocalTrack.ts @@ -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, @@ -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 }));