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(recording) add notification to suggest recording at meeting startup (#14296)
Avram Tudor34abd279bee7
diff --git a/config.js b/config.jsindex 885075689a..92409f1149 100644--- a/config.js+++ b/config.js@@ -324,6 +324,13 @@ var config = {// 'https://jitsi-meet.example.com/subfolder/static/oauth.html',// },+ // configuration for all things recording related. Existing settings will be migrated here in the future.+ // recordings: {+ // // If true, shows a notification at the start of the meeting with a call to action button+ // // to start recording (for users who can do so).+ // // suggestRecording: true,+ // },+// recordingService: {// // When integrations like dropbox are enabled only that will be shown,// // by enabling fileRecordingsServiceEnabled, we show both the integrationsdiff --git a/lang/main.json b/lang/main.jsonindex 7d873351f3..0e3ae1271a 100644--- a/lang/main.json+++ b/lang/main.json@@ -802,6 +802,9 @@"startSilentTitle": "You joined with no audio output!","suboptimalBrowserWarning": "We are afraid your meeting experience isn't going to be that great here. We are looking for ways to improve this, but until then please try using one of the <a href='{{recommendedBrowserPageLink}}' target='_blank'>fully supported browsers</a>.","suboptimalExperienceTitle": "Browser Warning",+ "suggestRecordingAction": "Start",+ "suggestRecordingDescription": "Would you like to start a recording?",+ "suggestRecordingTitle": "Record this meeting","unmute": "Unmute","videoMutedRemotelyDescription": "You can always turn it on again.","videoMutedRemotelyTitle": "Your video has been turned off by {{participantDisplayName}}",diff --git a/react/features/base/config/configType.ts b/react/features/base/config/configType.tsindex c8dd864190..339942024a 100644--- a/react/features/base/config/configType.ts+++ b/react/features/base/config/configType.ts@@ -530,6 +530,9 @@ export interface IConfig {sharingEnabled?: boolean;};recordingSharingUrl?: string;+ recordings?: {+ suggestRecording?: boolean;+ };remoteVideoMenu?: {disableGrantModerator?: boolean;disableKick?: boolean;diff --git a/react/features/conference/middleware.any.ts b/react/features/conference/middleware.any.tsindex 970d0320e4..a2c8f5bc10 100644--- a/react/features/conference/middleware.any.ts+++ b/react/features/conference/middleware.any.ts@@ -35,6 +35,7 @@ import {NOTIFICATION_ICON,NOTIFICATION_TIMEOUT_TYPE} from '../notifications/constants';+import { showStartRecordingNotification } from '../recording/actions';import { showSalesforceNotification } from '../salesforce/actions';import { setToolboxEnabled } from '../toolbox/actions.any';@@ -149,6 +150,8 @@ function _conferenceJoined({ dispatch, getState }: IStore) {}dispatch(showSalesforceNotification());+ dispatch(showStartRecordingNotification());+_checkIframe(getState(), dispatch);}diff --git a/react/features/recording/actions.any.ts b/react/features/recording/actions.any.tsindex 1ee7243183..26c4c7cc8c 100644--- a/react/features/recording/actions.any.ts+++ b/react/features/recording/actions.any.ts@@ -1,7 +1,13 @@import { IStore } from '../app/types';import { getMeetingRegion, getRecordingSharingUrl } from '../base/config/functions';+import { isJwtFeatureEnabled } from '../base/jwt/functions';import JitsiMeetJS, { JitsiRecordingConstants } from '../base/lib-jitsi-meet';-import { getLocalParticipant, getParticipantDisplayName } from '../base/participants/functions';+import {+ getLocalParticipant,+ getParticipantDisplayName,+ isLocalParticipantModerator+} from '../base/participants/functions';+import { BUTTON_TYPES } from '../base/ui/constants.any';import { copyText } from '../base/util/copyText';import { getVpaasTenant, isVpaasMeeting } from '../jaas/functions';import {@@ -10,8 +16,9 @@ import {showNotification,showWarningNotification} from '../notifications/actions';-import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';+import { NOTIFICATION_TIMEOUT_TYPE, NOTIFICATION_TYPE } from '../notifications/constants';import { INotificationProps } from '../notifications/types';+import { setRequestingSubtitles } from '../subtitles/actions.any';import {CLEAR_RECORDING_SESSIONS,@@ -23,14 +30,20 @@ import {START_LOCAL_RECORDING,STOP_LOCAL_RECORDING} from './actionTypes';+import { START_RECORDING_NOTIFICATION_ID } from './constants';import {+ getRecordButtonProps,getRecordingLink,getResourceId,+ isRecordingRunning,+ isRecordingSharingEnabled,isSavingRecordingOnDropbox,- sendMeetingHighlight+ sendMeetingHighlight,+ shouldAutoTranscribeOnRecord} from './functions';import logger from './logger';+/*** Clears the data of every recording sessions.*@@ -367,3 +380,67 @@ export function stopLocalVideoRecording() {type: STOP_LOCAL_RECORDING};}++/**+ * Displays the notification suggesting to start the recording.+ *+ * @param {Function} openRecordingDialog - The callback to open the recording dialog.+ * @returns {void}+ */+export function showStartRecordingNotificationWithCallback(openRecordingDialog: Function) {+ return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {+ const state = getState();+ const { recordings } = state['features/base/config'];+ const { suggestRecording } = recordings || {};+ const recordButtonProps = getRecordButtonProps(state);+ const isAlreadyRecording = isRecordingRunning(state);++ if (!suggestRecording+ || isAlreadyRecording+ || !recordButtonProps.visible+ || recordButtonProps.disabled) {+ return;+ }++ dispatch(showNotification({+ titleKey: 'notify.suggestRecordingTitle',+ descriptionKey: 'notify.suggestRecordingDescription',+ uid: START_RECORDING_NOTIFICATION_ID,+ customActionType: [ BUTTON_TYPES.PRIMARY ],+ customActionNameKey: [ 'notify.suggestRecordingAction' ],+ customActionHandler: [ () => {+ const isModerator = isLocalParticipantModerator(state);+ const { recordingService } = state['features/base/config'];++ const canBypassDialog = isModerator+ && recordingService?.enabled+ && isJwtFeatureEnabled(state, 'recording', true);++ if (canBypassDialog) {+ const options = {+ 'file_recording_metadata': {+ share: isRecordingSharingEnabled(state)+ }+ };++ const { conference } = state['features/base/conference'];+ const autoTranscribeOnRecord = shouldAutoTranscribeOnRecord(state);++ conference?.startRecording({+ mode: JitsiRecordingConstants.mode.FILE,+ appData: JSON.stringify(options)+ });++ if (autoTranscribeOnRecord) {+ dispatch(setRequestingSubtitles(true, false));+ }+ } else {+ openRecordingDialog();+ }++ dispatch(hideNotification(START_RECORDING_NOTIFICATION_ID));+ } ],+ appearance: NOTIFICATION_TYPE.NORMAL+ }, NOTIFICATION_TIMEOUT_TYPE.MEDIUM));+ };+}diff --git a/react/features/recording/actions.native.ts b/react/features/recording/actions.native.tsindex 9401e8311b..22917f9ad4 100644--- a/react/features/recording/actions.native.ts+++ b/react/features/recording/actions.native.ts@@ -1,9 +1,12 @@import { IStore } from '../app/types';import { openSheet } from '../base/dialog/actions';import JitsiMeetJS from '../base/lib-jitsi-meet';+import { navigate } from '../mobile/navigation/components/conference/ConferenceNavigationContainerRef';+import { screen } from '../mobile/navigation/routes';import { showNotification } from '../notifications/actions';import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';+import { showStartRecordingNotificationWithCallback } from './actions.any';import HighlightDialog from './components/Recording/native/HighlightDialog';export * from './actions.any';@@ -54,3 +57,16 @@ export function showRecordingLimitNotification(streamType: string) {}, NOTIFICATION_TIMEOUT_TYPE.LONG));};}++/**+ * Displays the notification suggesting to start the recording.+ *+ * @returns {void}+ */+export function showStartRecordingNotification() {+ return (dispatch: IStore['dispatch']) => {+ const openDialogCallback = () => navigate(screen.conference.recording);++ dispatch(showStartRecordingNotificationWithCallback(openDialogCallback));+ };+}diff --git a/react/features/recording/actions.web.tsx b/react/features/recording/actions.web.tsxindex d2df21bfd7..3cbeddc432 100644--- a/react/features/recording/actions.web.tsx+++ b/react/features/recording/actions.web.tsx@@ -1,9 +1,13 @@import React from 'react';+import { IStore } from '../app/types';+import { openDialog } from '../base/dialog/actions';import JitsiMeetJS from '../base/lib-jitsi-meet';import { showNotification } from '../notifications/actions';import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';+import { showStartRecordingNotificationWithCallback } from './actions.any';+import { StartRecordingDialog } from './components/Recording';import RecordingLimitNotificationDescription from './components/web/RecordingLimitNotificationDescription';export * from './actions.any';@@ -24,3 +28,16 @@ export function showRecordingLimitNotification(streamType: string) {titleKey: isLiveStreaming ? 'dialog.liveStreaming' : 'dialog.recording'}, NOTIFICATION_TIMEOUT_TYPE.LONG);}++/**+ * Displays the notification suggesting to start the recording.+ *+ * @returns {void}+ */+export function showStartRecordingNotification() {+ return (dispatch: IStore['dispatch']) => {+ const openDialogCallback = () => dispatch(openDialog(StartRecordingDialog));++ dispatch(showStartRecordingNotificationWithCallback(openDialogCallback));+ };+}diff --git a/react/features/recording/components/Recording/AbstractRecordButton.ts b/react/features/recording/components/Recording/AbstractRecordButton.tsindex 0f7a0f08d2..d8dfb7dbe8 100644--- a/react/features/recording/components/Recording/AbstractRecordButton.ts+++ b/react/features/recording/components/Recording/AbstractRecordButton.ts@@ -6,9 +6,7 @@ import { MEET_FEATURES } from '../../../base/jwt/constants';import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';import { maybeShowPremiumFeatureDialog } from '../../../jaas/actions';-import { getActiveSession, getRecordButtonProps } from '../../functions';--import LocalRecordingManager from './LocalRecordingManager';+import { getRecordButtonProps, isRecordingRunning } from '../../functions';/*** The type of the React {@code Component} props of@@ -125,7 +123,6 @@ export default class AbstractRecordButton<P extends IProps> extends AbstractButt* }}*/export function _mapStateToProps(state: IReduxState) {- const _isTranscribing = state['features/transcribing'].isTranscribing;const {disabled: _disabled,tooltip: _tooltip,@@ -134,8 +131,7 @@ export function _mapStateToProps(state: IReduxState) {return {_disabled,- _isRecordingRunning: Boolean(getActiveSession(state, JitsiRecordingConstants.mode.FILE))- || LocalRecordingManager.isRecordingLocally() || _isTranscribing,+ _isRecordingRunning: isRecordingRunning(state),_tooltip,visible};diff --git a/react/features/recording/components/Recording/AbstractStartRecordingDialog.ts b/react/features/recording/components/Recording/AbstractStartRecordingDialog.tsindex 4ed01c4c24..b97c8a8ddc 100644--- a/react/features/recording/components/Recording/AbstractStartRecordingDialog.ts+++ b/react/features/recording/components/Recording/AbstractStartRecordingDialog.ts@@ -13,7 +13,7 @@ import { NOTIFICATION_TIMEOUT_TYPE } from '../../../notifications/constants';import { setRequestingSubtitles } from '../../../subtitles/actions.any';import { setSelectedRecordingService, startLocalVideoRecording } from '../../actions';import { RECORDING_TYPES } from '../../constants';-import { supportsLocalRecording } from '../../functions';+import { isRecordingSharingEnabled, shouldAutoTranscribeOnRecord, supportsLocalRecording } from '../../functions';export interface IProps extends WithTranslation {@@ -444,7 +444,6 @@ class AbstractStartRecordingDialog extends Component<IProps, IState> {*/export function mapStateToProps(state: IReduxState, _ownProps: any) {const {- transcription,recordingService,dropbox = { appKey: undefined },localRecording@@ -452,10 +451,10 @@ export function mapStateToProps(state: IReduxState, _ownProps: any) {return {_appKey: dropbox.appKey ?? '',- _autoTranscribeOnRecord: transcription?.autoTranscribeOnRecord ?? false,+ _autoTranscribeOnRecord: shouldAutoTranscribeOnRecord(state),_conference: state['features/base/conference'].conference,_fileRecordingsServiceEnabled: recordingService?.enabled ?? false,- _fileRecordingsServiceSharingEnabled: recordingService?.sharingEnabled ?? false,+ _fileRecordingsServiceSharingEnabled: isRecordingSharingEnabled(state),_isDropboxEnabled: isDropboxEnabled(state),_localRecordingEnabled: !localRecording?.disable,_rToken: state['features/dropbox'].rToken ?? '',diff --git a/react/features/recording/constants.ts b/react/features/recording/constants.tsindex f041996d7d..8384bd559e 100644--- a/react/features/recording/constants.ts+++ b/react/features/recording/constants.ts@@ -58,3 +58,5 @@ export const RECORDING_STATUS_PRIORITIES = [JitsiRecordingConstants.status.PENDING,JitsiRecordingConstants.status.ON];++export const START_RECORDING_NOTIFICATION_ID = 'START_RECORDING_NOTIFICATION_ID';diff --git a/react/features/recording/functions.ts b/react/features/recording/functions.tsindex fb6ed732ee..e28a1eedf6 100644--- a/react/features/recording/functions.ts+++ b/react/features/recording/functions.ts@@ -158,6 +158,46 @@ export function supportsLocalRecording() {&& navigator.product !== 'ReactNative';}+/**+ * Returns true if there is a recording session running.+ *+ * @param {Object} state - The redux state to search in.+ * @returns {boolean}+ */+export function isRecordingRunning(state: IReduxState) {+ const { isTranscribing } = state['features/transcribing'];++ return (+ Boolean(getActiveSession(state, JitsiRecordingConstants.mode.FILE))+ || LocalRecordingManager.isRecordingLocally()+ || isTranscribing+ );+}++/**+ * Returns whether the transcription should start automatically when recording starts.+ *+ * @param {Object} state - The redux state to search in.+ * @returns {boolean}+ */+export function shouldAutoTranscribeOnRecord(state: IReduxState) {+ const { transcription } = state['features/base/config'];++ return transcription?.autoTranscribeOnRecord ?? true;+}++/**+ * Returns whether the recording should be shared.+ *+ * @param {Object} state - The redux state to search in.+ * @returns {boolean}+ */+export function isRecordingSharingEnabled(state: IReduxState) {+ const { recordingService } = state['features/base/config'];++ return recordingService?.sharingEnabled ?? false;+}+/*** Returns the recording button props.*diff --git a/react/features/recording/middleware.ts b/react/features/recording/middleware.tsindex 63597a0776..8a4b908876 100644--- a/react/features/recording/middleware.ts+++ b/react/features/recording/middleware.ts@@ -18,7 +18,7 @@ import {stopSound} from '../base/sounds/actions';import { TRACK_ADDED } from '../base/tracks/actionTypes';-import { showErrorNotification, showNotification } from '../notifications/actions';+import { hideNotification, showErrorNotification, showNotification } from '../notifications/actions';import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';import { RECORDING_SESSION_UPDATED, START_LOCAL_RECORDING, STOP_LOCAL_RECORDING } from './actionTypes';@@ -38,7 +38,8 @@ import {LIVE_STREAMING_OFF_SOUND_ID,LIVE_STREAMING_ON_SOUND_ID,RECORDING_OFF_SOUND_ID,- RECORDING_ON_SOUND_ID+ RECORDING_ON_SOUND_ID,+ START_RECORDING_NOTIFICATION_ID} from './constants';import {getResourceId,@@ -195,6 +196,7 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => async action =>if (updatedSessionData?.status === PENDING&& (!oldSessionData || oldSessionData.status !== PENDING)) {dispatch(showPendingRecordingNotification(mode));+ dispatch(hideNotification(START_RECORDING_NOTIFICATION_ID));} else if (updatedSessionData?.status !== PENDING) {dispatch(hidePendingRecordingNotification(mode));