Skip to content

Commit 1ffae4c

Browse files
xdeflukasIO
andauthored
Create processorElement before processor init (#1091)
* Create processorElement before processor init * Create four-terms-perform.md --------- Co-authored-by: lukasIO <mail@lukasseiler.de>
1 parent 4679eba commit 1ffae4c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.changeset/four-terms-perform.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"livekit-client": patch
3+
---
4+
5+
Create processorElement before processor init

src/room/track/LocalTrack.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,10 @@ export default abstract class LocalTrack<
448448
const unlock = await this.processorLock.lock();
449449
try {
450450
this.log.debug('setting up processor', this.logContext);
451+
452+
this.processorElement =
453+
this.processorElement ?? (document.createElement(this.kind) as HTMLMediaElement);
454+
451455
const processorOptions = {
452456
kind: this.kind,
453457
track: this._mediaStreamTrack,
@@ -461,8 +465,6 @@ export default abstract class LocalTrack<
461465
if (this.kind === 'unknown') {
462466
throw TypeError('cannot set processor on track of unknown kind');
463467
}
464-
this.processorElement =
465-
this.processorElement ?? (document.createElement(this.kind) as HTMLMediaElement);
466468

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

0 commit comments

Comments
 (0)