Explorar el Código

fix(iframe-api): setDevice.

master
Hristo Terezov hace 5 años
padre
commit
b7529863d5

+ 9
- 4
react/features/base/devices/middleware.js Ver fichero

5
 import { showNotification, showWarningNotification } from '../../notifications';
5
 import { showNotification, showWarningNotification } from '../../notifications';
6
 import { replaceAudioTrackById, replaceVideoTrackById, setDeviceStatusWarning } from '../../prejoin/actions';
6
 import { replaceAudioTrackById, replaceVideoTrackById, setDeviceStatusWarning } from '../../prejoin/actions';
7
 import { isPrejoinPageVisible } from '../../prejoin/functions';
7
 import { isPrejoinPageVisible } from '../../prejoin/functions';
8
-import { CONFERENCE_JOINED } from '../conference';
9
 import { JitsiTrackErrors } from '../lib-jitsi-meet';
8
 import { JitsiTrackErrors } from '../lib-jitsi-meet';
10
 import { MiddlewareRegistry } from '../redux';
9
 import { MiddlewareRegistry } from '../redux';
11
 import { updateSettings } from '../settings';
10
 import { updateSettings } from '../settings';
24
     setVideoInputDevice
23
     setVideoInputDevice
25
 } from './actions';
24
 } from './actions';
26
 import {
25
 import {
26
+    areDeviceLabelsInitialized,
27
     formatDeviceLabel,
27
     formatDeviceLabel,
28
     groupDevicesByKind,
28
     groupDevicesByKind,
29
     setAudioOutputDeviceId
29
     setAudioOutputDeviceId
73
 // eslint-disable-next-line no-unused-vars
73
 // eslint-disable-next-line no-unused-vars
74
 MiddlewareRegistry.register(store => next => action => {
74
 MiddlewareRegistry.register(store => next => action => {
75
     switch (action.type) {
75
     switch (action.type) {
76
-    case CONFERENCE_JOINED:
77
-        return _conferenceJoined(store, next, action);
78
     case NOTIFY_CAMERA_ERROR: {
76
     case NOTIFY_CAMERA_ERROR: {
79
         if (typeof APP !== 'object' || !action.error) {
77
         if (typeof APP !== 'object' || !action.error) {
80
             break;
78
             break;
148
         break;
146
         break;
149
     case UPDATE_DEVICE_LIST:
147
     case UPDATE_DEVICE_LIST:
150
         logDeviceList(groupDevicesByKind(action.devices));
148
         logDeviceList(groupDevicesByKind(action.devices));
149
+        if (areDeviceLabelsInitialized(store.getState())) {
150
+            return _processPendingRequests(store, next, action);
151
+        }
151
         break;
152
         break;
152
     case CHECK_AND_NOTIFY_FOR_NEW_DEVICE:
153
     case CHECK_AND_NOTIFY_FOR_NEW_DEVICE:
153
         _checkAndNotifyForNewDevice(store, action.newDevices, action.oldDevices);
154
         _checkAndNotifyForNewDevice(store, action.newDevices, action.oldDevices);
170
  * @private
171
  * @private
171
  * @returns {Object} The value returned by {@code next(action)}.
172
  * @returns {Object} The value returned by {@code next(action)}.
172
  */
173
  */
173
-function _conferenceJoined({ dispatch, getState }, next, action) {
174
+function _processPendingRequests({ dispatch, getState }, next, action) {
174
     const result = next(action);
175
     const result = next(action);
175
     const state = getState();
176
     const state = getState();
176
     const { pendingRequests } = state['features/base/devices'];
177
     const { pendingRequests } = state['features/base/devices'];
177
 
178
 
179
+    if (!pendingRequests || pendingRequests.length === 0) {
180
+        return result;
181
+    }
182
+
178
     pendingRequests.forEach(request => {
183
     pendingRequests.forEach(request => {
179
         processExternalDeviceRequest(
184
         processExternalDeviceRequest(
180
             dispatch,
185
             dispatch,

+ 1
- 2
react/features/device-selection/functions.js Ver fichero

86
     }
86
     }
87
     const state = getState();
87
     const state = getState();
88
     const settings = state['features/base/settings'];
88
     const settings = state['features/base/settings'];
89
-    const { conference } = state['features/base/conference'];
90
     let result = true;
89
     let result = true;
91
 
90
 
92
     switch (request.name) {
91
     switch (request.name) {
165
     case 'setDevice': {
164
     case 'setDevice': {
166
         const { device } = request;
165
         const { device } = request;
167
 
166
 
168
-        if (!conference) {
167
+        if (!areDeviceLabelsInitialized(state)) {
169
             dispatch(addPendingDeviceRequest({
168
             dispatch(addPendingDeviceRequest({
170
                 type: 'devices',
169
                 type: 'devices',
171
                 name: 'setDevice',
170
                 name: 'setDevice',

Loading…
Cancelar
Guardar