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(subtitles) keep subtitles state when recording

Saúl Ibarra Corretgéa6f6b3a2d2e5
diff --git a/react/features/recording/components/Recording/AbstractStartRecordingDialog.ts b/react/features/recording/components/Recording/AbstractStartRecordingDialog.ts
index f5a3c35694..be09cf06ca 100644
--- a/react/features/recording/components/Recording/AbstractStartRecordingDialog.ts
+++ b/react/features/recording/components/Recording/AbstractStartRecordingDialog.ts
@@ -32,6 +32,11 @@ export interface IProps extends WithTranslation {
*/
_conference?: IJitsiConference;
+ /**
+ * Whether subtitles should be displayed or not.
+ */
+ _displaySubtitles?: boolean;
+
/**
* Whether to show file recordings service, even if integrations
* are enabled.
@@ -69,6 +74,11 @@ export interface IProps extends WithTranslation {
*/
_screenshotCaptureEnabled: boolean;
+ /**
+ * The selected language for subtitles.
+ */
+ _subtitlesLanguage: string | null;
+
/**
* The dropbox access token.
*/
@@ -336,8 +346,10 @@ class AbstractStartRecordingDialog extends Component<IProps, IState> {
const {
_appKey,
_conference,
+ _displaySubtitles,
_isDropboxEnabled,
_rToken,
+ _subtitlesLanguage,
_token,
dispatch
} = this.props;
@@ -399,7 +411,7 @@ class AbstractStartRecordingDialog extends Component<IProps, IState> {
if (this.state.selectedRecordingService === RECORDING_TYPES.JITSI_REC_SERVICE
&& this.state.shouldRecordTranscription) {
- dispatch(setRequestingSubtitles(true, false, null));
+ dispatch(setRequestingSubtitles(true, _displaySubtitles, _subtitlesLanguage));
}
_conference?.getMetadataHandler().setMetadata(RECORDING_METADATA_ID, {
@@ -434,17 +446,7 @@ class AbstractStartRecordingDialog extends Component<IProps, IState> {
* @param {Object} state - The Redux state.
* @param {any} _ownProps - Component's own props.
* @private
- * @returns {{
- * _appKey: string,
- * _autoTranscribeOnRecord: boolean,
- * _conference: JitsiConference,
- * _fileRecordingsServiceEnabled: boolean,
- * _fileRecordingsServiceSharingEnabled: boolean,
- * _isDropboxEnabled: boolean,
- * _rToken:string,
- * _tokenExpireDate: number,
- * _token: string
- * }}
+ * @returns {IProps}
*/
export function mapStateToProps(state: IReduxState, _ownProps: any) {
const {
@@ -452,16 +454,22 @@ export function mapStateToProps(state: IReduxState, _ownProps: any) {
dropbox = { appKey: undefined },
localRecording
} = state['features/base/config'];
+ const {
+ _displaySubtitles,
+ _language: _subtitlesLanguage
+ } = state['features/subtitles'];
return {
_appKey: dropbox.appKey ?? '',
_autoTranscribeOnRecord: shouldAutoTranscribeOnRecord(state),
_conference: state['features/base/conference'].conference,
+ _displaySubtitles,
_fileRecordingsServiceEnabled: recordingService?.enabled ?? false,
_fileRecordingsServiceSharingEnabled: isRecordingSharingEnabled(state),
_isDropboxEnabled: isDropboxEnabled(state),
_localRecordingEnabled: !localRecording?.disable,
_rToken: state['features/dropbox'].rToken ?? '',
+ _subtitlesLanguage,
_tokenExpireDate: state['features/dropbox'].expireDate,
_token: state['features/dropbox'].token ?? ''
};
diff --git a/react/features/recording/components/Recording/AbstractStopRecordingDialog.ts b/react/features/recording/components/Recording/AbstractStopRecordingDialog.ts
index 22575091a8..3b9fe832c3 100644
--- a/react/features/recording/components/Recording/AbstractStopRecordingDialog.ts
+++ b/react/features/recording/components/Recording/AbstractStopRecordingDialog.ts
@@ -26,6 +26,11 @@ export interface IProps extends WithTranslation {
*/
_conference?: IJitsiConference;
+ /**
+ * Whether subtitles should be displayed or not.
+ */
+ _displaySubtitles?: boolean;
+
/**
* The redux representation of the recording session to be stopped.
*/
@@ -36,6 +41,11 @@ export interface IProps extends WithTranslation {
*/
_localRecording: boolean;
+ /**
+ * The selected language for subtitles.
+ */
+ _subtitlesLanguage: string | null;
+
/**
* The redux dispatch function.
*/
@@ -77,22 +87,28 @@ export default class AbstractStopRecordingDialog<P extends IProps>
_onSubmit() {
sendAnalytics(createRecordingDialogEvent('stop', 'confirm.button'));
- if (this.props._localRecording) {
- this.props.dispatch(stopLocalVideoRecording());
- if (this.props.localRecordingVideoStop) {
- this.props.dispatch(setVideoMuted(true));
- }
- } else {
- const { _fileRecordingSession } = this.props;
-
- if (_fileRecordingSession) {
- this.props._conference?.stopRecording(_fileRecordingSession.id);
- this._toggleScreenshotCapture();
+ const {
+ _conference,
+ _displaySubtitles,
+ _fileRecordingSession,
+ _localRecording,
+ _subtitlesLanguage,
+ dispatch,
+ localRecordingVideoStop
+ } = this.props;
+
+ if (_localRecording) {
+ dispatch(stopLocalVideoRecording());
+ if (localRecordingVideoStop) {
+ dispatch(setVideoMuted(true));
}
+ } else if (_fileRecordingSession) {
+ _conference?.stopRecording(_fileRecordingSession.id);
+ this._toggleScreenshotCapture();
}
// TODO: this should be an action in transcribing. -saghul
- this.props.dispatch(setRequestingSubtitles(false, false, null));
+ this.props.dispatch(setRequestingSubtitles(Boolean(_displaySubtitles), _displaySubtitles, _subtitlesLanguage));
this.props._conference?.getMetadataHandler().setMetadata(RECORDING_METADATA_ID, {
isTranscribingEnabled: false
@@ -117,16 +133,20 @@ export default class AbstractStopRecordingDialog<P extends IProps>
*
* @param {Object} state - The Redux state.
* @private
- * @returns {{
- * _conference: JitsiConference,
- * _fileRecordingSession: Object
- * }}
+ * @returns {IProps}
*/
export function _mapStateToProps(state: IReduxState) {
+ const {
+ _displaySubtitles,
+ _language: _subtitlesLanguage
+ } = state['features/subtitles'];
+
return {
_conference: state['features/base/conference'].conference,
+ _displaySubtitles,
_fileRecordingSession:
getActiveSession(state, JitsiRecordingConstants.mode.FILE),
- _localRecording: LocalRecordingManager.isRecordingLocally()
+ _localRecording: LocalRecordingManager.isRecordingLocally(),
+ _subtitlesLanguage
};
}
diff --git a/react/features/subtitles/reducer.ts b/react/features/subtitles/reducer.ts
index 99f9bce9cf..e3ac58563d 100644
--- a/react/features/subtitles/reducer.ts
+++ b/react/features/subtitles/reducer.ts
@@ -9,7 +9,7 @@ import {
* Default State for 'features/transcription' feature.
*/
const defaultState = {
- _displaySubtitles: true,
+ _displaySubtitles: false,
_transcriptMessages: new Map(),
_requestingSubtitles: false,
_language: null