ref(setVideoMuted): remove mediaType param.

This commit is contained in:
Hristo Terezov 2022-12-07 15:37:12 -06:00
parent e7078786e6
commit 5077a33fcb
7 changed files with 10 additions and 17 deletions

View File

@ -154,7 +154,6 @@ export function setVideoAvailable(available: boolean) {
* *
* @param {boolean} muted - True if the local video is to be muted or false if * @param {boolean} muted - True if the local video is to be muted or false if
* the local video is to be unmuted. * the local video is to be unmuted.
* @param {MEDIA_TYPE} mediaType - The type of media.
* @param {number} authority - The {@link VIDEO_MUTISM_AUTHORITY} which is * @param {number} authority - The {@link VIDEO_MUTISM_AUTHORITY} which is
* muting/unmuting the local video. * muting/unmuting the local video.
* @param {boolean} ensureTrack - True if we want to ensure that a new track is * @param {boolean} ensureTrack - True if we want to ensure that a new track is
@ -163,7 +162,6 @@ export function setVideoAvailable(available: boolean) {
*/ */
export function setVideoMuted( export function setVideoMuted(
muted: boolean, muted: boolean,
mediaType: string = MEDIA_TYPE.VIDEO,
authority: number = VIDEO_MUTISM_AUTHORITY.USER, authority: number = VIDEO_MUTISM_AUTHORITY.USER,
ensureTrack = false) { ensureTrack = false) {
return (dispatch: IStore['dispatch'], getState: IStore['getState']) => { return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
@ -186,7 +184,6 @@ export function setVideoMuted(
return dispatch({ return dispatch({
type: SET_VIDEO_MUTED, type: SET_VIDEO_MUTED,
authority, authority,
mediaType,
ensureTrack, ensureTrack,
muted: newValue muted: newValue
}); });

View File

@ -166,7 +166,7 @@ function _appStateChanged({ dispatch, getState }, next, action) {
sendAnalytics(createTrackMutedEvent('video', 'background mode', mute)); sendAnalytics(createTrackMutedEvent('video', 'background mode', mute));
dispatch(setVideoMuted(mute, MEDIA_TYPE.VIDEO, VIDEO_MUTISM_AUTHORITY.BACKGROUND)); dispatch(setVideoMuted(mute, VIDEO_MUTISM_AUTHORITY.BACKGROUND));
} }
return next(action); return next(action);
@ -191,7 +191,7 @@ function _setAudioOnly({ dispatch, getState }, next, action) {
sendAnalytics(createTrackMutedEvent('video', 'audio-only mode', audioOnly)); sendAnalytics(createTrackMutedEvent('video', 'audio-only mode', audioOnly));
// Make sure we mute both the desktop and video tracks. // Make sure we mute both the desktop and video tracks.
dispatch(setVideoMuted(audioOnly, MEDIA_TYPE.VIDEO, VIDEO_MUTISM_AUTHORITY.AUDIO_ONLY)); dispatch(setVideoMuted(audioOnly, VIDEO_MUTISM_AUTHORITY.AUDIO_ONLY));
if (getMultipleVideoSendingSupportFeatureFlag(state)) { if (getMultipleVideoSendingSupportFeatureFlag(state)) {
dispatch(setScreenshareMuted(audioOnly, MEDIA_TYPE.SCREENSHARE, SCREENSHARE_MUTISM_AUTHORITY.AUDIO_ONLY)); dispatch(setScreenshareMuted(audioOnly, MEDIA_TYPE.SCREENSHARE, SCREENSHARE_MUTISM_AUTHORITY.AUDIO_ONLY));
} }

View File

@ -8,10 +8,7 @@ import {
setScreenshareMuted, setScreenshareMuted,
setVideoMuted setVideoMuted
} from '../media/actions'; } from '../media/actions';
import { import { VIDEO_MUTISM_AUTHORITY } from '../media/constants';
MEDIA_TYPE,
VIDEO_MUTISM_AUTHORITY
} from '../media/constants';
import { addLocalTrack, replaceLocalTrack } from './actions.any'; import { addLocalTrack, replaceLocalTrack } from './actions.any';
import { getLocalDesktopTrack, getTrackState, isLocalVideoTrackDesktop } from './functions.native'; import { getLocalDesktopTrack, getTrackState, isLocalVideoTrackDesktop } from './functions.native';
@ -40,7 +37,7 @@ export function toggleScreensharing(enabled: boolean, _ignore1?: boolean, _ignor
} }
} else { } else {
dispatch(setScreenshareMuted(true)); dispatch(setScreenshareMuted(true));
dispatch(setVideoMuted(false, MEDIA_TYPE.VIDEO, VIDEO_MUTISM_AUTHORITY.SCREEN_SHARE)); dispatch(setVideoMuted(false, VIDEO_MUTISM_AUTHORITY.SCREEN_SHARE));
setPictureInPictureEnabled(true); setPictureInPictureEnabled(true);
} }
}; };
@ -73,7 +70,7 @@ async function _startScreenSharing(dispatch: Function, state: IReduxState) {
dispatch(addLocalTrack(track)); dispatch(addLocalTrack(track));
} }
dispatch(setVideoMuted(true, MEDIA_TYPE.VIDEO, VIDEO_MUTISM_AUTHORITY.SCREEN_SHARE)); dispatch(setVideoMuted(true, VIDEO_MUTISM_AUTHORITY.SCREEN_SHARE));
const { enabled: audioOnly } = state['features/base/audio-only']; const { enabled: audioOnly } = state['features/base/audio-only'];

