|
|
|
@ -2577,16 +2577,16 @@ export default { |
|
|
|
|
return stream; |
|
|
|
|
}) |
|
|
|
|
.then(stream => { |
|
|
|
|
logger.log('Switching the local video device.'); |
|
|
|
|
logger.info(`Switching the local video device to ${cameraDeviceId}.`); |
|
|
|
|
|
|
|
|
|
return this.useVideoStream(stream); |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
logger.log('Switched local video device.'); |
|
|
|
|
logger.info(`Switched local video device to ${cameraDeviceId}.`); |
|
|
|
|
this._updateVideoDeviceId(); |
|
|
|
|
}) |
|
|
|
|
.catch(error => { |
|
|
|
|
logger.error(`Switching the local video device failed: ${error}`); |
|
|
|
|
logger.error(`Failed to switch to selected camera:${cameraDeviceId}, error:${error}`); |
|
|
|
|
|
|
|
|
|
return APP.store.dispatch(notifyCameraError(error)); |
|
|
|
|
}); |
|
|
|
@ -2602,20 +2602,20 @@ export default { |
|
|
|
|
// Disable noise suppression if it was enabled on the previous track.
|
|
|
|
|
await APP.store.dispatch(setNoiseSuppressionEnabled(false)); |
|
|
|
|
|
|
|
|
|
// When the 'default' mic needs to be selected, we need to
|
|
|
|
|
// pass the real device id to gUM instead of 'default' in order
|
|
|
|
|
// to get the correct MediaStreamTrack from chrome because of the
|
|
|
|
|
// following bug.
|
|
|
|
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=997689
|
|
|
|
|
const hasDefaultMicChanged = micDeviceId === 'default'; |
|
|
|
|
// When the 'default' mic needs to be selected, we need to pass the real device id to gUM instead of
|
|
|
|
|
// 'default' in order to get the correct MediaStreamTrack from chrome because of the following bug.
|
|
|
|
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=997689.
|
|
|
|
|
const isDefaultMicSelected = micDeviceId === 'default'; |
|
|
|
|
const selectedDeviceId = isDefaultMicSelected |
|
|
|
|
? getDefaultDeviceId(APP.store.getState(), 'audioInput') |
|
|
|
|
: micDeviceId; |
|
|
|
|
|
|
|
|
|
logger.info(`Switching audio input device to ${selectedDeviceId}`); |
|
|
|
|
sendAnalytics(createDeviceChangedEvent('audio', 'input')); |
|
|
|
|
createLocalTracksF({ |
|
|
|
|
devices: [ 'audio' ], |
|
|
|
|
cameraDeviceId: null, |
|
|
|
|
micDeviceId: hasDefaultMicChanged |
|
|
|
|
? getDefaultDeviceId(APP.store.getState(), 'audioInput') |
|
|
|
|
: micDeviceId |
|
|
|
|
micDeviceId: selectedDeviceId |
|
|
|
|
}) |
|
|
|
|
.then(([ stream ]) => { |
|
|
|
|
// if audio was muted before changing the device, mute
|
|
|
|
@ -2635,17 +2635,17 @@ export default { |
|
|
|
|
.then(() => { |
|
|
|
|
const localAudio = getLocalJitsiAudioTrack(APP.store.getState()); |
|
|
|
|
|
|
|
|
|
if (localAudio && hasDefaultMicChanged) { |
|
|
|
|
if (localAudio && isDefaultMicSelected) { |
|
|
|
|
// workaround for the default device to be shown as selected in the
|
|
|
|
|
// settings even when the real device id was passed to gUM because of the
|
|
|
|
|
// above mentioned chrome bug.
|
|
|
|
|
localAudio._realDeviceId = localAudio.deviceId = 'default'; |
|
|
|
|
} |
|
|
|
|
logger.log(`switched local audio device: ${localAudio?.getDeviceId()}`); |
|
|
|
|
|
|
|
|
|
logger.info(`switched local audio input device to: ${selectedDeviceId}`); |
|
|
|
|
this._updateAudioDeviceId(); |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
logger.error(`Failed to switch to selected audio input device ${selectedDeviceId}, error=${err}`); |
|
|
|
|
APP.store.dispatch(notifyMicError(err)); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|