Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(follow-me): Adds option to limit it for recorder only. (#15120)
Дамян Минков085e6dd3b98b
diff --git a/lang/main.json b/lang/main.jsonindex b3914fc852..27ac1ced89 100644--- a/lang/main.json+++ b/lang/main.json@@ -1096,6 +1096,7 @@"desktopShareWarning": "You need to restart the screen share for the new settings to take effect.","devices": "Devices","followMe": "Everyone follows me",+ "followMeRecorder": "Recorder follows me","framesPerSecond": "frames-per-second","incomingMessage": "Incoming message","language": "Language",diff --git a/react/features/base/conference/actionTypes.ts b/react/features/base/conference/actionTypes.tsindex 0557717c47..8ff83f09a4 100644--- a/react/features/base/conference/actionTypes.ts+++ b/react/features/base/conference/actionTypes.ts@@ -56,7 +56,7 @@ export const CONFERENCE_LEFT = 'CONFERENCE_LEFT';/*** The type of (redux) action which signals that the conference is out of focus.* For example, if the user navigates to the Chat screen.- *+ ** {* type: CONFERENCE_BLURRED,* }@@ -65,7 +65,7 @@ export const CONFERENCE_BLURRED = 'CONFERENCE_BLURRED';/*** The type of (redux) action which signals that the conference is in focus.- *+ ** {* type: CONFERENCE_FOCUSED,* }@@ -258,6 +258,17 @@ export const SEND_TONES = 'SEND_TONES';*/export const SET_FOLLOW_ME = 'SET_FOLLOW_ME';+/**+ * The type of (redux) action which updates the current known status of the+ * Follow Me feature that is used only by the recorder.+ *+ * {+ * type: SET_FOLLOW_ME_RECORDER,+ * enabled: boolean+ * }+ */+export const SET_FOLLOW_ME_RECORDER = 'SET_FOLLOW_ME_RECORDER';+/*** The type of (redux) action which sets the obfuscated room name.*@@ -338,7 +349,7 @@ export const SET_START_MUTED_POLICY = 'SET_START_MUTED_POLICY';/*** The type of (redux) action which updates the assumed bandwidth bps.- *+ ** {* type: SET_ASSUMED_BANDWIDTH_BPS,* assumedBandwidthBps: numberdiff --git a/react/features/base/conference/actions.any.ts b/react/features/base/conference/actions.any.tsindex 86da22e2f4..38fbed3131 100644--- a/react/features/base/conference/actions.any.ts+++ b/react/features/base/conference/actions.any.ts@@ -61,6 +61,7 @@ import {SEND_TONES,SET_ASSUMED_BANDWIDTH_BPS,SET_FOLLOW_ME,+ SET_FOLLOW_ME_RECORDER,SET_OBFUSCATED_ROOM,SET_PASSWORD,SET_PASSWORD_FAILED,@@ -847,6 +848,22 @@ export function setFollowMe(enabled: boolean) {};}+/**+ * Enables or disables the Follow Me feature used only for the recorder.+ *+ * @param {boolean} enabled - Whether Follow Me should be enabled and used only by the recorder.+ * @returns {{+ * type: SET_FOLLOW_ME_RECORDER,+ * enabled: boolean+ * }}+ */+export function setFollowMeRecorder(enabled: boolean) {+ return {+ type: SET_FOLLOW_ME_RECORDER,+ enabled+ };+}+/*** Enables or disables the Mute reaction sounds feature.*diff --git a/react/features/base/conference/reducer.ts b/react/features/base/conference/reducer.tsindex 3af9c06f47..39af43c3b8 100644--- a/react/features/base/conference/reducer.ts+++ b/react/features/base/conference/reducer.ts@@ -26,6 +26,7 @@ import {P2P_STATUS_CHANGED,SET_ASSUMED_BANDWIDTH_BPS,SET_FOLLOW_ME,+ SET_FOLLOW_ME_RECORDER,SET_OBFUSCATED_ROOM,SET_PASSWORD,SET_PENDING_SUBJECT_CHANGE,@@ -160,6 +161,7 @@ export interface IConferenceState {e2eeSupported?: boolean;error?: Error;followMeEnabled?: boolean;+ followMeRecorderEnabled?: boolean;joining?: IJitsiConference;leaving?: IJitsiConference;lobbyWaitingForHost?: boolean;@@ -252,6 +254,12 @@ ReducerRegistry.register<IConferenceState>('features/base/conference',case SET_FOLLOW_ME:return set(state, 'followMeEnabled', action.enabled);+ case SET_FOLLOW_ME_RECORDER:+ return { ...state,+ followMeRecorderEnabled: action.enabled,+ followMeEnabled: action.enabled+ };+case SET_START_REACTIONS_MUTED:return set(state, 'startReactionsMuted', action.muted);diff --git a/react/features/follow-me/actions.ts b/react/features/follow-me/actions.tsindex c6acbef46c..2e6e0267c4 100644--- a/react/features/follow-me/actions.ts+++ b/react/features/follow-me/actions.ts@@ -7,15 +7,18 @@ import {* Sets the current moderator id or clears it.** @param {?string} id - The Follow Me moderator participant id.+ * @param {?boolean} forRecorder - Whether this is command only for recorder.* @returns {{* type: SET_FOLLOW_ME_MODERATOR,- * id, string+ * id: string,+ * forRecorder: boolean* }}*/-export function setFollowMeModerator(id?: string) {+export function setFollowMeModerator(id?: string, forRecorder?: boolean) {return {type: SET_FOLLOW_ME_MODERATOR,- id+ id,+ forRecorder};}diff --git a/react/features/follow-me/functions.ts b/react/features/follow-me/functions.tsindex 25c22f871d..5030cde18e 100644--- a/react/features/follow-me/functions.ts+++ b/react/features/follow-me/functions.ts@@ -13,3 +13,16 @@ export function isFollowMeActive(stateful: IStateful) {return Boolean(state['features/follow-me'].moderator);}++/**+ * Returns true if follow me is active only for the recorder and false otherwise.+ *+ * @param {Object|Function} stateful - Object or function that can be resolved+ * to the Redux state.+ * @returns {boolean} - True if follow me is active and false otherwise.+ */+export function isFollowMeRecorderActive(stateful: IStateful) {+ const state = toState(stateful);++ return Boolean(state['features/follow-me'].recorder);+}diff --git a/react/features/follow-me/middleware.ts b/react/features/follow-me/middleware.tsindex 76adfee534..78f2da028c 100644--- a/react/features/follow-me/middleware.ts+++ b/react/features/follow-me/middleware.ts@@ -128,7 +128,7 @@ function _onFollowMeCommand(attributes: any = {}, id: string, store: IStore) {}if (!isFollowMeActive(state)) {- store.dispatch(setFollowMeModerator(id));+ store.dispatch(setFollowMeModerator(id, attributes.recorder));}// just a command that follow me was turned off@@ -138,6 +138,11 @@ function _onFollowMeCommand(attributes: any = {}, id: string, store: IStore) {return;}+ // when recorder flag is on, follow me is handled only on recorder side+ if (attributes.recorder && !store.getState()['features/base/config'].iAmRecorder) {+ return;+ }+const oldState = state['features/follow-me'].state || {};store.dispatch(setFollowMeState(attributes));diff --git a/react/features/follow-me/reducer.ts b/react/features/follow-me/reducer.tsindex 981b9cfde6..4697879578 100644--- a/react/features/follow-me/reducer.ts+++ b/react/features/follow-me/reducer.ts@@ -8,6 +8,7 @@ import {export interface IFollowMeState {moderator?: string;+ recorder?: boolean;state?: {[key: string]: string;};@@ -24,9 +25,12 @@ ReducerRegistry.register<IFollowMeState>(case SET_FOLLOW_ME_MODERATOR: {let newState = set(state, 'moderator', action.id);- if (!action.id) {+ if (action.id) {+ newState = set(newState, 'recorder', action.forRecorder);+ } else {// clear the state if feature becomes disablednewState = set(newState, 'state', undefined);+ newState = set(newState, 'recorder', undefined);}return newState;diff --git a/react/features/follow-me/subscriber.ts b/react/features/follow-me/subscriber.tsindex f9606b14e8..78a2592b8d 100644--- a/react/features/follow-me/subscriber.ts+++ b/react/features/follow-me/subscriber.ts@@ -88,6 +88,7 @@ function _getFollowMeState(state: IReduxState) {const stageFilmstrip = isStageFilmstripEnabled(state);return {+ recorder: state['features/base/conference'].followMeRecorderEnabled,filmstripVisible: state['features/filmstrip'].visible,maxStageParticipants: stageFilmstrip ? state['features/base/settings'].maxStageParticipants : undefined,nextOnStage: pinnedParticipant?.id,diff --git a/react/features/settings/actions.web.ts b/react/features/settings/actions.web.tsindex c14fff7531..ed4b2d2966 100644--- a/react/features/settings/actions.web.ts+++ b/react/features/settings/actions.web.ts@@ -5,6 +5,7 @@ import { setTokenAuthUrlSuccess } from '../authentication/actions.web';import { isTokenAuthEnabled } from '../authentication/functions';import {setFollowMe,+ setFollowMeRecorder,setStartMutedPolicy,setStartReactionsMuted} from '../base/conference/actions';@@ -165,6 +166,10 @@ export function submitModeratorTab(newState: any) {dispatch(setFollowMe(newState.followMeEnabled));}+ if (newState.followMeRecorderEnabled !== currentState.followMeRecorderEnabled) {+ dispatch(setFollowMeRecorder(newState.followMeRecorderEnabled));+ }+if (newState.startReactionsMuted !== currentState.startReactionsMuted) {batch(() => {// updating settings we want to update and backend (notify the rest of the participants)diff --git a/react/features/settings/components/native/ModeratorSection.tsx b/react/features/settings/components/native/ModeratorSection.tsxindex 394acf3831..b4fb0632ed 100644--- a/react/features/settings/components/native/ModeratorSection.tsx+++ b/react/features/settings/components/native/ModeratorSection.tsx@@ -2,7 +2,12 @@ import React, { useCallback, useMemo } from 'react';import { useDispatch, useSelector } from 'react-redux';import { IReduxState } from '../../../app/types';-import { setFollowMe, setStartMutedPolicy, setStartReactionsMuted } from '../../../base/conference/actions';+import {+ setFollowMe,+ setFollowMeRecorder,+ setStartMutedPolicy,+ setStartReactionsMuted+} from '../../../base/conference/actions';import { updateSettings } from '../../../base/settings/actions';import Switch from '../../../base/ui/components/native/Switch';import { getModeratorTabProps } from '../../functions.native';@@ -14,6 +19,7 @@ const ModeratorSection = () => {const dispatch = useDispatch();const {followMeEnabled,+ followMeRecorderEnabled,startAudioMuted,startVideoMuted,startReactionsMuted@@ -35,6 +41,10 @@ const ModeratorSection = () => {dispatch(setFollowMe(Boolean(enabled)));}, [ dispatch, setFollowMe ]);+ const onFollowMeRecorderToggled = useCallback((enabled?: boolean) => {+ dispatch(setFollowMeRecorder(Boolean(enabled)));+ }, [ dispatch, setFollowMeRecorder ]);+const onStartReactionsMutedToggled = useCallback((enabled?: boolean) => {dispatch(setStartReactionsMuted(Boolean(enabled), true));dispatch(updateSettings({ soundsReactions: enabled }));@@ -57,6 +67,11 @@ const ModeratorSection = () => {state: followMeEnabled,onChange: onFollowMeToggled},+ {+ label: 'settings.followMeRecorder',+ state: followMeRecorderEnabled,+ onChange: onFollowMeRecorderToggled+ },{label: 'settings.startReactionsMuted',state: startReactionsMuted,@@ -72,7 +87,13 @@ const ModeratorSection = () => {}, [ startAudioMuted,startVideoMuted,followMeEnabled,+ followMeRecorderEnabled,disableReactionsModeration,+ onStartAudioMutedToggled,+ onStartVideoMutedToggled,+ onFollowMeToggled,+ onFollowMeRecorderToggled,+ onStartReactionsMutedToggled,startReactionsMuted ]);return (diff --git a/react/features/settings/components/web/ModeratorTab.tsx b/react/features/settings/components/web/ModeratorTab.tsxindex d690e6dec9..5796d969e8 100644--- a/react/features/settings/components/web/ModeratorTab.tsx+++ b/react/features/settings/components/web/ModeratorTab.tsx@@ -34,6 +34,16 @@ export interface IProps extends AbstractDialogTabProps, WithTranslation {*/followMeEnabled: boolean;+ /**+ * Whether follow me for recorder is currently active (enabled by some other participant).+ */+ followMeRecorderActive: boolean;++ /**+ * Whether the user has selected the Follow Me Recorder feature to be enabled.+ */+ followMeRecorderEnabled: boolean;+/*** Whether or not the user has selected the Start Audio Muted feature to be* enabled.@@ -92,6 +102,7 @@ class ModeratorTab extends AbstractDialogTab<IProps, any> {this._onStartVideoMutedChanged = this._onStartVideoMutedChanged.bind(this);this._onStartReactionsMutedChanged = this._onStartReactionsMutedChanged.bind(this);this._onFollowMeEnabledChanged = this._onFollowMeEnabledChanged.bind(this);+ this._onFollowMeRecorderEnabledChanged = this._onFollowMeRecorderEnabledChanged.bind(this);}/**@@ -142,6 +153,17 @@ class ModeratorTab extends AbstractDialogTab<IProps, any> {super._onChange({ followMeEnabled: checked });}+ /**+ * Callback invoked to select if follow-me for recorder mode should be activated.+ *+ * @param {Object} e - The key event to handle.+ *+ * @returns {void}+ */+ _onFollowMeRecorderEnabledChanged({ target: { checked } }: React.ChangeEvent<HTMLInputElement>) {+ super._onChange({ followMeRecorderEnabled: checked });+ }+/*** Implements React's {@link Component#render()}.*@@ -153,6 +175,8 @@ class ModeratorTab extends AbstractDialogTab<IProps, any> {disableReactionsModeration,followMeActive,followMeEnabled,+ followMeRecorderActive,+ followMeRecorderEnabled,startAudioMuted,startVideoMuted,startReactionsMuted,@@ -182,10 +206,17 @@ class ModeratorTab extends AbstractDialogTab<IProps, any> {<Checkboxchecked = { followMeEnabled && !followMeActive }className = { classes.checkbox }- disabled = { followMeActive }+ disabled = { followMeActive || followMeRecorderActive }label = { t('settings.followMe') }name = 'follow-me'onChange = { this._onFollowMeEnabledChanged } />+ <Checkbox+ checked = { followMeRecorderEnabled && !followMeRecorderActive }+ className = { classes.checkbox }+ disabled = { followMeRecorderActive || followMeActive }+ label = { t('settings.followMeRecorder') }+ name = 'follow-me-recorder'+ onChange = { this._onFollowMeRecorderEnabledChanged } />{ !disableReactionsModeration&& <Checkboxchecked = { startReactionsMuted }diff --git a/react/features/settings/components/web/SettingsDialog.tsx b/react/features/settings/components/web/SettingsDialog.tsxindex 8bbd4d83ad..434fb95b8d 100644--- a/react/features/settings/components/web/SettingsDialog.tsx+++ b/react/features/settings/components/web/SettingsDialog.tsx@@ -253,6 +253,7 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {return {...newProps,followMeEnabled: tabState?.followMeEnabled,+ followMeRecorderEnabled: tabState?.followMeRecorderEnabled,startAudioMuted: tabState?.startAudioMuted,startVideoMuted: tabState?.startVideoMuted,startReactionsMuted: tabState?.startReactionsMuteddiff --git a/react/features/settings/functions.any.ts b/react/features/settings/functions.any.tsindex ca77befa9e..20f8195aff 100644--- a/react/features/settings/functions.any.ts+++ b/react/features/settings/functions.any.ts@@ -9,7 +9,7 @@ import { toState } from '../base/redux/functions';import { getHideSelfView } from '../base/settings/functions.any';import { parseStandardURIString } from '../base/util/uri';import { isStageFilmstripEnabled } from '../filmstrip/functions';-import { isFollowMeActive } from '../follow-me/functions';+import { isFollowMeActive, isFollowMeRecorderActive } from '../follow-me/functions';import { isPrejoinEnabledInConfig } from '../prejoin/functions';import { isReactionsEnabled } from '../reactions/functions.any';import { iAmVisitor } from '../visitors/functions';@@ -133,12 +133,14 @@ export function getModeratorTabProps(stateful: IStateful) {const {conference,followMeEnabled,+ followMeRecorderEnabled,startAudioMutedPolicy,startVideoMutedPolicy,startReactionsMuted} = state['features/base/conference'];const { disableReactionsModeration } = state['features/base/config'];const followMeActive = isFollowMeActive(state);+ const followMeRecorderActive = isFollowMeRecorderActive(state);const showModeratorSettings = shouldShowModeratorSettings(state);// The settings sections to display.@@ -147,6 +149,8 @@ export function getModeratorTabProps(stateful: IStateful) {disableReactionsModeration: Boolean(disableReactionsModeration),followMeActive: Boolean(conference && followMeActive),followMeEnabled: Boolean(conference && followMeEnabled),+ followMeRecorderActive: Boolean(conference && followMeRecorderActive),+ followMeRecorderEnabled: Boolean(conference && followMeRecorderEnabled),startReactionsMuted: Boolean(conference && startReactionsMuted),startAudioMuted: Boolean(conference && startAudioMutedPolicy),startVideoMuted: Boolean(conference && startVideoMutedPolicy)