Bläddra i källkod

feat(iframe-api): Device handling.

master
Hristo Terezov 6 år sedan
förälder
incheckning
427f49367b

+ 78
- 0
doc/api.md Visa fil

@@ -65,6 +65,84 @@ var api = new JitsiMeetExternalAPI(domain, options);
65 65
 
66 66
 ### Controlling the embedded Jitsi Meet Conference
67 67
 
68
+You can control the available devices  with the following methods of `JitsiMeetExternalAPI` instance:
69
+* **getAvailableDevices** - Retrieve a list of available devices.
70
+
71
+```javascript
72
+api.getAvailableDevices().then(function(devices) {
73
+    // devices = {
74
+    //     'audioInput': [{
75
+    //         deviceId: "ID"
76
+    //         groupId: "grpID"
77
+    //         kind: "audioinput"
78
+    //         label: "Label"
79
+    //     },....],
80
+    //     'audioOutput': [{
81
+    //         deviceId: "ID"
82
+    //         groupId: "grpID"
83
+    //         kind: "audioOutput"
84
+    //         label: "Label"
85
+    //     },....],
86
+    //     'videoInput': [{
87
+    //         deviceId: "ID"
88
+    //         groupId: "grpID"
89
+    //         kind: "videoInput"
90
+    //         label: "Label"
91
+    //     },....]
92
+    // }
93
+    ...
94
+});
95
+```
96
+* **getCurrentDevices** - Retrieve a list with the devices that are currently sected.
97
+
98
+```javascript
99
+api.getCurrentDevices().then(function(devices) {
100
+    // devices = {
101
+    //     'audioInput': 'deviceID',
102
+    //     'audioOutput': 'deviceID',
103
+    //     'videoInput': 'deviceID'
104
+    // }
105
+    ...
106
+});
107
+```
108
+* **isDeviceChangeAvailable** - Resolves with true if the device change is available and with false if not.
109
+
110
+```javascript
111
+// The accepted deviceType values are - 'output', 'input' or undefined.
112
+api.isDeviceChangeAvailable(deviceType).then(function(isDeviceChangeAvailable) {
113
+    ...
114
+});
115
+```
116
+* **isDeviceListAvailable** - Resolves with true if the device list is available and with false if not.
117
+
118
+```javascript
119
+api.isDeviceListAvailable().then(function(isDeviceListAvailable) {
120
+    ...
121
+});
122
+```
123
+* **isMultipleAudioInputSupported** - Resolves with true if the device list is available and with false if not.
124
+
125
+```javascript
126
+api.isMultipleAudioInputSupported().then(function(isMultipleAudioInputSupported) {
127
+    ...
128
+});
129
+```
130
+* **setAudioInputDevice** - Sets the audio input device to the one with the id that is passed.
131
+
132
+```javascript
133
+api.setAudioInputDevice(deviceId);
134
+```
135
+* **setAudioOutputDevice** - Sets the audio output device to the one with the id that is passed.
136
+
137
+```javascript
138
+api.setAudioOutputDevice(deviceId);
139
+```
140
+* **setVideoInputDevice** - Sets the video input device to the one with the id that is passed.
141
+
142
+```javascript
143
+api.setVideoInputDevice(deviceId);
144
+```
145
+
68 146
 You can control the embedded Jitsi Meet conference using the `JitsiMeetExternalAPI` object by using `executeCommand`:
69 147
 
