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(transcribing): Switch state on audio-recording-enabled. (#16094)

Дамян Минковdb4c9666c37f
diff --git a/react/features/base/conference/functions.ts b/react/features/base/conference/functions.ts
index ba87d3f4e1..4fe7c7fb07 100644
--- a/react/features/base/conference/functions.ts
+++ b/react/features/base/conference/functions.ts
@@ -394,19 +394,6 @@ export function isP2pActive(stateful: IStateful): boolean | null {
return conference.isP2PActive();
}
-/**
- * Returns whether the current conference has audio recording property which is on.
- *
- * @param {IStateful} stateful - The redux store, state, or {@code getState} function.
- * @returns {boolean|null}
- */
-export function isConferenceAudioRecordingOn(stateful: IStateful): boolean | null {
- const state = getConferenceState(toState(stateful));
-
- // @ts-ignore
- return state.properties?.['audio-recording-enabled'] === 'true';
-}
-
/**
* Returns the stored room name.
*
diff --git a/react/features/transcribing/reducer.ts b/react/features/transcribing/reducer.ts
index 07166139f4..1d65a268ab 100644
--- a/react/features/transcribing/reducer.ts
+++ b/react/features/transcribing/reducer.ts
@@ -4,6 +4,7 @@ import {
TRANSCRIBER_JOINED,
TRANSCRIBER_LEFT
} from './actionTypes';
+import { CONFERENCE_PROPERTIES_CHANGED } from '../base/conference/actionTypes';
/**
* Returns initial state for transcribing feature part of Redux store.
@@ -44,6 +45,18 @@ export interface ITranscribingState {
ReducerRegistry.register<ITranscribingState>('features/transcribing',
(state = _getInitialState(), action): ITranscribingState => {
switch (action.type) {
+ case CONFERENCE_PROPERTIES_CHANGED: {
+ const audioRecordingEnabled = action.properties?.['audio-recording-enabled'] === 'true';
+
+ if (state.isTranscribing !== audioRecordingEnabled) {
+ return {
+ ...state,
+ isTranscribing: audioRecordingEnabled
+ };
+ }
+
+ return state;
+ }
case TRANSCRIBER_JOINED:
return {
...state,
diff --git a/react/features/transcribing/subscriber.ts b/react/features/transcribing/subscriber.ts
index 63f083ec12..def132b861 100644
--- a/react/features/transcribing/subscriber.ts
+++ b/react/features/transcribing/subscriber.ts
@@ -1,7 +1,6 @@
import { batch } from 'react-redux';
import { IStore } from '../app/types';
-import { isConferenceAudioRecordingOn } from '../base/conference/functions';
import { JitsiRecordingConstants } from '../base/lib-jitsi-meet';
import StateListenerRegistry from '../base/redux/StateListenerRegistry';
import { playSound } from '../base/sounds/actions';
@@ -29,16 +28,6 @@ StateListenerRegistry.register(
}
);
-/**
- * Listens for audio-recording-enabled conference property change.
- */
-StateListenerRegistry.register(
- /* selector */ isConferenceAudioRecordingOn,
- /* listener */ (audioRecordingOn, { getState, dispatch }) => {
- maybeEmitRecordingNotification(dispatch, getState, audioRecordingOn);
- }
-);
-
/**
* Emit a recording started / stopped notification if the transcription started / stopped. Only
* if there is no recording in progress.