diff --git a/packages/hms-video-store/src/media/tracks/HMSLocalAudioTrack.ts b/packages/hms-video-store/src/media/tracks/HMSLocalAudioTrack.ts index 713bbc5496..721f18551c 100644 --- a/packages/hms-video-store/src/media/tracks/HMSLocalAudioTrack.ts +++ b/packages/hms-video-store/src/media/tracks/HMSLocalAudioTrack.ts @@ -65,7 +65,7 @@ export class HMSLocalAudioTrack extends HMSAudioTrack { } clone(stream?: HMSLocalStream) { - return new HMSLocalAudioTrack( + const track = new HMSLocalAudioTrack( stream || (this.stream as HMSLocalStream).clone(), this.nativeTrack.clone(), this.source!, @@ -73,6 +73,13 @@ export class HMSLocalAudioTrack extends HMSAudioTrack { this.settings, this.room, ); + + if (this.pluginsManager.pluginsMap.size > 0) { + this.pluginsManager.pluginsMap.forEach(value => { + track.addPlugin(value); + }); + } + return track; } getManuallySelectedDeviceId() { diff --git a/packages/hms-video-store/src/media/tracks/HMSLocalVideoTrack.ts b/packages/hms-video-store/src/media/tracks/HMSLocalVideoTrack.ts index faa7537dd8..bf0e24be33 100644 --- a/packages/hms-video-store/src/media/tracks/HMSLocalVideoTrack.ts +++ b/packages/hms-video-store/src/media/tracks/HMSLocalVideoTrack.ts @@ -90,7 +90,7 @@ export class HMSLocalVideoTrack extends HMSVideoTrack { } clone(stream?: HMSLocalStream) { - return new HMSLocalVideoTrack( + const track = new HMSLocalVideoTrack( stream || (this.stream as HMSLocalStream).clone(), this.nativeTrack.clone(), this.source!, @@ -98,6 +98,15 @@ export class HMSLocalVideoTrack extends HMSVideoTrack { this.settings, this.room, ); + if (this.pluginsManager.pluginsMap.size > 0) { + this.pluginsManager.pluginsMap.forEach(value => { + track.addPlugin(value); + }); + } + if (this.mediaStreamPluginsManager.plugins.size > 0) { + track.addStreamPlugins(Array.from(this.mediaStreamPluginsManager.plugins)); + } + return track; } /** @internal */ diff --git a/packages/hms-video-store/src/plugins/audio/HMSAudioPluginsManager.ts b/packages/hms-video-store/src/plugins/audio/HMSAudioPluginsManager.ts index 649d556e75..75100bb9a5 100644 --- a/packages/hms-video-store/src/plugins/audio/HMSAudioPluginsManager.ts +++ b/packages/hms-video-store/src/plugins/audio/HMSAudioPluginsManager.ts @@ -32,7 +32,7 @@ export class HMSAudioPluginsManager { private readonly TAG = '[AudioPluginsManager]'; private readonly hmsTrack: HMSLocalAudioTrack; // Map maintains the insertion order - private readonly pluginsMap: Map; + readonly pluginsMap: Map; private audioContext?: AudioContext; private sourceNode?: MediaStreamAudioSourceNode; diff --git a/packages/hms-video-store/src/plugins/video/HMSMediaStreamPluginsManager.ts b/packages/hms-video-store/src/plugins/video/HMSMediaStreamPluginsManager.ts index d6d5669ecc..1991355757 100644 --- a/packages/hms-video-store/src/plugins/video/HMSMediaStreamPluginsManager.ts +++ b/packages/hms-video-store/src/plugins/video/HMSMediaStreamPluginsManager.ts @@ -8,7 +8,7 @@ import HMSLogger from '../../utils/logger'; export class HMSMediaStreamPluginsManager { private readonly TAG = '[MediaStreamPluginsManager]'; private analytics: VideoPluginsAnalytics; - private plugins: Set; + readonly plugins: Set; private room?: Room; constructor(eventBus: EventBus, room?: Room) { diff --git a/packages/hms-video-store/src/plugins/video/HMSVideoPluginsManager.ts b/packages/hms-video-store/src/plugins/video/HMSVideoPluginsManager.ts index c976dc610a..2a018cbfce 100644 --- a/packages/hms-video-store/src/plugins/video/HMSVideoPluginsManager.ts +++ b/packages/hms-video-store/src/plugins/video/HMSVideoPluginsManager.ts @@ -47,7 +47,7 @@ export class HMSVideoPluginsManager { private pluginsLoopRunning = false; private pluginsLoopState: 'paused' | 'running' = 'paused'; private readonly hmsTrack: HMSLocalVideoTrack; - private readonly pluginsMap: Map; // plugin names to their instance mapping + readonly pluginsMap: Map; // plugin names to their instance mapping private inputVideo?: HTMLVideoElement; private inputCanvas?: CanvasElement; private outputCanvas?: CanvasElement;