70 148
 ```javascript

+ 9
- 0
modules/API/API.js Visa fil

@@ -11,6 +11,9 @@ import { invite } from '../../react/features/invite';
11 11
 import { getJitsiMeetTransport } from '../transport';
12 12
 
13 13
 import { API_ID } from './constants';
14
+import {
15
+    processRequest
16
+} from '../../react/features/device-selection/functions';
14 17
 
15 18
 const logger = require('jitsi-meet-logger').getLogger(__filename);
16 19
 
@@ -117,6 +120,12 @@ function initCommands() {
117 120
         return false;
118 121
     });
119 122
     transport.on('request', (request, callback) => {
123
+        const { dispatch, getState } = APP.store;
124
+
125
+        if (processRequest(dispatch, getState, request, callback)) {
126
+            return true;
127
+        }
128
+
120 129
         const { name } = request;
121 130
 
122 131
         switch (name) {

+ 90
- 0
modules/API/external/external_api.js Visa fil

@@ -7,6 +7,16 @@ import {
7 7
 } from '../../transport';
8 8
 
9 9
 import electronPopupsConfig from './electronPopupsConfig.json';
10
+import {
11
+    getAvailableDevices,
12
+    getCurrentDevices,
13
+    isDeviceChangeAvailable,
14
+    isDeviceListAvailable,
15
+    isMultipleAudioInputSupported,
16
+    setAudioInputDevice,
17
+    setAudioOutputDevice,
18
+    setVideoInputDevice
19
+} from './functions';
10 20
 
11 21
 const logger = require('jitsi-meet-logger').getLogger(__filename);
12 22
 
@@ -593,6 +603,24 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
593 603
         }
594 604
     }
595 605
 
606
+    /**
607
+     * Returns Promise that resolves with result an list of available devices.
608
+     *
609
+     * @returns {Promise}
610
+     */
611
+    getAvailableDevices() {
612
+        return getAvailableDevices(this._transport);
613
+    }
614
+
615
+    /**
616
+     * Returns Promise that resolves with current selected devices.
617
+     *
618
+     * @returns {Promise}
619
+     */
620
+    getCurrentDevices() {
621
+        return getCurrentDevices(this._transport);
622
+    }
623
+
596 624
     /**
597 625
      * Check if the audio is available.
598 626
      *
@@ -605,6 +633,38 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
605 633
         });
606 634
     }
607 635
 
636
+    /**
637
+     * Returns Promise that resolves with true if the device change is available
638
+     * and with false if not.
639
+     *
640
+     * @param {string} [deviceType] - Values - 'output', 'input' or undefined.
641
+     * Default - 'input'.
642
+     * @returns {Promise}
643
+     */
644
+    isDeviceChangeAvailable(deviceType) {
645
+        return isDeviceChangeAvailable(this._transport, deviceType);
646
+    }
647
+
648
+    /**
649
+     * Returns Promise that resolves with true if the device list is available
650
+     * and with false if not.
651
+     *
652
+     * @returns {Promise}
653
+     */
654
+    isDeviceListAvailable() {
655
+        return isDeviceListAvailable(this._transport);
656
+    }
657
+
658
+    /**
659
+     * Returns Promise that resolves with true if the device list is available
660
+     * and with false if not.
661
+     *
662
+     * @returns {Promise}
663
+     */
664
+    isMultipleAudioInputSupported() {
665
+        return isMultipleAudioInputSupported(this._transport);
666
+    }
667
+
608 668
     /**
609 669
      * Invite people to the call.
610 670
      *
@@ -771,6 +831,36 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
771 831
         });
772 832
     }
773 833
 
834
+    /**
835
+     * Sets the audio input device to the one with the id that is passed.
836
+     *
837
+     * @param {string} deviceId - The id of the new device.
838
+     * @returns {Promise}
839
+     */
840
+    setAudioInputDevice(deviceId) {
841
+        return setAudioInputDevice(this._transport, deviceId);
842
+    }
843
+
844
+    /**
845
+     * Sets the audio output device to the one with the id that is passed.
846
+     *
847
+     * @param {string} deviceId - The id of the new device.
848
+     * @returns {Promise}
849
+     */
850
+    setAudioOutputDevice(deviceId) {
851
+        return setAudioOutputDevice(this._transport, deviceId);
852
+    }
853
+
854
+    /**
855
+     * Sets the video input device to the one with the id that is passed.
856
+     *
857
+     * @param {string} deviceId - The id of the new device.
858
+     * @returns {Promise}
859
+     */
860
+    setVideoInputDevice(deviceId) {
861
+        return setVideoInputDevice(this._transport, deviceId);
862
+    }
863
+
774 864
     /**
775 865
      * Returns the configuration for electron for the windows that are open
776 866
      * from Jitsi Meet.

+ 162
- 0
modules/API/external/functions.js Visa fil

@@ -0,0 +1,162 @@
1
+// @flow
2
+
3
+import Logger from 'jitsi-meet-logger';
4
+
5
+const logger = Logger.getLogger(__filename);
6
+
7
+/**
8
+ * Returns Promise that resolves with result an list of available devices.
9
+ *
10
+ * @param {Transport} transport - The @code{Transport} instance responsible for
11
+ * the external communication.
12
+ * @returns {Promise}
13
+ */
14
+export function getAvailableDevices(transport: Object) {
15
+    return transport.sendRequest({
16
+        type: 'devices',
17
+        name: 'getAvailableDevices'
18
+    }).catch(e => {
19
+        logger.error(e);
20
+
21
+        return {};
22
+    });
23
+}
24
+
25
+/**
26
+ * Returns Promise that resolves with current selected devices.
27
+ *
28
+ * @param {Transport} transport - The @code{Transport} instance responsible for
29
+ * the external communication.
30
+ * @returns {Promise}
31
+ */
32
+export function getCurrentDevices(transport: Object) {
33
+    return transport.sendRequest({
34
+        type: 'devices',
35
+        name: 'getCurrentDevices'
36
+    }).catch(e => {
37
+        logger.error(e);
38
+
39
+        return {};
40
+    });
41
+}
42
+
43
+/**
44
+ * Returns Promise that resolves with true if the device change is available
45
+ * and with false if not.
46
+ *
47
+ * @param {Transport} transport - The @code{Transport} instance responsible for
48
+ * the external communication.
49
+ * @param {string} [deviceType] - Values - 'output', 'input' or undefined.
50
+ * Default - 'input'.
51
+ * @returns {Promise}
52
+ */
53
+export function isDeviceChangeAvailable(transport: Object, deviceType: string) {
54
+    return transport.sendRequest({
55
+        deviceType,
56
+        type: 'devices',
57
+        name: 'isDeviceChangeAvailable'
58
+    }).catch(e => {
59
+        logger.error(e);
60
+
61
+        return false;
62
+    });
63
+}
64
+
65
+/**
66
+ * Returns Promise that resolves with true if the device list is available
67
+ * and with false if not.
68
+ *
69
+ * @param {Transport} transport - The @code{Transport} instance responsible for
70
+ * the external communication.
71
+ * @returns {Promise}
72
+ */
73
+export function isDeviceListAvailable(transport: Object) {
74
+    return transport.sendRequest({
75
+        type: 'devices',
76
+        name: 'isDeviceListAvailable'
77
+    }).catch(e => {
78
+        logger.error(e);
79
+
80
+        return false;
81
+    });
82
+}
83
+
84
+/**
85
+ * Returns Promise that resolves with true if the device list is available
86
+ * and with false if not.
87
+ *
88
+ * @param {Transport} transport - The @code{Transport} instance responsible for
89
+ * the external communication.
90
+ * @returns {Promise}
91
+ */
92
+export function isMultipleAudioInputSupported(transport: Object) {
93
+    return transport.sendRequest({
94
+        type: 'devices',
95
+        name: 'isMultipleAudioInputSupported'
96
+    }).catch(e => {
97
+        logger.error(e);
98
+
99
+        return false;
100
+    });
101
+}
102
+
103
+/**
104
+ * Sets the audio input device to the one with the id that is passed.
105
+ *
106
+ * @param {Transport} transport - The @code{Transport} instance responsible for
107
+ * the external communication.
108
+ * @param {string} id - The id of the new device.
109
+ * @returns {Promise}
110
+ */
111
+export function setAudioInputDevice(transport: Object, id: string) {
112
+    return _setDevice(transport, {
113
+        id,
114
+        kind: 'audioinput'
115
+    });
116
+}
117
+
118
+/**
119
+ * Sets the audio output device to the one with the id that is passed.
120
+ *
121
+ * @param {Transport} transport - The @code{Transport} instance responsible for
122
+ * the external communication.
123
+ * @param {string} id - The id of the new device.
124
+ * @returns {Promise}
125
+ */
126
+export function setAudioOutputDevice(transport: Object, id: string) {
127
+    return _setDevice(transport, {
128
+        id,
129
+        kind: 'audiooutput'
130
+    });
131
+}
132
+
133
+/**
134
+ * Sets the currently used device to the one that is passed.
135
+ *
136
+ * @param {Transport} transport - The @code{Transport} instance responsible for
137
+ * the external communication.
138
+ * @param {Object} device - The new device to be used.
139
+ * @returns {Promise}
140
+ */
141
+function _setDevice(transport: Object, device) {
142
+    return transport.sendRequest({
143
+        type: 'devices',
144
+        name: 'setDevice',
145
+        device
146
+    });
147
+}
148
+
149
+/**
150
+ * Sets the video input device to the one with the id that is passed.
151
+ *
152
+ * @param {Transport} transport - The @code{Transport} instance responsible for
153
+ * the external communication.
154
+ * @param {string} id - The id of the new device.
155
+ * @returns {Promise}
156
+ */
157
+export function setVideoInputDevice(transport: Object, id: string) {
158
+    return _setDevice(transport, {
159
+        id,
160
+        kind: 'videoinput'
161
+    });
162
+}

+ 2
- 73
react/features/device-selection/actions.js Visa fil

@@ -6,17 +6,15 @@ import {
6 6
 
7 7
 import { createDeviceChangedEvent, sendAnalytics } from '../analytics';
8 8
 import {
9
-    getAudioOutputDeviceId,
10 9
     setAudioInputDevice,
11 10
     setAudioOutputDeviceId,
12 11
     setVideoInputDevice
13 12
 } from '../base/devices';
14 13
 import { i18next } from '../base/i18n';
15
-import JitsiMeetJS from '../base/lib-jitsi-meet';
16 14
 import { updateSettings } from '../base/settings';
17 15
 
18 16
 import { SET_DEVICE_SELECTION_POPUP_DATA } from './actionTypes';
19
-import { getDeviceSelectionDialogProps } from './functions';
17
+import { getDeviceSelectionDialogProps, processRequest } from './functions';
20 18
 
21 19
 const logger = require('jitsi-meet-logger').getLogger(__filename);
22 20
 
@@ -60,7 +58,7 @@ export function openDeviceSelectionPopup() {
60 58
         });
61 59
 
62 60
         transport.on('request',
63
-            _processRequest.bind(undefined, dispatch, getState));
61
+            processRequest.bind(undefined, dispatch, getState));
64 62
         transport.on('event', event => {
65 63
             if (event.type === 'devices-dialog' && event.name === 'close') {
66 64
                 popup.close();
@@ -80,75 +78,6 @@ export function openDeviceSelectionPopup() {
80 78
     };
81 79
 }
82 80
 
83
-/**
84
- * Processes device requests from external applications.
85
- *
86
- * @param {Dispatch} dispatch - The redux {@code dispatch} function.
87
- * @param {Function} getState - The redux function that gets/retrieves the redux
88
- * state.
89
- * @param {Object} request - The request to be processed.
90
- * @param {Function} responseCallback - The callback that will send the
91
- * response.
92
- * @returns {boolean}
93
- */
94
-function _processRequest(dispatch, getState, request, responseCallback) { // eslint-disable-line max-len, max-params
95
-    if (request.type === 'devices') {
96
-        const state = getState();
97
-        const settings = state['features/base/settings'];
98
-
99
-        switch (request.name) {
100
-        case 'isDeviceListAvailable':
101
-            responseCallback(JitsiMeetJS.mediaDevices.isDeviceListAvailable());
102
-            break;
103
-        case 'isDeviceChangeAvailable':
104
-            responseCallback(
105
-                JitsiMeetJS.mediaDevices.isDeviceChangeAvailable(
106
-                    request.deviceType));
107
-            break;
108
-        case 'isMultipleAudioInputSupported':
109
-            responseCallback(JitsiMeetJS.isMultipleAudioInputSupported());
110
-            break;
111
-        case 'getCurrentDevices':
112
-            responseCallback({
113
-                audioInput: settings.micDeviceId,
114
-                audioOutput: getAudioOutputDeviceId(),
115
-                videoInput: settings.cameraDeviceId
116
-            });
117
-            break;
118
-        case 'getAvailableDevices':
119
-            responseCallback(getState()['features/base/devices']);
120
-            break;
121
-        case 'setDevice': {
122
-            const { device } = request;
123
-
124
-            switch (device.kind) {
125
-            case 'audioinput':
126
-                dispatch(setAudioInputDevice(device.id));
127
-                break;
128
-            case 'audiooutput':
129
-                setAudioOutputDeviceId(device.id, dispatch);
130
-                break;
131
-            case 'videoinput':
132
-                dispatch(setVideoInputDevice(device.id));
133
-                break;
134
-            default:
135
-
136
-            }
137
-
138
-            responseCallback(true);
139
-            break;
140
-        }
141
-        default:
142
-
143
-            return false;
144
-        }
145
-
146
-        return true;
147
-    }
148
-
149
-    return false;
150
-}
151
-
152 81
 /**
153 82
  * Sets information about device selection popup in the store.
154 83
  *

+ 75
- 1
react/features/device-selection/functions.js Visa fil

@@ -1,5 +1,10 @@
1 1
 // @flow
2
-import { getAudioOutputDeviceId } from '../base/devices';
2
+import {
3
+    getAudioOutputDeviceId,
4
+    setAudioInputDevice,
5
+    setAudioOutputDeviceId,
6
+    setVideoInputDevice
7
+} from '../base/devices';
3 8
 import JitsiMeetJS from '../base/lib-jitsi-meet';
4 9
 import { toState } from '../base/redux';
5 10
 
@@ -29,3 +34,72 @@ export function getDeviceSelectionDialogProps(stateful: Object | Function) {
29 34
         selectedVideoInputId: settings.cameraDeviceId
30 35
     };
31 36
 }
37
+
38
+/**
39
+ * Processes device requests from external applications.
40
+ *
41
+ * @param {Dispatch} dispatch - The redux {@code dispatch} function.
42
+ * @param {Function} getState - The redux function that gets/retrieves the redux
43
+ * state.
44
+ * @param {Object} request - The request to be processed.
45
+ * @param {Function} responseCallback - The callback that will send the
46
+ * response.
47
+ * @returns {boolean}
48
+ */
49
+export function processRequest(dispatch: Dispatch<*>, getState: Function, request: Object, responseCallback: Function) { // eslint-disable-line max-len, max-params
50
+    if (request.type === 'devices') {
51
+        const state = getState();
52
+        const settings = state['features/base/settings'];
53
+
54
+        switch (request.name) {
55
+        case 'isDeviceListAvailable':
56
+            responseCallback(JitsiMeetJS.mediaDevices.isDeviceListAvailable());
57
+            break;
58
+        case 'isDeviceChangeAvailable':
59
+            responseCallback(
60
+                JitsiMeetJS.mediaDevices.isDeviceChangeAvailable(
61
+                    request.deviceType));
62
+            break;
63
+        case 'isMultipleAudioInputSupported':
64
+            responseCallback(JitsiMeetJS.isMultipleAudioInputSupported());
65
+            break;
66
+        case 'getCurrentDevices':
67
+            responseCallback({
68
+                audioInput: settings.micDeviceId,
69
+                audioOutput: getAudioOutputDeviceId(),
70
+                videoInput: settings.cameraDeviceId
71
+            });
72
+            break;
73
+        case 'getAvailableDevices':
74
+            responseCallback(getState()['features/base/devices']);
75
+            break;
76
+        case 'setDevice': {
77
+            const { device } = request;
78
+
79
+            switch (device.kind) {
80
+            case 'audioinput':
81
+                dispatch(setAudioInputDevice(device.id));
82
+                break;
83
+            case 'audiooutput':
84
+                setAudioOutputDeviceId(device.id, dispatch);
85
+                break;
86
+            case 'videoinput':
87
+                dispatch(setVideoInputDevice(device.id));
88
+                break;
89
+            default:
90
+
91
+            }
92
+
93
+            responseCallback(true);
94
+            break;
95
+        }
96
+        default:
97
+
98
+            return false;
99
+        }
100
+
101
+        return true;
102
+    }
103
+
104
+    return false;
105
+}

+ 18
- 70
react/features/settings/components/web/DeviceSelectionPopup.js Visa fil

@@ -1,7 +1,6 @@
1 1
 /* global JitsiMeetJS */
2 2
 
3 3
 import { AtlasKitThemeProvider } from '@atlaskit/theme';
4
-import Logger from 'jitsi-meet-logger';
5 4
 import React from 'react';
6 5
 import ReactDOM from 'react-dom';
7 6
 import { I18nextProvider } from 'react-i18next';
@@ -10,13 +9,21 @@ import {
10 9
     PostMessageTransportBackend,
11 10
     Transport
12 11
 } from '../../../../../modules/transport';
12
+import {
13
+    getAvailableDevices,
14
+    getCurrentDevices,
15
+    isDeviceChangeAvailable,
16
+    isDeviceListAvailable,
17
+    isMultipleAudioInputSupported,
18
+    setAudioInputDevice,
19
+    setAudioOutputDevice,
20
+    setVideoInputDevice
21
+} from '../../../../../modules/API/external';
13 22
 
14 23
 import { parseURLParams } from '../../../base/config';
15 24
 import { DialogWithTabs } from '../../../base/dialog';
16 25
 import { DeviceSelection } from '../../../device-selection';
17 26
 
18
-const logger = Logger.getLogger(__filename);
19
-
20 27
 /**
21 28
  * Implements a class that renders the React components for the device selection
22 29
  * popup page and handles the communication between the components and Jitsi
@@ -102,14 +109,7 @@ export default class DeviceSelectionPopup {
102 109
      * @returns {Promise}
103 110
      */
104 111
     _getAvailableDevices() {
105
-        return this._transport.sendRequest({
106
-            type: 'devices',
107
-            name: 'getAvailableDevices'
108
-        }).catch(e => {
109
-            logger.error(e);
110
-
111
-            return {};
112
-        });
112
+        return getAvailableDevices(this._transport);
113 113
     }
114 114
 
115 115
     /**
@@ -118,14 +118,7 @@ export default class DeviceSelectionPopup {
118 118
      * @returns {Promise}
119 119
      */
120 120
     _getCurrentDevices() {
121
-        return this._transport.sendRequest({
122
-            type: 'devices',
123
-            name: 'getCurrentDevices'
124
-        }).catch(e => {
125
-            logger.error(e);
126
-
127
-            return {};
128
-        });
121
+        return getCurrentDevices(this._transport);
129 122
     }
130 123
 
131 124
     /**
@@ -170,15 +163,7 @@ export default class DeviceSelectionPopup {
170 163
      * @returns {Promise}
171 164
      */
172 165
     _isDeviceChangeAvailable(deviceType) {
173
-        return this._transport.sendRequest({
174
-            deviceType,
175
-            type: 'devices',
176
-            name: 'isDeviceChangeAvailable'
177
-        }).catch(e => {
178
-            logger.error(e);
179
-
180
-            return false;
181
-        });
166
+        return isDeviceChangeAvailable(this._transport, deviceType);
182 167
     }
183 168
 
184 169
     /**
@@ -188,14 +173,7 @@ export default class DeviceSelectionPopup {
188 173
      * @returns {Promise}
189 174
      */
190 175
     _isDeviceListAvailable() {
191
-        return this._transport.sendRequest({
192
-            type: 'devices',
193
-            name: 'isDeviceListAvailable'
194
-        }).catch(e => {
195
-            logger.error(e);
196
-
197
-            return false;
198
-        });
176
+        return isDeviceListAvailable(this._transport);
199 177
     }
200 178
 
201 179
     /**
@@ -205,14 +183,7 @@ export default class DeviceSelectionPopup {
205 183
      * @returns {Promise}
206 184
      */
207 185
     _isMultipleAudioInputSupported() {
208
-        return this._transport.sendRequest({
209
-            type: 'devices',
210
-            name: 'isMultipleAudioInputSupported'
211
-        }).catch(e => {
212
-            logger.error(e);
213
-
214
-            return false;
215
-        });
186
+        return isMultipleAudioInputSupported(this._transport);
216 187
     }
217 188
 
218 189
     /**
@@ -281,10 +252,7 @@ export default class DeviceSelectionPopup {
281 252
      * @returns {Promise}
282 253
      */
283 254
     _setAudioInputDevice(id) {
284
-        return this._setDevice({
285
-            id,
286
-            kind: 'audioinput'
287
-        });
255
+        return setAudioInputDevice(this._transport, id);
288 256
     }
289 257
 
290 258
     /**
@@ -294,24 +262,7 @@ export default class DeviceSelectionPopup {
294 262
      * @returns {Promise}
295 263
      */
296 264
     _setAudioOutputDevice(id) {
297
-        return this._setDevice({
298
-            id,
299
-            kind: 'audiooutput'
300
-        });
301
-    }
302
-
303
-    /**
304
-     * Sets the currently used device to the one that is passed.
305
-     *
306
-     * @param {Object} device - The new device to be used.
307
-     * @returns {Promise}
308
-     */
309
-    _setDevice(device) {
310
-        return this._transport.sendRequest({
311
-            type: 'devices',
312
-            name: 'setDevice',
313
-            device
314
-        });
265
+        return setAudioOutputDevice(this._transport, id);
315 266
     }
316 267
 
317 268
     /**
@@ -321,10 +272,7 @@ export default class DeviceSelectionPopup {
321 272
      * @returns {Promise}
322 273
      */
323 274
     _setVideoInputDevice(id) {
324
-        return this._setDevice({
325
-            id,
326
-            kind: 'videoinput'
327
-        });
275
+        return setVideoInputDevice(this._transport, id);
328 276
     }
329 277
 
330 278
     /**

Laddar…
Avbryt
Spara