View File

@ -88,7 +88,7 @@ MiddlewareRegistry.register(store => next => action => {
return; return;
} }
_setMuted(store, action, action.mediaType); _setMuted(store, action, MEDIA_TYPE.VIDEO);
break; break;
case TOGGLE_CAMERA_FACING_MODE: { case TOGGLE_CAMERA_FACING_MODE: {

View File

@ -5,7 +5,7 @@ import { sendAnalytics } from '../analytics/functions';
import { IStore } from '../app/types'; import { IStore } from '../app/types';
import { setAudioOnly } from '../base/audio-only/actions'; import { setAudioOnly } from '../base/audio-only/actions';
import { setVideoMuted } from '../base/media/actions'; import { setVideoMuted } from '../base/media/actions';
import { MEDIA_TYPE, VIDEO_MUTISM_AUTHORITY } from '../base/media/constants'; import { VIDEO_MUTISM_AUTHORITY } from '../base/media/constants';
import { import {
SET_TOOLBOX_ENABLED, SET_TOOLBOX_ENABLED,
@ -96,7 +96,6 @@ export function handleToggleVideoMuted(muted: boolean, showUI: boolean, ensureTr
dispatch( dispatch(
setVideoMuted( setVideoMuted(
muted, muted,
MEDIA_TYPE.VIDEO,
VIDEO_MUTISM_AUTHORITY.USER, VIDEO_MUTISM_AUTHORITY.USER,
ensureTrack)); ensureTrack));

View File

@ -1,5 +1,5 @@
import { setVideoMuted } from '../base/media/actions'; import { setVideoMuted } from '../base/media/actions';
import { MEDIA_TYPE, VIDEO_MUTISM_AUTHORITY } from '../base/media/constants'; import { VIDEO_MUTISM_AUTHORITY } from '../base/media/constants';
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry'; import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
import { CLIENT_RESIZED } from '../base/responsive-ui/actionTypes'; import { CLIENT_RESIZED } from '../base/responsive-ui/actionTypes';
import { setLargeVideoDimensions } from '../large-video/actions.any'; import { setLargeVideoDimensions } from '../large-video/actions.any';
@ -19,7 +19,7 @@ MiddlewareRegistry.register(store => next => action => {
switch (action.type) { switch (action.type) {
case SET_CAR_MODE: case SET_CAR_MODE:
dispatch(setVideoMuted(action.enabled, MEDIA_TYPE.VIDEO, VIDEO_MUTISM_AUTHORITY.CAR_MODE)); dispatch(setVideoMuted(action.enabled, VIDEO_MUTISM_AUTHORITY.CAR_MODE));
break; break;
case CLIENT_RESIZED: { case CLIENT_RESIZED: {
const { clientHeight, clientWidth } = store.getState()['features/base/responsive-ui']; const { clientHeight, clientWidth } = store.getState()['features/base/responsive-ui'];

View File

@ -52,7 +52,7 @@ export function muteLocal(enable: boolean, mediaType: MediaType, stopScreenShari
sendAnalytics(createToolbarEvent(isAudio ? AUDIO_MUTE : VIDEO_MUTE, { enable })); sendAnalytics(createToolbarEvent(isAudio ? AUDIO_MUTE : VIDEO_MUTE, { enable }));
dispatch(isAudio ? setAudioMuted(enable, /* ensureTrack */ true) dispatch(isAudio ? setAudioMuted(enable, /* ensureTrack */ true)
: setVideoMuted(enable, mediaType, VIDEO_MUTISM_AUTHORITY.USER, /* ensureTrack */ true)); : setVideoMuted(enable, VIDEO_MUTISM_AUTHORITY.USER, /* ensureTrack */ true));
// FIXME: The old conference logic still relies on this event being emitted. // FIXME: The old conference logic still relies on this event being emitted.
typeof APP === 'undefined' typeof APP === 'undefined'