diff --git a/packages/hms-video-store/src/device-manager/DeviceManager.ts b/packages/hms-video-store/src/device-manager/DeviceManager.ts index b7a851cd95..8fedbc647c 100644 --- a/packages/hms-video-store/src/device-manager/DeviceManager.ts +++ b/packages/hms-video-store/src/device-manager/DeviceManager.ts @@ -31,7 +31,7 @@ export class DeviceManager implements HMSDeviceManager { hasWebcamPermission = false; hasMicrophonePermission = false; - prevSelection: SelectedDevices = { + currentSelection: SelectedDevices = { audioInput: undefined, videoInput: undefined, audioOutput: undefined, diff --git a/packages/hms-video-store/src/sdk/RoleChangeManager.ts b/packages/hms-video-store/src/sdk/RoleChangeManager.ts index 9a19d0d8e0..c13b2519bf 100644 --- a/packages/hms-video-store/src/sdk/RoleChangeManager.ts +++ b/packages/hms-video-store/src/sdk/RoleChangeManager.ts @@ -167,11 +167,11 @@ export default class RoleChangeManager { private getAudioDeviceSettings(): { audioInputDeviceId: string; audioOutputDeviceId: string } { const initialSettings = this.store.getConfig()?.settings; const audioInputDeviceId = - this.deviceManager.prevSelection[DeviceType.audioInput]?.deviceId || + this.deviceManager.currentSelection[DeviceType.audioInput]?.deviceId || initialSettings?.audioInputDeviceId || 'default'; const audioOutputDeviceId = - this.deviceManager.prevSelection[DeviceType.audioOutput]?.deviceId || + this.deviceManager.currentSelection[DeviceType.audioOutput]?.deviceId || initialSettings?.audioOutputDeviceId || 'default'; @@ -184,7 +184,9 @@ export default class RoleChangeManager { private getVideoInputDeviceId(): string { const initialSettings = this.store.getConfig()?.settings; return ( - this.deviceManager.prevSelection[DeviceType.videoInput]?.deviceId || initialSettings?.videoDeviceId || 'default' + this.deviceManager.currentSelection[DeviceType.videoInput]?.deviceId || + initialSettings?.videoDeviceId || + 'default' ); } } diff --git a/packages/hms-video-store/src/sdk/index.ts b/packages/hms-video-store/src/sdk/index.ts index 4c6ac63245..50bd36b0eb 100644 --- a/packages/hms-video-store/src/sdk/index.ts +++ b/packages/hms-video-store/src/sdk/index.ts @@ -1350,7 +1350,7 @@ export class HMSSdk implements HMSInterface { } private handleLocalRoleUpdate = async ({ oldRole, newRole }: { oldRole: HMSRole; newRole: HMSRole }) => { - this.deviceManager.prevSelection = this.deviceManager.getCurrentSelection(); + this.deviceManager.currentSelection = this.deviceManager.getCurrentSelection(); await this.transport.handleLocalRoleUpdate({ oldRole, newRole }); await this.roleChangeManager?.handleLocalPeerRoleUpdate({ oldRole, newRole }); await this.interactivityCenter.whiteboard.handleLocalRoleUpdate();