Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(recorder-transcription): Handle correctly in the UI.

Hristo Terezov05aa48774a19
diff --git a/react/features/recording/actions.any.ts b/react/features/recording/actions.any.ts
index 566a47a8d7..ac100252ac 100644
--- a/react/features/recording/actions.any.ts
+++ b/react/features/recording/actions.any.ts
@@ -19,6 +19,7 @@ import {
import { NOTIFICATION_TIMEOUT_TYPE, NOTIFICATION_TYPE } from '../notifications/constants';
import { INotificationProps } from '../notifications/types';
import { setRequestingSubtitles } from '../subtitles/actions.any';
+import { isRecorderTranscriptionsRunning } from '../transcribing/functions';
import {
CLEAR_RECORDING_SESSIONS,
@@ -36,7 +37,7 @@ import {
getRecordButtonProps,
getRecordingLink,
getResourceId,
- isRecordingOrTranscribingRunning,
+ isRecordingRunning,
isRecordingSharingEnabled,
isSavingRecordingOnDropbox,
sendMeetingHighlight,
@@ -408,7 +409,7 @@ export function showStartRecordingNotificationWithCallback(openRecordingDialog:
const { recordings } = state['features/base/config'];
const { suggestRecording } = recordings || {};
const recordButtonProps = getRecordButtonProps(state);
- const isAlreadyRecording = isRecordingOrTranscribingRunning(state);
+ const isAlreadyRecording = isRecordingRunning(state) || isRecorderTranscriptionsRunning(state);
const wasNotificationShown = state['features/recording'].wasStartRecordingSuggested;
if (!suggestRecording
diff --git a/react/features/recording/components/AbstractRecordingLabel.ts b/react/features/recording/components/AbstractRecordingLabel.ts
index d9ae1df728..0dc4a90fc2 100644
--- a/react/features/recording/components/AbstractRecordingLabel.ts
+++ b/react/features/recording/components/AbstractRecordingLabel.ts
@@ -3,8 +3,12 @@ import { WithTranslation } from 'react-i18next';
import { IReduxState } from '../../app/types';
import { JitsiRecordingConstants } from '../../base/lib-jitsi-meet';
-import { isTranscribing } from '../../transcribing/functions';
-import { getActiveSession, getSessionStatusToShow, isRecordingRunning } from '../functions';
+import { isRecorderTranscriptionsRunning } from '../../transcribing/functions';
+import {
+ getActiveSession,
+ getSessionStatusToShow,
+ isRecordingRunning
+} from '../functions';
export interface IProps extends WithTranslation {
@@ -75,11 +79,11 @@ export default class AbstractRecordingLabel<P extends IProps = IProps> extends C
export function _mapStateToProps(state: IReduxState, ownProps: any) {
const { mode } = ownProps;
const isLiveStreamingLabel = mode === JitsiRecordingConstants.mode.STREAM;
- const _isTranscribing = isTranscribing(state);
+ const _isTranscribing = isRecorderTranscriptionsRunning(state);
const isLivestreamingRunning = Boolean(getActiveSession(state, JitsiRecordingConstants.mode.STREAM));
const _isVisible = isLiveStreamingLabel
? isLivestreamingRunning // this is the livestreaming label
- : isRecordingRunning(state) || (_isTranscribing && !isLivestreamingRunning); // this is the recording label
+ : isRecordingRunning(state) || _isTranscribing; // this is the recording label
return {
_isVisible,
diff --git a/react/features/recording/components/LiveStream/AbstractLiveStreamButton.ts b/react/features/recording/components/LiveStream/AbstractLiveStreamButton.ts
index 43aad82978..d3b93b5407 100644
--- a/react/features/recording/components/LiveStream/AbstractLiveStreamButton.ts
+++ b/react/features/recording/components/LiveStream/AbstractLiveStreamButton.ts
@@ -7,6 +7,7 @@ import { isLocalParticipantModerator } from '../../../base/participants/function
import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
import { isInBreakoutRoom } from '../../../breakout-rooms/functions';
import { maybeShowPremiumFeatureDialog } from '../../../jaas/actions';
+import { isRecorderTranscriptionsRunning } from '../../../transcribing/functions';
import { getActiveSession, isCloudRecordingRunning } from '../../functions';
import { getLiveStreaming } from './functions';
@@ -140,7 +141,7 @@ export function _mapStateToProps(state: IReduxState, ownProps: IProps) {
}
// disable the button if the recording is running.
- if (visible && isCloudRecordingRunning(state)) {
+ if (visible && (isCloudRecordingRunning(state) || isRecorderTranscriptionsRunning(state))) {
_disabled = true;
_tooltip = 'dialog.liveStreamingDisabledBecauseOfActiveRecordingTooltip';
}
diff --git a/react/features/recording/components/native/RecordingExpandedLabel.ts b/react/features/recording/components/native/RecordingExpandedLabel.ts
index b8d2991bf3..b4b14bb564 100644
--- a/react/features/recording/components/native/RecordingExpandedLabel.ts
+++ b/react/features/recording/components/native/RecordingExpandedLabel.ts
@@ -4,7 +4,7 @@ import { IReduxState } from '../../../app/types';
import { translate } from '../../../base/i18n/functions';
import ExpandedLabel, { IProps as AbstractProps } from '../../../base/label/components/native/ExpandedLabel';
import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
-import { isTranscribing } from '../../../transcribing/functions';
+import { isRecorderTranscriptionsRunning } from '../../../transcribing/functions';
import { getSessionStatusToShow } from '../../functions';
interface IProps extends AbstractProps {
@@ -91,7 +91,7 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {
const { mode } = ownProps;
return {
- _isTranscribing: isTranscribing(state),
+ _isTranscribing: isRecorderTranscriptionsRunning(state),
_status: getSessionStatusToShow(state, mode)
};
}
diff --git a/react/features/recording/functions.ts b/react/features/recording/functions.ts
index 1b63cb9a88..bb8f6c790d 100644
--- a/react/features/recording/functions.ts
+++ b/react/features/recording/functions.ts
@@ -14,7 +14,7 @@ import { registerSound, unregisterSound } from '../base/sounds/actions';
import { isInBreakoutRoom } from '../breakout-rooms/functions';
import { isEnabled as isDropboxEnabled } from '../dropbox/functions';
import { extractFqnFromPath } from '../dynamic-branding/functions.any';
-import { isTranscribing } from '../transcribing/functions';
+import { isRecorderTranscriptionsRunning } from '../transcribing/functions';
import LocalRecordingManager from './components/Recording/LocalRecordingManager';
import {
@@ -182,16 +182,6 @@ export function isRecordingRunning(state: IReduxState) {
);
}
-/**
- * Returns true if there is a recording or transcribing session running.
- *
- * @param {Object} state - The redux state to search in.
- * @returns {boolean}
- */
-export function isRecordingOrTranscribingRunning(state: IReduxState) {
- return isRecordingRunning(state) || isTranscribing(state);
-}
-
/**
* Returns true if the participant can stop recording.
*
@@ -199,7 +189,7 @@ export function isRecordingOrTranscribingRunning(state: IReduxState) {
* @returns {boolean}
*/
export function canStopRecording(state: IReduxState) {
- if (!isRecordingOrTranscribingRunning(state)) {
+ if (!isRecordingRunning(state) && !isRecorderTranscriptionsRunning(state)) {
return false;
}
@@ -207,7 +197,7 @@ export function canStopRecording(state: IReduxState) {
return true;
}
- if (isCloudRecordingRunning(state) || isTranscribing(state)) {
+ if (isCloudRecordingRunning(state) || isRecorderTranscriptionsRunning(state)) {
return isLocalParticipantModerator(state) && isJwtFeatureEnabled(state, 'recording', true);
}
diff --git a/react/features/recording/middleware.ts b/react/features/recording/middleware.ts
index e127d69b0c..a82828ffb4 100644
--- a/react/features/recording/middleware.ts
+++ b/react/features/recording/middleware.ts
@@ -22,7 +22,7 @@ import {
import { TRACK_ADDED } from '../base/tracks/actionTypes';
import { hideNotification, showErrorNotification, showNotification } from '../notifications/actions';
import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';
-import { isTranscribing } from '../transcribing/functions';
+import { isRecorderTranscriptionsRunning } from '../transcribing/functions';
import { RECORDING_SESSION_UPDATED, START_LOCAL_RECORDING, STOP_LOCAL_RECORDING } from './actionTypes';
import {
@@ -226,7 +226,7 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => async action =>
let soundID;
- if (mode === JitsiRecordingConstants.mode.FILE && !isTranscribing(state)) {
+ if (mode === JitsiRecordingConstants.mode.FILE && !isRecorderTranscriptionsRunning(state)) {
soundID = RECORDING_ON_SOUND_ID;
} else if (mode === JitsiRecordingConstants.mode.STREAM) {
soundID = LIVE_STREAMING_ON_SOUND_ID;
@@ -255,7 +255,7 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => async action =>
}
sendAnalytics(createRecordingEvent('stop', mode, duration));
- if (mode === JitsiRecordingConstants.mode.FILE && !isTranscribing(state)) {
+ if (mode === JitsiRecordingConstants.mode.FILE && !isRecorderTranscriptionsRunning(state)) {
soundOff = RECORDING_OFF_SOUND_ID;
soundOn = RECORDING_ON_SOUND_ID;
} else if (mode === JitsiRecordingConstants.mode.STREAM) {
diff --git a/react/features/transcribing/functions.ts b/react/features/transcribing/functions.ts
index 81af386d90..430dfa9a64 100644
--- a/react/features/transcribing/functions.ts
+++ b/react/features/transcribing/functions.ts
@@ -56,6 +56,19 @@ export function isTranscribing(state: IReduxState) {
return state['features/transcribing'].isTranscribing;
}
+/**
+ * Returns true if there is a recorder transcription session running.
+ * NOTE: If only the subtitles are running this function will return false.
+ *
+ * @param {Object} state - The redux state to search in.
+ * @returns {boolean}
+ */
+export function isRecorderTranscriptionsRunning(state: IReduxState) {
+ const { metadata } = state['features/base/conference'];
+
+ return isTranscribing(state) && Boolean(metadata?.recording?.isTranscribingEnabled);
+}
+
/**
* Checks whether the participant can start the transcription.
*
diff --git a/react/features/transcribing/middleware.ts b/react/features/transcribing/middleware.ts
index b632508f59..7f0dba08e4 100644
--- a/react/features/transcribing/middleware.ts
+++ b/react/features/transcribing/middleware.ts
@@ -1,30 +1,16 @@
-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,
- _TRANSCRIBER_LEFT
-} from './actionTypes';
import {
potentialTranscriberJoined,
transcriberJoined,
transcriberLeft
} from './actions';
+import './subscriber';
const TRANSCRIBER_DISPLAY_NAME = 'Transcriber';
@@ -42,16 +28,6 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
} = getState()['features/transcribing'];
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:
if (action.displayName === TRANSCRIBER_DISPLAY_NAME) {
dispatch(transcriberJoined(action.id));
@@ -79,44 +55,3 @@ 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 { mode: modeConstants, status: statusConstants } = JitsiRecordingConstants;
-
- if (sessionDatas.some(sd => sd.mode === modeConstants.FILE && sd.status === statusConstants.ON)) {
- // 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.
- *
- * @param {boolean} on - True if transcribing is on, false otherwise.
- * @returns {void}
- */
-function notifyTranscribingStatusChanged(on: boolean) {
- if (typeof APP !== 'undefined') {
- APP.API.notifyTranscribingStatusChanged(on);
- }
-}
diff --git a/react/features/transcribing/subscriber.ts b/react/features/transcribing/subscriber.ts
new file mode 100644
index 0000000000..807ee5adb9
--- /dev/null
+++ b/react/features/transcribing/subscriber.ts
@@ -0,0 +1,68 @@
+import { batch } from 'react-redux';
+
+import { IStore } from '../app/types';
+import { JitsiRecordingConstants } from '../base/lib-jitsi-meet';
+import StateListenerRegistry from '../base/redux/StateListenerRegistry';
+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 { isRecorderTranscriptionsRunning } from './functions';
+
+/**
+ * Listens for large video participant ID changes.
+ */
+StateListenerRegistry.register(
+ /* selector */ isRecorderTranscriptionsRunning,
+ /* listener */ (isRecorderTranscriptionsRunningValue, { getState, dispatch }) => {
+ if (isRecorderTranscriptionsRunningValue) {
+ notifyTranscribingStatusChanged(true);
+ maybeEmitRecordingNotification(dispatch, getState, true);
+ } else {
+ notifyTranscribingStatusChanged(false);
+ maybeEmitRecordingNotification(dispatch, getState, false);
+ }
+ }
+);
+
+/**
+ * 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 { mode: modeConstants, status: statusConstants } = JitsiRecordingConstants;
+
+ if (sessionDatas.some(sd => sd.mode === modeConstants.FILE && sd.status === statusConstants.ON)) {
+ // 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.
+ *
+ * @param {boolean} on - True if transcribing is on, false otherwise.
+ * @returns {void}
+ */
+function notifyTranscribingStatusChanged(on: boolean) {
+ if (typeof APP !== 'undefined') {
+ APP.API.notifyTranscribingStatusChanged(on);
+ }
+}