Sfoglia il codice sorgente

fix(filmstrip-only): DeviceSelectionPopup

master
Hristo Terezov 6 anni fa
parent
commit
f2e0704b93

+ 24
- 9
doc/api.md Vedi File

114
 ```javascript
114
 ```javascript
115
 api.getCurrentDevices().then(function(devices) {
115
 api.getCurrentDevices().then(function(devices) {
116
     // devices = {
116
     // devices = {
117
-    //     'audioInput': 'deviceLabel',
118
-    //     'audioOutput': 'deviceLabel',
119
-    //     'videoInput': 'deviceLabel'
117
+    //     'audioInput': {
118
+    //         deviceId: "ID"
119
+    //         groupId: "grpID"
120
+    //         kind: "videoInput"
121
+    //         label: "Label"
122
+    //     },
123
+    //     'audioOutput': {
124
+    //         deviceId: "ID"
125
+    //         groupId: "grpID"
126
+    //         kind: "videoInput"
127
+    //         label: "Label"
128
+    //     },
129
+    //     'videoInput': {
130
+    //         deviceId: "ID"
131
+    //         groupId: "grpID"
132
+    //         kind: "videoInput"
133
+    //         label: "Label"
134
+    //     }
120
     // }
135
     // }
121
     ...
136
     ...
122
 });
137
 });
143
     ...
158
     ...
144
 });
159
 });
145
 ```
160
 ```
146
-* **setAudioInputDevice** - Sets the audio input device to the one with the label that is passed.
161
+* **setAudioInputDevice** - Sets the audio input device to the one with the label or id that is passed.
147
 
162
 
148
 ```javascript
163
 ```javascript
149
-api.setAudioInputDevice(deviceLabel);
164
+api.setAudioInputDevice(deviceLabel, deviceId);
150
 ```
165
 ```
151
-* **setAudioOutputDevice** - Sets the audio output device to the one with the label that is passed.
166
+* **setAudioOutputDevice** - Sets the audio output device to the one with the label or id that is passed.
152
 
167
 
153
 ```javascript
168
 ```javascript
154
-api.setAudioOutputDevice(deviceLabel);
169
+api.setAudioOutputDevice(deviceLabel, deviceId);
155
 ```
170
 ```
156
-* **setVideoInputDevice** - Sets the video input device to the one with the label that is passed.
171
+* **setVideoInputDevice** - Sets the video input device to the one with the label or id that is passed.
157
 
172
 
158
 ```javascript
173
 ```javascript
159
-api.setVideoInputDevice(deviceLabel);
174
+api.setVideoInputDevice(deviceLabel, deviceId);
160
 ```
175
 ```
161
 
176
 
162
 You can control the embedded Jitsi Meet conference using the `JitsiMeetExternalAPI` object by using `executeCommand`:
177
 You can control the embedded Jitsi Meet conference using the `JitsiMeetExternalAPI` object by using `executeCommand`:

+ 18
- 12
modules/API/external/functions.js Vedi File

101
 }
101
 }
102
 
102
 
103
 /**
103
 /**
104
- * Sets the audio input device to the one with the id that is passed.
104
+ * Sets the audio input device to the one with the label or id that is passed.
105
  *
105
  *
106
  * @param {Transport} transport - The @code{Transport} instance responsible for
106
  * @param {Transport} transport - The @code{Transport} instance responsible for
107
  * the external communication.
107
  * the external communication.
108
  * @param {string} label - The label of the new device.
108
  * @param {string} label - The label of the new device.
109
+ * @param {string} id - The id of the new device.
109
  * @returns {Promise}
110
  * @returns {Promise}
110
  */
111
  */
111
-export function setAudioInputDevice(transport: Object, label: string) {
112
+export function setAudioInputDevice(transport: Object, label: string, id: string) {
112
     return _setDevice(transport, {
113
     return _setDevice(transport, {
113
-        label,
114
-        kind: 'audioinput'
114
+        id,
115
+        kind: 'audioinput',
116
+        label
115
     });
117
     });
116
 }
118
 }
117
 
119
 
118
 /**
120
 /**
119
- * Sets the audio output device to the one with the id that is passed.
121
+ * Sets the audio output device to the one with the label or id that is passed.
120
  *
122
  *
121
  * @param {Transport} transport - The @code{Transport} instance responsible for
123
  * @param {Transport} transport - The @code{Transport} instance responsible for
122
  * the external communication.
124
  * the external communication.
123
  * @param {string} label - The label of the new device.
125
  * @param {string} label - The label of the new device.
126
+ * @param {string} id - The id of the new device.
124
  * @returns {Promise}
127
  * @returns {Promise}
125
  */
128
  */
126
-export function setAudioOutputDevice(transport: Object, label: string) {
129
+export function setAudioOutputDevice(transport: Object, label: string, id: string) {
127
     return _setDevice(transport, {
130
     return _setDevice(transport, {
128
-        label,
129
-        kind: 'audiooutput'
131
+        id,
132
+        kind: 'audiooutput',
133
+        label
130
     });
134
     });
131
 }
135
 }
132
 
136
 
147
 }
151
 }
148
 
152
 
