|
|
@@ -21,6 +21,28 @@ import {
|
|
21
|
21
|
|
|
22
|
22
|
const logger = require('jitsi-meet-logger').getLogger(__filename);
|
|
23
|
23
|
|
|
|
24
|
+/**
|
|
|
25
|
+ * Maps the WebRTC string for device type to the keys used to store configure,
|
|
|
26
|
+ * within redux, which devices should be used by default.
|
|
|
27
|
+ */
|
|
|
28
|
+const DEVICE_TYPE_TO_SETTINGS_KEYS = {
|
|
|
29
|
+ audioInput: {
|
|
|
30
|
+ currentDeviceId: 'micDeviceId',
|
|
|
31
|
+ userSelectedDeviceId: 'userSelectedMicDeviceId',
|
|
|
32
|
+ userSelectedDeviceLabel: 'userSelectedMicDeviceLabel'
|
|
|
33
|
+ },
|
|
|
34
|
+ audioOutput: {
|
|
|
35
|
+ currentDeviceId: 'audioOutputDeviceId',
|
|
|
36
|
+ userSelectedDeviceId: 'userSelectedAudioOutputDeviceId',
|
|
|
37
|
+ userSelectedDeviceLabel: 'userSelectedAudioOutputDeviceLabel'
|
|
|
38
|
+ },
|
|
|
39
|
+ videoInput: {
|
|
|
40
|
+ currentDeviceId: 'audioOutputDeviceId',
|
|
|
41
|
+ userSelectedDeviceId: 'userSelectedCameraDeviceId',
|
|
|
42
|
+ userSelectedDeviceLabel: 'userSelectedCameraDeviceLabel'
|
|
|
43
|
+ }
|
|
|
44
|
+};
|
|
|
45
|
+
|
|
24
|
46
|
/**
|
|
25
|
47
|
* Adds a pending device request.
|
|
26
|
48
|
*
|
|
|
@@ -70,19 +92,19 @@ export function configureInitialDevices() {
|
|
70
|
92
|
|
|
71
|
93
|
return;
|
|
72
|
94
|
}
|
|
|
95
|
+
|
|
73
|
96
|
const newSettings = {};
|
|
74
|
|
- const devicesKeysToSettingsKeys = {
|
|
75
|
|
- audioInput: 'micDeviceId',
|
|
76
|
|
- audioOutput: 'audioOutputDeviceId',
|
|
77
|
|
- videoInput: 'cameraDeviceId'
|
|
78
|
|
- };
|
|
79
|
97
|
|
|
80
|
98
|
Object.keys(deviceLabels).forEach(key => {
|
|
81
|
99
|
const label = deviceLabels[key];
|
|
82
|
100
|
const deviceId = getDeviceIdByLabel(state, label, key);
|
|
83
|
101
|
|
|
84
|
102
|
if (deviceId) {
|
|
85
|
|
- newSettings[devicesKeysToSettingsKeys[key]] = deviceId;
|
|
|
103
|
+ const settingsTranslationMap = DEVICE_TYPE_TO_SETTINGS_KEYS[key];
|
|
|
104
|
+
|
|
|
105
|
+ newSettings[settingsTranslationMap.currentDeviceId] = deviceId;
|
|
|
106
|
+ newSettings[settingsTranslationMap.userSelectedDeviceId] = deviceId;
|
|
|
107
|
+ newSettings[settingsTranslationMap.userSelectedDeviceLabel] = label;
|
|
86
|
108
|
}
|
|
87
|
109
|
});
|
|
88
|
110
|
|