Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Always uses the id for the device extrackted from the track.

damenchodeaf5ba6121b
diff --git a/conference.js b/conference.js
index 66fbe93af1..bf6f5a2da5 100644
--- a/conference.js
+++ b/conference.js
@@ -2094,9 +2094,7 @@ export default {
})
.then(() => {
logger.log('switched local video device');
- APP.store.dispatch(updateSettings({
- cameraDeviceId
- }));
+ this._updateVideoDeviceId();
})
.catch(err => {
APP.UI.showCameraErrorNotification(err);
@@ -2128,9 +2126,8 @@ export default {
.then(stream => {
this.useAudioStream(stream);
logger.log('switched local audio device');
- APP.store.dispatch(updateSettings({
- micDeviceId
- }));
+
+ this._updateAudioDeviceId();
})
.catch(err => {
APP.UI.showMicErrorNotification(err);
@@ -2301,18 +2298,9 @@ export default {
// Ugly way to synchronize real device IDs with local
// storage and settings menu. This is a workaround until
// getConstraints() method will be implemented in browsers.
- if (this.localAudio) {
- dispatch(updateSettings({
- micDeviceId: this.localAudio.getDeviceId()
- }));
- }
+ this._updateAudioDeviceId();
- if (this.localVideo
- && this.localVideo.videoType === 'camera') {
- dispatch(updateSettings({
- cameraDeviceId: this.localVideo.getDeviceId()
- }));
- }
+ this._updateVideoDeviceId();
APP.UI.onAvailableDevicesChanged(devices);
});
@@ -2321,6 +2309,33 @@ export default {
return Promise.resolve();
},
+ /**
+ * Updates the settings for the currently used video device, extracting
+ * the device id from the used track.
+ * @private
+ */
+ _updateVideoDeviceId() {
+ if (this.localVideo
+ && this.localVideo.videoType === 'camera') {
+ APP.store.dispatch(updateSettings({
+ cameraDeviceId: this.localVideo.getDeviceId()
+ }));
+ }
+ },
+
+ /**
+ * Updates the settings for the currently used audio device, extracting
+ * the device id from the used track.
+ * @private
+ */
+ _updateAudioDeviceId() {
+ if (this.localAudio) {
+ APP.store.dispatch(updateSettings({
+ micDeviceId: this.localAudio.getDeviceId()
+ }));
+ }
+ },
+
/**
* Event listener for JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED to
* handle change of available media devices.
@@ -2396,12 +2411,9 @@ export default {
// Use the new stream or null if we failed to obtain it.
return useStream(tracks.find(track => track.getType() === mediaType) || null)
.then(() => {
- const settings
- = mediaType === 'audio'
- ? { micDeviceId: newDevices.audioinput }
- : { cameraDeviceId: newDevices.videoinput };
-
- APP.store.dispatch(updateSettings(settings));
+ mediaType === 'audio'
+ ? this._updateAudioDeviceId()
+ : this._updateVideoDeviceId();
});
}