ソースを参照

fix(filmstrip-only): DeviceSelectionPopup

master
Hristo Terezov 6年前
コミット
f2e0704b93

+ 24
- 9
doc/api.md ファイルの表示

@@ -114,9 +114,24 @@ api.getAvailableDevices().then(function(devices) {
114 114
 ```javascript
115 115
 api.getCurrentDevices().then(function(devices) {
116 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,20 +158,20 @@ api.isMultipleAudioInputSupported().then(function(isMultipleAudioInputSupported)
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 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 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 173
 ```javascript
159
-api.setVideoInputDevice(deviceLabel);
174
+api.setVideoInputDevice(deviceLabel, deviceId);
160 175
 ```
161 176
 
162 177
 You can control the embedded Jitsi Meet conference using the `JitsiMeetExternalAPI` object by using `executeCommand`:

+ 18
- 12
modules/API/external/functions.js ファイルの表示

@@ -101,32 +101,36 @@ export function isMultipleAudioInputSupported(transport: Object) {
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 106
  * @param {Transport} transport - The @code{Transport} instance responsible for
107 107
  * the external communication.
108 108
  * @param {string} label - The label of the new device.
109
+ * @param {string} id - The id of the new device.
109 110
  * @returns {Promise}
110 111
  */
111
-export function setAudioInputDevice(transport: Object, label: string) {
112
+export function setAudioInputDevice(transport: Object, label: string, id: string) {
112 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 123
  * @param {Transport} transport - The @code{Transport} instance responsible for
122 124
  * the external communication.
123 125
  * @param {string} label - The label of the new device.
126
+ * @param {string} id - The id of the new device.
124 127
  * @returns {Promise}
125 128
  */
126
-export function setAudioOutputDevice(transport: Object, label: string) {
129
+export function setAudioOutputDevice(transport: Object, label: string, id: string) {
127 130
     return _setDevice(transport, {
128
-        label,
129
-        kind: 'audiooutput'
131
+        id,
132
+        kind: 'audiooutput',
133
+        label
130 134
     });
131 135
 }
132 136
 
@@ -147,16 +151,18 @@ function _setDevice(transport: Object, device) {
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 156
  * @param {Transport} transport - The @code{Transport} instance responsible for
153 157
  * the external communication.
154 158
  * @param {string} label - The label of the new device.
159
+ * @param {string} id - The id of the new device.
155 160
  * @returns {Promise}
156 161
  */
157
-export function setVideoInputDevice(transport: Object, label: string) {
162
+export function setVideoInputDevice(transport: Object, label: string, id: string) {
158 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 ファイルの表示

@@ -84,16 +84,18 @@ export function processRequest( // eslint-disable-line max-params
84 84
                     const audioOutputDeviceId = getAudioOutputDeviceId();
85 85
                     const { cameraDeviceId, micDeviceId } = settings;
86 86
 
87
-                    devices.forEach(({ deviceId, label }) => {
87
+                    devices.forEach(device => {
88
+                        const { deviceId } = device;
89
+
88 90
                         switch (deviceId) {
89 91
                         case micDeviceId:
90
-                            audioInput = label;
92
+                            audioInput = device;
91 93
                             break;
92 94
                         case audioOutputDeviceId:
93
-                            audioOutput = label;
95
+                            audioOutput = device;
94 96
                             break;
95 97
                         case cameraDeviceId:
96
-                            videoInput = label;
98
+                            videoInput = device;
97 99
                             break;
98 100
                         }
99 101
                     });
@@ -145,7 +147,8 @@ export function processRequest( // eslint-disable-line max-params
145 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 153
             if (deviceId) {
151 154
                 switch (device.kind) {

+ 17
- 5
react/features/settings/components/web/DeviceSelectionPopup.js ファイルの表示

@@ -18,7 +18,7 @@ import {
18 18
     setAudioInputDevice,
19 19
     setAudioOutputDevice,
20 20
     setVideoInputDevice
21
-} from '../../../../../modules/API/external';
21
+} from '../../../../../modules/API/external/functions';
22 22
 
23 23
 import { parseURLParams } from '../../../base/config';
24 24
 import { DialogWithTabs } from '../../../base/dialog';
@@ -118,7 +118,19 @@ export default class DeviceSelectionPopup {
118 118
      * @returns {Promise}
119 119
      */
120 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,7 +264,7 @@ export default class DeviceSelectionPopup {
252 264
      * @returns {Promise}
253 265
      */
254 266
     _setAudioInputDevice(id) {
255
-        return setAudioInputDevice(this._transport, id);
267
+        return setAudioInputDevice(this._transport, undefined, id);
256 268
     }
257 269
 
258 270
     /**
@@ -262,7 +274,7 @@ export default class DeviceSelectionPopup {
262 274
      * @returns {Promise}
263 275
      */
264 276
     _setAudioOutputDevice(id) {
265
-        return setAudioOutputDevice(this._transport, id);
277
+        return setAudioOutputDevice(this._transport, undefined, id);
266 278
     }
267 279
 
268 280
     /**
@@ -272,7 +284,7 @@ export default class DeviceSelectionPopup {
272 284
      * @returns {Promise}
273 285
      */
274 286
     _setVideoInputDevice(id) {
275
-        return setVideoInputDevice(this._transport, id);
287
+        return setVideoInputDevice(this._transport, undefined, id);
276 288
     }
277 289
 
278 290
     /**

読み込み中…
キャンセル
保存