149
 /**
153
 /**
150
- * Sets the video input device to the one with the id that is passed.
154
+ * Sets the video input device to the one with the label or id that is passed.
151
  *
155
  *
152
  * @param {Transport} transport - The @code{Transport} instance responsible for
156
  * @param {Transport} transport - The @code{Transport} instance responsible for
153
  * the external communication.
157
  * the external communication.
154
  * @param {string} label - The label of the new device.
158
  * @param {string} label - The label of the new device.
159
+ * @param {string} id - The id of the new device.
155
  * @returns {Promise}
160
  * @returns {Promise}
156
  */
161
  */
157
-export function setVideoInputDevice(transport: Object, label: string) {
162
+export function setVideoInputDevice(transport: Object, label: string, id: string) {
158
     return _setDevice(transport, {
163
     return _setDevice(transport, {
159
-        label,
160
-        kind: 'videoinput'
164
+        id,
165
+        kind: 'videoinput',
166
+        label
161
     });
167
     });
162
 }
168
 }

+ 8
- 5
react/features/device-selection/functions.js Vedi File

84
                     const audioOutputDeviceId = getAudioOutputDeviceId();
84
                     const audioOutputDeviceId = getAudioOutputDeviceId();
85
                     const { cameraDeviceId, micDeviceId } = settings;
85
                     const { cameraDeviceId, micDeviceId } = settings;
86
 
86
 
87
-                    devices.forEach(({ deviceId, label }) => {
87
+                    devices.forEach(device => {
88
+                        const { deviceId } = device;
89
+
88
                         switch (deviceId) {
90
                         switch (deviceId) {
89
                         case micDeviceId:
91
                         case micDeviceId:
90
-                            audioInput = label;
92
+                            audioInput = device;
91
                             break;
93
                             break;
92
                         case audioOutputDeviceId:
94
                         case audioOutputDeviceId:
93
-                            audioOutput = label;
95
+                            audioOutput = device;
94
                             break;
96
                             break;
95
                         case cameraDeviceId:
97
                         case cameraDeviceId:
96
-                            videoInput = label;
98
+                            videoInput = device;
97
                             break;
99
                             break;
98
                         }
100
                         }
99
                     });
101
                     });
145
                 return true;
147
                 return true;
146
             }
148
             }
147
 
149
 
148
-            const deviceId = getDeviceIdByLabel(state, device.label);
150
+            const { label, id } = device;
151
+            const deviceId = label ? getDeviceIdByLabel(state, device.label) : id;
149
 
152
 
150
             if (deviceId) {
153
             if (deviceId) {
151
                 switch (device.kind) {
154
                 switch (device.kind) {

+ 17
- 5
react/features/settings/components/web/DeviceSelectionPopup.js Vedi File

18
     setAudioInputDevice,
18
     setAudioInputDevice,
19
     setAudioOutputDevice,
19
     setAudioOutputDevice,
20
     setVideoInputDevice
20
     setVideoInputDevice
21
-} from '../../../../../modules/API/external';
21
+} from '../../../../../modules/API/external/functions';
22
 
22
 
23
 import { parseURLParams } from '../../../base/config';
23
 import { parseURLParams } from '../../../base/config';
24
 import { DialogWithTabs } from '../../../base/dialog';
24
 import { DialogWithTabs } from '../../../base/dialog';
118
      * @returns {Promise}
118
      * @returns {Promise}
119
      */
119
      */
120
     _getCurrentDevices() {
120
     _getCurrentDevices() {
121
-        return getCurrentDevices(this._transport);
121
+        return getCurrentDevices(this._transport).then(currentDevices => {
122
+            const {
123
+                audioInput = {},
124
+                audioOutput = {},
125
+                videoInput = {}
126
+            } = currentDevices;
127
+
128
+            return {
129
+                audioInput: audioInput.deviceId,
130
+                audioOutput: audioOutput.deviceId,
131
+                videoInput: videoInput.deviceId
132
+            };
133
+        });
122
     }
134
     }
123
 
135
 
124
     /**
136
     /**
252
      * @returns {Promise}
264
      * @returns {Promise}
253
      */
265
      */
254
     _setAudioInputDevice(id) {
266
     _setAudioInputDevice(id) {
255
-        return setAudioInputDevice(this._transport, id);
267
+        return setAudioInputDevice(this._transport, undefined, id);
256
     }
268
     }
257
 
269
 
258
     /**
270
     /**
262
      * @returns {Promise}
274
      * @returns {Promise}
263
      */
275
      */
264
     _setAudioOutputDevice(id) {
276
     _setAudioOutputDevice(id) {
265
-        return setAudioOutputDevice(this._transport, id);
277
+        return setAudioOutputDevice(this._transport, undefined, id);
266
     }
278
     }
267
 
279
 
268
     /**
280
     /**
272
      * @returns {Promise}
284
      * @returns {Promise}
273
      */
285
      */
274
     _setVideoInputDevice(id) {
286
     _setVideoInputDevice(id) {
275
-        return setVideoInputDevice(this._transport, id);
287
+        return setVideoInputDevice(this._transport, undefined, id);
276
     }
288
     }
277
 
289
 
278
     /**
290
     /**

Loading…
Annulla
Salva