Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(logging) Add more info logs for device switching.
Jaya Allamsetty2f10d8018401
diff --git a/conference.js b/conference.jsindex 921e7da401..43ae70f58d 100644--- a/conference.js+++ b/conference.js@@ -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));});}diff --git a/react/features/prejoin/actions.js b/react/features/prejoin/actions.jsindex d529563b48..d965023914 100644--- a/react/features/prejoin/actions.js+++ b/react/features/prejoin/actions.js@@ -359,10 +359,12 @@ export function replaceAudioTrackById(deviceId: string) {const tracks = getState()['features/base/tracks'];const newTrack = await createLocalTrack('audio', deviceId);const oldTrack = getLocalAudioTrack(tracks)?.jitsiTrack;+ const micDeviceId = newTrack.getDeviceId();+ logger.info(`Switching audio input device to ${micDeviceId}`);dispatch(replaceLocalTrack(oldTrack, newTrack)).then(() => {dispatch(updateSettings({- micDeviceId: newTrack.getDeviceId()+ micDeviceId}));});} catch (err) {@@ -390,10 +392,12 @@ export function replaceVideoTrackById(deviceId: Object) {getState });const oldTrack = getLocalVideoTrack(tracks)?.jitsiTrack;+ const cameraDeviceId = newTrack.getDeviceId();+ logger.info(`Switching camera to ${cameraDeviceId}`);dispatch(replaceLocalTrack(oldTrack, newTrack)).then(() => {dispatch(updateSettings({- cameraDeviceId: newTrack.getDeviceId()+ cameraDeviceId}));});wasVideoMuted && newTrack.mute();