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(transcribing) emit recording notifications for transcriptions
Saúl Ibarra Corretgé6e6433e2d9e7
diff --git a/react/features/transcribing/middleware.ts b/react/features/transcribing/middleware.tsindex faba4ed5d4..78c00324e3 100644--- a/react/features/transcribing/middleware.ts+++ b/react/features/transcribing/middleware.ts@@ -1,9 +1,20 @@+import { batch } from 'react-redux';++import { IStore } from '../app/types';+import { JitsiRecordingConstants } from '../base/lib-jitsi-meet';import {HIDDEN_PARTICIPANT_JOINED,HIDDEN_PARTICIPANT_LEFT,PARTICIPANT_UPDATED} from '../base/participants/actionTypes';import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';+import { playSound } from '../base/sounds/actions';+import { showNotification } from '../notifications/actions';+import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';+import {+ RECORDING_OFF_SOUND_ID,+ RECORDING_ON_SOUND_ID+} from '../recording/constants';import {_TRANSCRIBER_JOINED,@@ -33,10 +44,12 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {switch (action.type) {case _TRANSCRIBER_JOINED:notifyTranscribingStatusChanged(true);+ maybeEmitRecordingNotification(dispatch, getState, true);break;case _TRANSCRIBER_LEFT:notifyTranscribingStatusChanged(false);+ maybeEmitRecordingNotification(dispatch, getState, false);break;case HIDDEN_PARTICIPANT_JOINED:@@ -67,6 +80,35 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {return next(action);});+/**+ * Emit a recording started / stopped notification if the transcription started / stopped. Only+ * if there is no recording in progress.+ *+ * @param {Dispatch} dispatch - The Redux dispatch function.+ * @param {Function} getState - The Redux state.+ * @param {boolean} on - Whether the transcription is on or not.+ *+ * @returns {void}+ */+function maybeEmitRecordingNotification(dispatch: IStore['dispatch'], getState: IStore['getState'], on: boolean) {+ const state = getState();+ const { sessionDatas } = state['features/recording'];+ const { status: statusConstants } = JitsiRecordingConstants;++ if (sessionDatas.some(sd => sd.mode !== statusConstants.OFF)) {+ // If a recording is still ongoing, don't send any notification.+ return;+ }++ batch(() => {+ dispatch(showNotification({+ descriptionKey: on ? 'recording.on' : 'recording.off',+ titleKey: 'dialog.recording'+ }, NOTIFICATION_TIMEOUT_TYPE.SHORT));+ dispatch(playSound(on ? RECORDING_ON_SOUND_ID : RECORDING_OFF_SOUND_ID));+ });+}+/*** Notify external application (if API is enabled) that transcribing has started or stopped.*