fix(conference): start muted values on initial GUM
Take into account the start muted values stored in local storage.
This commit is contained in:
parent
4b429112f2
commit
9c10ac3028
|
@ -65,6 +65,8 @@ import {
|
|||
JitsiTrackEvents
|
||||
} from './react/features/base/lib-jitsi-meet';
|
||||
import {
|
||||
getStartWithAudioMuted,
|
||||
getStartWithVideoMuted,
|
||||
isVideoMutedByUser,
|
||||
MEDIA_TYPE,
|
||||
setAudioAvailable,
|
||||
|
@ -731,10 +733,10 @@ export default {
|
|||
const initialOptions = {
|
||||
startAudioOnly: config.startAudioOnly,
|
||||
startScreenSharing: config.startScreenSharing,
|
||||
startWithAudioMuted: config.startWithAudioMuted
|
||||
startWithAudioMuted: getStartWithAudioMuted(APP.store.getState())
|
||||
|| config.startSilent
|
||||
|| isUserInteractionRequiredForUnmute(APP.store.getState()),
|
||||
startWithVideoMuted: config.startWithVideoMuted
|
||||
startWithVideoMuted: getStartWithVideoMuted(APP.store.getState())
|
||||
|| isUserInteractionRequiredForUnmute(APP.store.getState())
|
||||
};
|
||||
|
||||
|
|
|
@ -1,9 +1,30 @@
|
|||
/* @flow */
|
||||
|
||||
import { toState } from '../redux';
|
||||
import { getPropertyValue } from '../settings';
|
||||
|
||||
import { VIDEO_MUTISM_AUTHORITY } from './constants';
|
||||
|
||||
|
||||
// XXX The configurations/preferences/settings startWithAudioMuted and startWithVideoMuted were introduced for
|
||||
// conferences/meetings. So it makes sense for these to not be considered outside of conferences/meetings
|
||||
// (e.g. WelcomePage). Later on, though, we introduced a "Video <-> Voice" toggle on the WelcomePage which utilizes
|
||||
// startAudioOnly outside of conferences/meetings so that particular configuration/preference/setting employs slightly
|
||||
// exclusive logic.
|
||||
const START_WITH_AUDIO_VIDEO_MUTED_SOURCES = {
|
||||
// We have startWithAudioMuted and startWithVideoMuted here:
|
||||
config: true,
|
||||
settings: true,
|
||||
|
||||
// XXX We've already overwritten base/config with urlParams. However,
|
||||
// settings are more important than the server-side config.
|
||||
// Consequently, we need to read from urlParams anyway:
|
||||
urlParams: true,
|
||||
|
||||
// We don't have startWithAudioMuted and startWithVideoMuted here:
|
||||
jwt: false
|
||||
};
|
||||
|
||||
/**
|
||||
* Determines whether audio is currently muted.
|
||||
*
|
||||
|
@ -47,6 +68,26 @@ function _isVideoMutedByAuthority(
|
|||
return Boolean(muted & videoMutismAuthority);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the startWithAudioMuted by retrieving its values from config, URL and settings.
|
||||
*
|
||||
* @param {Object|Function} stateful - The redux state object or {@code getState} function.
|
||||
* @returns {boolean} - The computed startWithAudioMuted value that will be used.
|
||||
*/
|
||||
export function getStartWithAudioMuted(stateful: Object | Function) {
|
||||
return Boolean(getPropertyValue(stateful, 'startWithAudioMuted', START_WITH_AUDIO_VIDEO_MUTED_SOURCES));
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the startWithAudioMuted by retrieving its values from config, URL and settings.
|
||||
*
|
||||
* @param {Object|Function} stateful - The redux state object or {@code getState} function.
|
||||
* @returns {boolean} - The computed startWithAudioMuted value that will be used.
|
||||
*/
|
||||
export function getStartWithVideoMuted(stateful: Object | Function) {
|
||||
return Boolean(getPropertyValue(stateful, 'startWithVideoMuted', START_WITH_AUDIO_VIDEO_MUTED_SOURCES));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether video is currently muted by the user authority.
|
||||
*
|
||||
|
|
|
@ -21,6 +21,7 @@ import {
|
|||
MEDIA_TYPE,
|
||||
VIDEO_MUTISM_AUTHORITY
|
||||
} from './constants';
|
||||
import { getStartWithAudioMuted, getStartWithVideoMuted } from './functions';
|
||||
import logger from './logger';
|
||||
import {
|
||||
_AUDIO_INITIAL_MEDIA_STATE,
|
||||
|
@ -133,37 +134,8 @@ function _setRoom({ dispatch, getState }, next, action) {
|
|||
const state = getState();
|
||||
const { room } = action;
|
||||
const roomIsValid = isRoomValid(room);
|
||||
|
||||
// XXX The configurations/preferences/settings startWithAudioMuted,
|
||||
// startWithVideoMuted, and startAudioOnly were introduced for
|
||||
// conferences/meetings. So it makes sense for these to not be considered
|
||||
// outside of conferences/meetings (e.g. WelcomePage). Later on, though, we
|
||||
// introduced a "Video <-> Voice" toggle on the WelcomePage which utilizes
|
||||
// startAudioOnly outside of conferences/meetings so that particular
|
||||
// configuration/preference/setting employs slightly exclusive logic.
|
||||
const mutedSources = {
|
||||
// We have startWithAudioMuted and startWithVideoMuted here:
|
||||
config: true,
|
||||
settings: true,
|
||||
|
||||
// XXX We've already overwritten base/config with urlParams. However,
|
||||
// settings are more important than the server-side config.
|
||||
// Consequently, we need to read from urlParams anyway:
|
||||
urlParams: true,
|
||||
|
||||
// We don't have startWithAudioMuted and startWithVideoMuted here:
|
||||
jwt: false
|
||||
};
|
||||
const audioMuted
|
||||
= roomIsValid
|
||||
? Boolean(
|
||||
getPropertyValue(state, 'startWithAudioMuted', mutedSources))
|
||||
: _AUDIO_INITIAL_MEDIA_STATE.muted;
|
||||
const videoMuted
|
||||
= roomIsValid
|
||||
? Boolean(
|
||||
getPropertyValue(state, 'startWithVideoMuted', mutedSources))
|
||||
: _VIDEO_INITIAL_MEDIA_STATE.muted;
|
||||
const audioMuted = roomIsValid ? getStartWithAudioMuted(state) : _AUDIO_INITIAL_MEDIA_STATE.muted;
|
||||
const videoMuted = roomIsValid ? getStartWithVideoMuted(state) : _VIDEO_INITIAL_MEDIA_STATE.muted;
|
||||
|
||||
sendAnalytics(
|
||||
createStartMutedConfigurationEvent('local', audioMuted, videoMuted));
|
||||
|
|
Loading…
Reference in New Issue