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 }));