fix(prejoin): Fix join without audio

This commit is contained in:
Vlad Piersec 2020-08-14 10:45:15 +03:00 committed by Дамян Минков
parent 295dd8a45d
commit d82bb0a89b
6 changed files with 34 additions and 13 deletions

View File

@ -43,8 +43,8 @@ export const SET_CONFIG = 'SET_CONFIG';
* and the passed object. * and the passed object.
* *
* { * {
* type: _UPDATE_CONFIG, * type: UPDATE_CONFIG,
* config: Object * config: Object
* } * }
*/ */
export const _UPDATE_CONFIG = '_UPDATE_CONFIG'; export const UPDATE_CONFIG = 'UPDATE_CONFIG';

View File

@ -6,10 +6,24 @@ import type { Dispatch } from 'redux';
import { addKnownDomains } from '../known-domains'; import { addKnownDomains } from '../known-domains';
import { parseURIString } from '../util'; 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 { _CONFIG_STORE_PREFIX } from './constants';
import { setConfigFromURLParams } from './functions'; 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) * Signals that the configuration (commonly known in Jitsi Meet as config.js)
* for a specific locationURL will be loaded now. * for a specific locationURL will be loaded now.

View File

@ -8,7 +8,8 @@ import { addKnownDomains } from '../known-domains';
import { MiddlewareRegistry } from '../redux'; import { MiddlewareRegistry } from '../redux';
import { parseURIString } from '../util'; 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'; import { _CONFIG_STORE_PREFIX } from './constants';
/** /**
@ -114,10 +115,7 @@ function _setConfig({ dispatch, getState }, next, action) {
config.resolution = resolutionFlag; config.resolution = resolutionFlag;
} }
dispatch({ dispatch(updateConfig(config));
type: _UPDATE_CONFIG,
config
});
// FIXME On Web we rely on the global 'config' variable which gets altered // 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 // multiple times, before it makes it to the reducer. At some point it may

View File

@ -4,7 +4,7 @@ import _ from 'lodash';
import { equals, ReducerRegistry, set } from '../redux'; 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'; import { _cleanupConfig } from './functions';
/** /**
@ -50,7 +50,7 @@ const INITIAL_RN_STATE = {
ReducerRegistry.register('features/base/config', (state = _getInitialState(), action) => { ReducerRegistry.register('features/base/config', (state = _getInitialState(), action) => {
switch (action.type) { switch (action.type) {
case _UPDATE_CONFIG: case UPDATE_CONFIG:
return _updateConfig(state, action); return _updateConfig(state, action);
case CONFIG_WILL_LOAD: case CONFIG_WILL_LOAD:

View File

@ -201,11 +201,13 @@ export function initPrejoin(tracks: Object[], errors: Object) {
/** /**
* Action used to start the conference. * Action used to start the conference.
* *
* @param {Object} options - The config options that override the default ones (if any).
* @returns {Function} * @returns {Function}
*/ */
export function joinConference() { export function joinConference(options?: Object) {
return { return {
type: PREJOIN_START_CONFERENCE type: PREJOIN_START_CONFERENCE,
options
}; };
} }
@ -222,7 +224,10 @@ export function joinConferenceWithoutAudio() {
if (audioTrack) { if (audioTrack) {
await dispatch(replaceLocalTrack(audioTrack, null)); await dispatch(replaceLocalTrack(audioTrack, null));
} }
dispatch(joinConference());
dispatch(joinConference({
startSilent: true
}));
}; };
} }

View File

@ -1,5 +1,6 @@
// @flow // @flow
import { updateConfig } from '../base/config';
import { SET_AUDIO_MUTED, SET_VIDEO_MUTED } from '../base/media'; import { SET_AUDIO_MUTED, SET_VIDEO_MUTED } from '../base/media';
import { MiddlewareRegistry } from '../base/redux'; import { MiddlewareRegistry } from '../base/redux';
import { updateSettings } from '../base/settings'; import { updateSettings } from '../base/settings';
@ -24,6 +25,9 @@ MiddlewareRegistry.register(store => next => async action => {
const state = getState(); const state = getState();
const { userSelectedSkipPrejoin } = state['features/prejoin']; const { userSelectedSkipPrejoin } = state['features/prejoin'];
const localVideoTrack = getLocalVideoTrack(state['features/base/tracks']); const localVideoTrack = getLocalVideoTrack(state['features/base/tracks']);
const { options } = action;
options && store.dispatch(updateConfig(options));
userSelectedSkipPrejoin && dispatch(updateSettings({ userSelectedSkipPrejoin && dispatch(updateSettings({
userSelectedSkipPrejoin userSelectedSkipPrejoin