From e5509c7c5041ddc4a090007254d8787896aedf15 Mon Sep 17 00:00:00 2001 From: Andrei Gavrilescu <51706180+andrei-gavrilescu@users.noreply.github.com> Date: Tue, 22 Feb 2022 11:04:36 +0200 Subject: [PATCH] fix: realDeviceId match by label and deviceId (#1919) --- modules/RTC/JitsiLocalTrack.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/RTC/JitsiLocalTrack.js b/modules/RTC/JitsiLocalTrack.js index 17884839e6..307ee97ee1 100644 --- a/modules/RTC/JitsiLocalTrack.js +++ b/modules/RTC/JitsiLocalTrack.js @@ -470,7 +470,9 @@ export default class JitsiLocalTrack extends JitsiTrack { _setRealDeviceIdFromDeviceList(devices) { const track = this.getTrack(); const kind = `${track.kind}input`; - let device = devices.find(d => d.kind === kind && d.label === track.label); + + // We need to match by deviceId as well, in case of multiple devices with the same label. + let device = devices.find(d => d.kind === kind && d.label === track.label && d.deviceId === this.deviceId); if (!device && this._realDeviceId === 'default') { // the default device has been changed. // If the default device was 'A' and the default device is changed to 'B' the label for the track will