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(prejoin): Fix join without audio

Vlad Piersecd82bb0a89b89
diff --git a/react/features/base/config/actionTypes.js b/react/features/base/config/actionTypes.js
index d768f55fe9..aaf15fc575 100644
--- a/react/features/base/config/actionTypes.js
+++ b/react/features/base/config/actionTypes.js
@@ -43,8 +43,8 @@ export const SET_CONFIG = 'SET_CONFIG';
* and the passed object.
*
* {
- * type: _UPDATE_CONFIG,
+ * type: UPDATE_CONFIG,
* config: Object
* }
*/
-export const _UPDATE_CONFIG = '_UPDATE_CONFIG';
+export const UPDATE_CONFIG = 'UPDATE_CONFIG';
diff --git a/react/features/base/config/actions.js b/react/features/base/config/actions.js
index d890ecbedc..55b03ddb7a 100644
--- a/react/features/base/config/actions.js
+++ b/react/features/base/config/actions.js
@@ -6,10 +6,24 @@ import type { Dispatch } from 'redux';
import { addKnownDomains } from '../known-domains';
import { parseURIString } from '../util';
-import { CONFIG_WILL_LOAD, LOAD_CONFIG_ERROR, SET_CONFIG } from './actionTypes';
+import { CONFIG_WILL_LOAD, LOAD_CONFIG_ERROR, SET_CONFIG, UPDATE_CONFIG } from './actionTypes';
import { _CONFIG_STORE_PREFIX } from './constants';
import { setConfigFromURLParams } from './functions';
+
+/**
+ * Updates the config with new options.
+ *
+ * @param {Object} config - The new options (to add).
+ * @returns {Function}
+ */
+export function updateConfig(config: Object) {
+ return {
+ type: UPDATE_CONFIG,
+ config
+ };
+}
+
/**
* Signals that the configuration (commonly known in Jitsi Meet as config.js)
* for a specific locationURL will be loaded now.
diff --git a/react/features/base/config/middleware.js b/react/features/base/config/middleware.js
index 2a86a8240f..96357dfaa4 100644
--- a/react/features/base/config/middleware.js
+++ b/react/features/base/config/middleware.js
@@ -8,7 +8,8 @@ import { addKnownDomains } from '../known-domains';
import { MiddlewareRegistry } from '../redux';
import { parseURIString } from '../util';
-import { _UPDATE_CONFIG, SET_CONFIG } from './actionTypes';
+import { SET_CONFIG } from './actionTypes';
+import { updateConfig } from './actions';
import { _CONFIG_STORE_PREFIX } from './constants';
/**
@@ -114,10 +115,7 @@ function _setConfig({ dispatch, getState }, next, action) {
config.resolution = resolutionFlag;
}
- dispatch({
- type: _UPDATE_CONFIG,
- config
- });
+ dispatch(updateConfig(config));
// FIXME On Web we rely on the global 'config' variable which gets altered
// multiple times, before it makes it to the reducer. At some point it may
diff --git a/react/features/base/config/reducer.js b/react/features/base/config/reducer.js
index 43bd8f083e..4a66c59d59 100644
--- a/react/features/base/config/reducer.js
+++ b/react/features/base/config/reducer.js
@@ -4,7 +4,7 @@ import _ from 'lodash';
import { equals, ReducerRegistry, set } from '../redux';
-import { _UPDATE_CONFIG, CONFIG_WILL_LOAD, LOAD_CONFIG_ERROR, SET_CONFIG } from './actionTypes';
+import { UPDATE_CONFIG, CONFIG_WILL_LOAD, LOAD_CONFIG_ERROR, SET_CONFIG } from './actionTypes';
import { _cleanupConfig } from './functions';
/**
@@ -50,7 +50,7 @@ const INITIAL_RN_STATE = {
ReducerRegistry.register('features/base/config', (state = _getInitialState(), action) => {
switch (action.type) {
- case _UPDATE_CONFIG:
+ case UPDATE_CONFIG:
return _updateConfig(state, action);
case CONFIG_WILL_LOAD:
diff --git a/react/features/prejoin/actions.js b/react/features/prejoin/actions.js
index a43075905a..7255f80250 100644
--- a/react/features/prejoin/actions.js
+++ b/react/features/prejoin/actions.js
@@ -201,11 +201,13 @@ export function initPrejoin(tracks: Object[], errors: Object) {
/**
* Action used to start the conference.
*
+ * @param {Object} options - The config options that override the default ones (if any).
* @returns {Function}
*/
-export function joinConference() {
+export function joinConference(options?: Object) {
return {
- type: PREJOIN_START_CONFERENCE
+ type: PREJOIN_START_CONFERENCE,
+ options
};
}
@@ -222,7 +224,10 @@ export function joinConferenceWithoutAudio() {
if (audioTrack) {
await dispatch(replaceLocalTrack(audioTrack, null));
}
- dispatch(joinConference());
+
+ dispatch(joinConference({
+ startSilent: true
+ }));
};
}
diff --git a/react/features/prejoin/middleware.js b/react/features/prejoin/middleware.js
index 611bea577a..c590d1b886 100644
--- a/react/features/prejoin/middleware.js
+++ b/react/features/prejoin/middleware.js
@@ -1,5 +1,6 @@
// @flow
+import { updateConfig } from '../base/config';
import { SET_AUDIO_MUTED, SET_VIDEO_MUTED } from '../base/media';
import { MiddlewareRegistry } from '../base/redux';
import { updateSettings } from '../base/settings';
@@ -24,6 +25,9 @@ MiddlewareRegistry.register(store => next => async action => {
const state = getState();
const { userSelectedSkipPrejoin } = state['features/prejoin'];
const localVideoTrack = getLocalVideoTrack(state['features/base/tracks']);
+ const { options } = action;
+
+ options && store.dispatch(updateConfig(options));
userSelectedSkipPrejoin && dispatch(updateSettings({
userSelectedSkipPrejoin