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
fix(recording): make record/transcribe button, dialog and nudge capability-aware, and notify remotes
Mihaela Dumitrucf73cdea6de4
diff --git a/react/features/recording/components/Recording/AbstractRecordButton.ts b/react/features/recording/components/Recording/AbstractRecordButton.tsindex fd9c9a3293..db3da6cdef 100644--- a/react/features/recording/components/Recording/AbstractRecordButton.ts+++ b/react/features/recording/components/Recording/AbstractRecordButton.ts@@ -8,6 +8,7 @@ import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';import { isLocalParticipantModerator } from '../../../base/participants/functions';import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';import { maybeShowPremiumFeatureDialog } from '../../../jaas/actions';+import { canAddTranscriber } from '../../../transcribing/functions';import { canStopRecording, getRecordButtonProps, supportsLocalRecording } from '../../functions';/**@@ -17,14 +18,14 @@ import { canStopRecording, getRecordButtonProps, supportsLocalRecording } from 'export interface IProps extends AbstractButtonProps {/**- * True if the button needs to be disabled.+ * True if the local participant can start/stop transcription.*/- _disabled: boolean;+ _canTranscribe: boolean;/**- * True if the local participant is a moderator.+ * True if the button needs to be disabled.*/- _isModerator: boolean;+ _disabled: boolean;/*** True if there is a running active recording, false otherwise.@@ -49,11 +50,11 @@ export default class AbstractRecordButton<P extends IProps> extends AbstractButtoverride toggledIcon = IconStop;override _getLabel() {- return this.props._isModerator ? super._getLabel() : 'toolbar.record';+ return this.props._canTranscribe ? super._getLabel() : 'toolbar.record';}override _getAccessibilityLabel() {- return this.props._isModerator ? super._getAccessibilityLabel() : 'toolbar.record';+ return this.props._canTranscribe ? super._getAccessibilityLabel() : 'toolbar.record';}/**@@ -149,8 +150,8 @@ export function _mapStateToProps(state: IReduxState) {const hasRecordingJwt = isJwtFeatureEnabled(state, MEET_FEATURES.RECORDING, false);return {+ _canTranscribe: canAddTranscriber(state),_disabled,- _isModerator: isModerator,_isRecordingRunning: canStopRecording(state),_tooltip,visible: visible && (isModerator || localRecordingEnabled || hasRecordingJwt)diff --git a/react/features/recording/components/Recording/AbstractStartRecordingDialog.ts b/react/features/recording/components/Recording/AbstractStartRecordingDialog.tsindex 5f7ae04de5..cfb0b8a9cd 100644--- a/react/features/recording/components/Recording/AbstractStartRecordingDialog.ts+++ b/react/features/recording/components/Recording/AbstractStartRecordingDialog.ts@@ -586,6 +586,17 @@ class AbstractStartRecordingDialog extends Component<IProps, IState> {isRecordingRequested: true,isTranscribingEnabled: true});+ } else if (startRecording) {+ // Recording started without a transcription change: announce it in room metadata so the+ // other participants get the recording start notification/sound (this is what the+ // metadata listener turns into the remote notification). Preserve any existing+ // isTranscribingEnabled so a running transcription is not signalled as stopped.+ const existingRecMeta = _conference?.getMetadataHandler()?.getMetadata()[RECORDING_METADATA_ID] ?? {};++ _conference?.getMetadataHandler().setMetadata(RECORDING_METADATA_ID, {+ ...existingRecMeta,+ isRecordingRequested: true+ });}return true;diff --git a/react/features/recording/components/Recording/native/StartRecordingDialogContent.tsx b/react/features/recording/components/Recording/native/StartRecordingDialogContent.tsxindex b8d692c312..462948d565 100644--- a/react/features/recording/components/Recording/native/StartRecordingDialogContent.tsx+++ b/react/features/recording/components/Recording/native/StartRecordingDialogContent.tsx@@ -35,6 +35,7 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent {_renderSessionToggles() {const {_dialogStyles,+ _renderRecording,_styles: styles,shouldRecordAudioAndVideo,shouldRecordTranscription,@@ -43,36 +44,40 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent {return (<>- <View- key = 'audioVideoSetting'- style = { styles.header }>- <Text- style = {{- ..._dialogStyles.text,- ...styles.title- }}>- { t('recording.recordAudioAndVideo') }- </Text>- <Switch- checked = { shouldRecordAudioAndVideo }- onChange = { this._onRecordAudioAndVideoSwitchChange }- style = { styles.switch } />- </View>- <View- key = 'transcriptionSetting'- style = { styles.header }>- <Text- style = {{- ..._dialogStyles.text,- ...styles.title- }}>- { t('recording.recordTranscription') }- </Text>- <Switch- checked = { shouldRecordTranscription }- onChange = { this._onTranscriptionSwitchChange }- style = { styles.switch } />- </View>+ { _renderRecording && (+ <View+ key = 'audioVideoSetting'+ style = { styles.header }>+ <Text+ style = {{+ ..._dialogStyles.text,+ ...styles.title+ }}>+ { t('recording.recordAudioAndVideo') }+ </Text>+ <Switch+ checked = { shouldRecordAudioAndVideo }+ onChange = { this._onRecordAudioAndVideoSwitchChange }+ style = { styles.switch } />+ </View>+ ) }+ { this._canStartTranscribing() && (+ <View+ key = 'transcriptionSetting'+ style = { styles.header }>+ <Text+ style = {{+ ..._dialogStyles.text,+ ...styles.title+ }}>+ { t('recording.recordTranscription') }+ </Text>+ <Switch+ checked = { shouldRecordTranscription }+ onChange = { this._onTranscriptionSwitchChange }+ style = { styles.switch } />+ </View>+ ) }</>);}diff --git a/react/features/recording/components/Recording/web/StartRecordingDialogContent.tsx b/react/features/recording/components/Recording/web/StartRecordingDialogContent.tsxindex aa7c1046a2..a57f18fa9e 100644--- a/react/features/recording/components/Recording/web/StartRecordingDialogContent.tsx+++ b/react/features/recording/components/Recording/web/StartRecordingDialogContent.tsx@@ -38,23 +38,25 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent {* @returns {React$Component}*/_renderSessionToggles() {- const { _isModerator, shouldRecordAudioAndVideo, shouldRecordTranscription, t } = this.props;+ const { _renderRecording, shouldRecordAudioAndVideo, shouldRecordTranscription, t } = this.props;return (<>- <div className = 'recording-header space-top'>- <label- className = 'recording-title'- htmlFor = 'recording-switch-audio-video'>- { t('recording.recordAudioAndVideo') }- </label>- <Switch- checked = { shouldRecordAudioAndVideo }- className = 'recording-switch'- id = 'recording-switch-audio-video'- onChange = { this._onRecordAudioAndVideoSwitchChange } />- </div>- { _isModerator && (+ { _renderRecording && (+ <div className = 'recording-header space-top'>+ <label+ className = 'recording-title'+ htmlFor = 'recording-switch-audio-video'>+ { t('recording.recordAudioAndVideo') }+ </label>+ <Switch+ checked = { shouldRecordAudioAndVideo }+ className = 'recording-switch'+ id = 'recording-switch-audio-video'+ onChange = { this._onRecordAudioAndVideoSwitchChange } />+ </div>+ ) }+ { this._canStartTranscribing() && (<div className = 'recording-header space-top'><labelclassName = 'recording-title'@@ -68,6 +70,7 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent {onChange = { this._onTranscriptionSwitchChange } /></div>) }+ { !_renderRecording && this._renderLocalRecordingContent() }</>);}@@ -75,10 +78,8 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent {override render() {const {_canStartTranscribing,- _localRecordingAvailable,_renderRecording,_transcriptionRunning,- integrationsEnabled,recordingRunning} = this.props;@@ -93,9 +94,9 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent {const isTranscriptionOnlySession = Boolean(_transcriptionRunning) && !recordingRunning;if (isTranscriptionOnlySession) {- // Transcription-only session: show the share-link toggle and- // interactive service toggles so the user can start recording- // and/or stop transcription independently.+ // Transcription-only session: show the share-link toggle plus the per-capability service+ // toggles (recording, transcription, local recording) so the participant can act on+ // whatever they are allowed to control.return (<Container className = 'recording-dialog'>{ this._renderFileSharingContent() }@@ -104,8 +105,9 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent {);}- const hasRecordingService = _renderRecording || _localRecordingAvailable || integrationsEnabled;- const transcriptionOnly = !hasRecordingService && _canStartTranscribing;+ // Offer the standalone transcription toggle to transcription-capable participants whenever+ // cloud recording is not available (when it is, transcription lives in the advanced options).+ const showTranscription = !_renderRecording && _canStartTranscribing;return (<Container className = 'recording-dialog'>@@ -118,8 +120,8 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent {{ this._renderIntegrationsContent() }</>)}+ { showTranscription && this._renderTranscriptionOnly() }{ this._renderLocalRecordingContent() }- { transcriptionOnly && this._renderTranscriptionOnly() }</Container>);}@@ -134,9 +136,9 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent {const { shouldRecordTranscription, t } = this.props;return (- <div className = 'recording-header'>+ <div className = 'recording-header space-top'><label- className = 'recording-title-no-space'+ className = 'recording-title'htmlFor = 'recording-switch-transcription'>{ t('recording.recordTranscription') }</label>diff --git a/react/features/recording/middleware.ts b/react/features/recording/middleware.tsindex bf82bb9ef4..8dbbc2d3ea 100644--- a/react/features/recording/middleware.ts+++ b/react/features/recording/middleware.ts@@ -7,6 +7,8 @@ import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app/actionTypes';import { CONFERENCE_JOIN_IN_PROGRESS } from '../base/conference/actionTypes';import { getCurrentConference } from '../base/conference/functions';import { openDialog } from '../base/dialog/actions';+import { MEET_FEATURES } from '../base/jwt/constants';+import { isJwtFeatureEnabled } from '../base/jwt/functions';import JitsiMeetJS, {JitsiConferenceEvents,JitsiRecordingConstants@@ -35,7 +37,7 @@ import {import { TRACK_ADDED } from '../base/tracks/actionTypes';import { hideNotification, showErrorNotification, showNotification } from '../notifications/actions';import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';-import { isRecorderTranscriptionsRunning, isTranscribing } from '../transcribing/functions';+import { canAddTranscriber, isRecorderTranscriptionsRunning, isTranscribing } from '../transcribing/functions';import { RECORDING_SESSION_UPDATED, START_LOCAL_RECORDING, STOP_LOCAL_RECORDING } from './actionTypes';import {@@ -167,11 +169,15 @@ export function maybeNotifyRecordingStart(dispatch: IStore['dispatch'], getStatedispatch(playSound(soundID));}- // Nudge when only one service was just started AND the other is not already running.- // Only moderators can start the complementary service, so skip the nudge for non-mods.- const nudgeNeeded = isLocalParticipantModerator(state)- && (wantsRecording !== wantsTranscription)- && (wantsRecording ? !transcriptionOn : !recordingOn);+ // Nudge to start the complementary service when only one was just started and the other is not+ // already running — shown to any participant that has the right to start that other service:+ // transcription needs the transcription feature; cloud recording needs moderator + the recording+ // feature. (A recording-only participant is never nudged to transcribe, nor vice versa.)+ const canStartTranscription = canAddTranscriber(state);+ const canStartRecording = isLocalParticipantModerator(state)+ && isJwtFeatureEnabled(state, MEET_FEATURES.RECORDING, false);+ const nudgeNeeded = (wantsRecording !== wantsTranscription)+ && (wantsRecording ? (!transcriptionOn && canStartTranscription) : (!recordingOn && canStartRecording));const nudge = nudgeNeeded? getNudge(wantsRecording ? 'recording' : 'transcription', dispatch): null;