From a9564b31ef6753bff64aa7c688f23a654d029ae8 Mon Sep 17 00:00:00 2001 From: raviteja83 Date: Mon, 4 Sep 2023 14:46:16 +0530 Subject: [PATCH] fix: screenshare track showing video track --- .../src/media/tracks/HMSLocalVideoTrack.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/hms-video-web/src/media/tracks/HMSLocalVideoTrack.ts b/packages/hms-video-web/src/media/tracks/HMSLocalVideoTrack.ts index fd5740d70f..476b90c201 100644 --- a/packages/hms-video-web/src/media/tracks/HMSLocalVideoTrack.ts +++ b/packages/hms-video-web/src/media/tracks/HMSLocalVideoTrack.ts @@ -344,6 +344,7 @@ export class HMSLocalVideoTrack extends HMSVideoTrack { return newSettings; }; + // eslint-disable-next-line complexity private handleSettingsChange = async (settings: HMSVideoTrackSettings) => { const stream = this.stream as HMSLocalStream; const hasPropertyChanged = generateHasPropertyChanged(settings, this.settings); @@ -352,10 +353,14 @@ export class HMSLocalVideoTrack extends HMSVideoTrack { } if (hasPropertyChanged('width') || hasPropertyChanged('height') || hasPropertyChanged('advanced')) { - const track = await this.replaceTrackWith(settings); - await this.replaceSender(track, this.enabled); - this.nativeTrack = track; - this.videoHandler.updateSinks(); + if (this.source === 'video') { + const track = await this.replaceTrackWith(settings); + await this.replaceSender(track, this.enabled); + this.nativeTrack = track; + this.videoHandler.updateSinks(); + } else { + await this.nativeTrack.applyConstraints(settings.toConstraints()); + } } };