Skip to content

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

fix(recording) do not show stop recording option in some wrong cases

Avram Tudor583725bf310c
diff --git a/react/features/recording/components/Recording/AbstractRecordButton.ts b/react/features/recording/components/Recording/AbstractRecordButton.ts
index d8dfb7dbe8..dd434fc343 100644
--- a/react/features/recording/components/Recording/AbstractRecordButton.ts
+++ b/react/features/recording/components/Recording/AbstractRecordButton.ts
@@ -6,7 +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 { getRecordButtonProps, isRecordingRunning } from '../../functions';
+import { canStopRecording, getRecordButtonProps } from '../../functions';
/**
* The type of the React {@code Component} props of
@@ -131,7 +131,7 @@ export function _mapStateToProps(state: IReduxState) {
return {
_disabled,
- _isRecordingRunning: isRecordingRunning(state),
+ _isRecordingRunning: canStopRecording(state),
_tooltip,
visible
};
diff --git a/react/features/recording/functions.ts b/react/features/recording/functions.ts
index 2736196060..d241db8d2c 100644
--- a/react/features/recording/functions.ts
+++ b/react/features/recording/functions.ts
@@ -183,6 +183,28 @@ export function isRecordingRunning(state: IReduxState) {
);
}
+/**
+ * Returns true if the participant can stop recording.
+ *
+ * @param {Object} state - The redux state to search in.
+ * @returns {boolean}
+ */
+export function canStopRecording(state: IReduxState) {
+ if (!isRecordingRunning(state)) {
+ return false;
+ }
+
+ if (LocalRecordingManager.isRecordingLocally()) {
+ return true;
+ }
+
+ if (isCloudRecordingRunning(state) || isTranscribing(state)) {
+ return isLocalParticipantModerator(state) && isJwtFeatureEnabled(state, 'recording', true);
+ }
+
+ return false;
+}
+
/**
* Returns whether the transcription should start automatically when recording starts.
*