Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(iframe-api): setDevice.

Hristo Terezovb7529863d54b
diff --git a/react/features/base/devices/middleware.js b/react/features/base/devices/middleware.js
index 99fae99f3f..deff92222c 100644
--- a/react/features/base/devices/middleware.js
+++ b/react/features/base/devices/middleware.js
@@ -5,7 +5,6 @@ import { processExternalDeviceRequest } from '../../device-selection';
import { showNotification, showWarningNotification } from '../../notifications';
import { replaceAudioTrackById, replaceVideoTrackById, setDeviceStatusWarning } from '../../prejoin/actions';
import { isPrejoinPageVisible } from '../../prejoin/functions';
-import { CONFERENCE_JOINED } from '../conference';
import { JitsiTrackErrors } from '../lib-jitsi-meet';
import { MiddlewareRegistry } from '../redux';
import { updateSettings } from '../settings';
@@ -24,6 +23,7 @@ import {
setVideoInputDevice
} from './actions';
import {
+ areDeviceLabelsInitialized,
formatDeviceLabel,
groupDevicesByKind,
setAudioOutputDeviceId
@@ -73,8 +73,6 @@ function logDeviceList(deviceList) {
// eslint-disable-next-line no-unused-vars
MiddlewareRegistry.register(store => next => action => {
switch (action.type) {
- case CONFERENCE_JOINED:
- return _conferenceJoined(store, next, action);
case NOTIFY_CAMERA_ERROR: {
if (typeof APP !== 'object' || !action.error) {
break;
@@ -148,6 +146,9 @@ MiddlewareRegistry.register(store => next => action => {
break;
case UPDATE_DEVICE_LIST:
logDeviceList(groupDevicesByKind(action.devices));
+ if (areDeviceLabelsInitialized(store.getState())) {
+ return _processPendingRequests(store, next, action);
+ }
break;
case CHECK_AND_NOTIFY_FOR_NEW_DEVICE:
_checkAndNotifyForNewDevice(store, action.newDevices, action.oldDevices);
@@ -170,11 +171,15 @@ MiddlewareRegistry.register(store => next => action => {
* @private
* @returns {Object} The value returned by {@code next(action)}.
*/
-function _conferenceJoined({ dispatch, getState }, next, action) {
+function _processPendingRequests({ dispatch, getState }, next, action) {
const result = next(action);
const state = getState();
const { pendingRequests } = state['features/base/devices'];
+ if (!pendingRequests || pendingRequests.length === 0) {
+ return result;
+ }
+
pendingRequests.forEach(request => {
processExternalDeviceRequest(
dispatch,
diff --git a/react/features/device-selection/functions.js b/react/features/device-selection/functions.js
index be908c907c..706ae877f2 100644
--- a/react/features/device-selection/functions.js
+++ b/react/features/device-selection/functions.js
@@ -86,7 +86,6 @@ export function processExternalDeviceRequest( // eslint-disable-line max-params
}
const state = getState();
const settings = state['features/base/settings'];
- const { conference } = state['features/base/conference'];
let result = true;
switch (request.name) {
@@ -165,7 +164,7 @@ export function processExternalDeviceRequest( // eslint-disable-line max-params
case 'setDevice': {
const { device } = request;
- if (!conference) {
+ if (!areDeviceLabelsInitialized(state)) {
dispatch(addPendingDeviceRequest({
type: 'devices',
name: 'setDevice',