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(recording) Restores track mute state to original state after consent is provided. Do not forcefully unmute audio and video if the user consents to being recorded and wants to stay unmuted but was muted before hitting join.

Jaya Allamsettye1061090909f
diff --git a/react/features/recording/actions.web.tsx b/react/features/recording/actions.web.tsx
index 12e51e4b9c..f33bcc019e 100644
--- a/react/features/recording/actions.web.tsx
+++ b/react/features/recording/actions.web.tsx
@@ -37,16 +37,25 @@ export function grantRecordingConsent() {
/**
* Grants recording consent, unmutes audio/video, and closes the dialog.
+ * Restores the mute state that existed before the consent dialog was shown,
+ * respecting the user's intentional mute choices from prejoin or initial settings.
*
* @returns {Function}
*/
export function grantRecordingConsentAndUnmute() {
- return (dispatch: IStore['dispatch']) => {
+ return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
+ // Read the prejoin mute state from the dialog props stored in Redux
+ const dialogProps = getState()['features/base/dialog'].componentProps as any;
+ const audioMuted = dialogProps?.audioWasMuted ?? false;
+ const videoMuted = dialogProps?.videoWasMuted ?? false;
+
batch(() => {
dispatch(setAudioUnmutePermissions(false, true));
dispatch(setVideoUnmutePermissions(false, true));
- dispatch(setAudioMuted(false, true));
- dispatch(setVideoMuted(false, VIDEO_MUTISM_AUTHORITY.USER, true));
+
+ // Restore to the mute state before consent was requested.
+ dispatch(setAudioMuted(audioMuted, false));
+ dispatch(setVideoMuted(videoMuted, VIDEO_MUTISM_AUTHORITY.USER, false));
dispatch(hideDialog());
});
};
diff --git a/react/features/recording/components/Recording/native/RecordingConsentDialog.tsx b/react/features/recording/components/Recording/native/RecordingConsentDialog.tsx
index 9d837cb0ad..10ceaf1155 100644
--- a/react/features/recording/components/Recording/native/RecordingConsentDialog.tsx
+++ b/react/features/recording/components/Recording/native/RecordingConsentDialog.tsx
@@ -8,20 +8,21 @@ import ConfirmDialog from '../../../../base/dialog/components/native/ConfirmDial
import { setAudioMuted, setAudioUnmutePermissions, setVideoMuted, setVideoUnmutePermissions } from '../../../../base/media/actions';
import { VIDEO_MUTISM_AUTHORITY } from '../../../../base/media/constants';
import Link from '../../../../base/react/components/native/Link';
+import { IRecordingConsentDialogProps } from '../../../reducer';
import styles from '../styles.native';
/**
* Component that renders the dialog for explicit consent for recordings.
*
+ * @param {IRecordingConsentDialogProps} props - The component props.
* @returns {JSX.Element}
*/
-export default function RecordingConsentDialog() {
+export default function RecordingConsentDialog({ audioWasMuted = false, videoWasMuted = false }: IRecordingConsentDialogProps) {
const dispatch = useDispatch();
const { t } = useTranslation();
const { recordings } = useSelector((state: IReduxState) => state['features/base/config']);
const { consentLearnMoreLink } = recordings ?? {};
-
const consent = useCallback(() => {
dispatch(setAudioUnmutePermissions(false, true));
dispatch(setVideoUnmutePermissions(false, true));
@@ -32,11 +33,13 @@ export default function RecordingConsentDialog() {
const consentAndUnmute = useCallback(() => {
dispatch(setAudioUnmutePermissions(false, true));
dispatch(setVideoUnmutePermissions(false, true));
- dispatch(setAudioMuted(false, true));
- dispatch(setVideoMuted(false, VIDEO_MUTISM_AUTHORITY.USER, true));
+
+ // Restore to the mute state before consent was requested.
+ dispatch(setAudioMuted(audioWasMuted, false));
+ dispatch(setVideoMuted(videoWasMuted, VIDEO_MUTISM_AUTHORITY.USER, false));
return true;
- }, []);
+ }, [ audioWasMuted, videoWasMuted ]);
return (
<ConfirmDialog
diff --git a/react/features/recording/components/Recording/web/RecordingConsentDialog.tsx b/react/features/recording/components/Recording/web/RecordingConsentDialog.tsx
index 883aa402e1..cba13dea51 100644
--- a/react/features/recording/components/Recording/web/RecordingConsentDialog.tsx
+++ b/react/features/recording/components/Recording/web/RecordingConsentDialog.tsx
@@ -10,6 +10,7 @@ import { grantRecordingConsent, grantRecordingConsentAndUnmute } from '../../../
/**
* Component that renders the dialog for explicit consent for recordings.
+ * The prejoin mute state is read from Redux by the action creator.
*
* @returns {JSX.Element}
*/
diff --git a/react/features/recording/middleware.ts b/react/features/recording/middleware.ts
index 59e71989eb..41dd70d762 100644
--- a/react/features/recording/middleware.ts
+++ b/react/features/recording/middleware.ts
@@ -421,12 +421,21 @@ function _showExplicitConsentDialog(recorderSession: any, dispatch: IStore['disp
return;
}
+ // Capture the current mute state BEFORE forcing mute for consent
+ // This preserves the user's intentional mute choices from prejoin or initial settings
+ const state = getState();
+ const audioWasMuted = state['features/base/media'].audio.muted;
+ const videoWasMuted = state['features/base/media'].video.muted;
+
batch(() => {
dispatch(markConsentRequested(recorderSession.getID()));
dispatch(setAudioUnmutePermissions(true, true));
dispatch(setVideoUnmutePermissions(true, true));
dispatch(setAudioMuted(true));
dispatch(setVideoMuted(true));
- dispatch(openDialog('RecordingConsentDialog', RecordingConsentDialog));
+ dispatch(openDialog('RecordingConsentDialog', RecordingConsentDialog, {
+ audioWasMuted,
+ videoWasMuted
+ }));
});
}
diff --git a/react/features/recording/reducer.ts b/react/features/recording/reducer.ts
index 17f3489be5..0e8244fd0b 100644
--- a/react/features/recording/reducer.ts
+++ b/react/features/recording/reducer.ts
@@ -42,6 +42,14 @@ export interface IRecordingState {
wasStartRecordingSuggested?: boolean;
}
+/**
+ * Props for the RecordingConsentDialog component.
+ */
+export interface IRecordingConsentDialogProps {
+ audioWasMuted?: boolean;
+ videoWasMuted?: boolean;
+}
+
/**
* The name of the Redux store this feature stores its state in.
*/