ソースを参照

fix(subtitles) keep subtitles state when recording

factor2
Saúl Ibarra Corretgé 1年前
コミット
a6f6b3a2d2

+ 20
- 12
react/features/recording/components/Recording/AbstractStartRecordingDialog.ts ファイルの表示

@@ -32,6 +32,11 @@ export interface IProps extends WithTranslation {
32 32
      */
33 33
     _conference?: IJitsiConference;
34 34
 
35
+    /**
36
+     * Whether subtitles should be displayed or not.
37
+     */
38
+    _displaySubtitles?: boolean;
39
+
35 40
     /**
36 41
      * Whether to show file recordings service, even if integrations
37 42
      * are enabled.
@@ -69,6 +74,11 @@ export interface IProps extends WithTranslation {
69 74
      */
70 75
     _screenshotCaptureEnabled: boolean;
71 76
 
77
+    /**
78
+     * The selected language for subtitles.
79
+     */
80
+    _subtitlesLanguage: string | null;
81
+
72 82
     /**
73 83
      * The dropbox access token.
74 84
      */
@@ -336,8 +346,10 @@ class AbstractStartRecordingDialog extends Component<IProps, IState> {
336 346
         const {
337 347
             _appKey,
338 348
             _conference,
349
+            _displaySubtitles,
339 350
             _isDropboxEnabled,
340 351
             _rToken,
352
+            _subtitlesLanguage,
341 353
             _token,
342 354
             dispatch
343 355
         } = this.props;
@@ -399,7 +411,7 @@ class AbstractStartRecordingDialog extends Component<IProps, IState> {
399 411
 
400 412
         if (this.state.selectedRecordingService === RECORDING_TYPES.JITSI_REC_SERVICE
401 413
                 && this.state.shouldRecordTranscription) {
402
-            dispatch(setRequestingSubtitles(true, false, null));
414
+            dispatch(setRequestingSubtitles(true, _displaySubtitles, _subtitlesLanguage));
403 415
         }
404 416
 
405 417
         _conference?.getMetadataHandler().setMetadata(RECORDING_METADATA_ID, {
@@ -434,17 +446,7 @@ class AbstractStartRecordingDialog extends Component<IProps, IState> {
434 446
  * @param {Object} state - The Redux state.
435 447
  * @param {any} _ownProps - Component's own props.
436 448
  * @private
437
- * @returns {{
438
- *     _appKey: string,
439
- *     _autoTranscribeOnRecord: boolean,
440
- *     _conference: JitsiConference,
441
- *     _fileRecordingsServiceEnabled: boolean,
442
- *     _fileRecordingsServiceSharingEnabled: boolean,
443
- *     _isDropboxEnabled: boolean,
444
- *     _rToken:string,
445
- *     _tokenExpireDate: number,
446
- *     _token: string
447
- * }}
449
+ * @returns {IProps}
448 450
  */
449 451
 export function mapStateToProps(state: IReduxState, _ownProps: any) {
450 452
     const {
@@ -452,16 +454,22 @@ export function mapStateToProps(state: IReduxState, _ownProps: any) {
452 454
         dropbox = { appKey: undefined },
453 455
         localRecording
454 456
     } = state['features/base/config'];
457
+    const {
458
+        _displaySubtitles,
459
+        _language: _subtitlesLanguage
460
+    } = state['features/subtitles'];
455 461
 
456 462
     return {
457 463
         _appKey: dropbox.appKey ?? '',
458 464
         _autoTranscribeOnRecord: shouldAutoTranscribeOnRecord(state),
459 465
         _conference: state['features/base/conference'].conference,
466
+        _displaySubtitles,
460 467
         _fileRecordingsServiceEnabled: recordingService?.enabled ?? false,
461 468
         _fileRecordingsServiceSharingEnabled: isRecordingSharingEnabled(state),
462 469
         _isDropboxEnabled: isDropboxEnabled(state),
463 470
         _localRecordingEnabled: !localRecording?.disable,
464 471
         _rToken: state['features/dropbox'].rToken ?? '',
472
+        _subtitlesLanguage,
465 473
         _tokenExpireDate: state['features/dropbox'].expireDate,
466 474
         _token: state['features/dropbox'].token ?? ''
467 475
     };

+ 37
- 17
react/features/recording/components/Recording/AbstractStopRecordingDialog.ts ファイルの表示

@@ -26,6 +26,11 @@ export interface IProps extends WithTranslation {
26 26
      */
27 27
     _conference?: IJitsiConference;
28 28
 
29
+    /**
30
+     * Whether subtitles should be displayed or not.
31
+     */
32
+    _displaySubtitles?: boolean;
33
+
29 34
     /**
30 35
      * The redux representation of the recording session to be stopped.
31 36
      */
@@ -36,6 +41,11 @@ export interface IProps extends WithTranslation {
36 41
      */
37 42
     _localRecording: boolean;
38 43
 
44
+    /**
45
+     * The selected language for subtitles.
46
+     */
47
+    _subtitlesLanguage: string | null;
48
+
39 49
     /**
40 50
      * The redux dispatch function.
41 51
      */
@@ -77,22 +87,28 @@ export default class AbstractStopRecordingDialog<P extends IProps>
77 87
     _onSubmit() {
78 88
         sendAnalytics(createRecordingDialogEvent('stop', 'confirm.button'));
79 89
 
80
-        if (this.props._localRecording) {
81
-            this.props.dispatch(stopLocalVideoRecording());
82
-            if (this.props.localRecordingVideoStop) {
83
-                this.props.dispatch(setVideoMuted(true));
84
-            }
85
-        } else {
86
-            const { _fileRecordingSession } = this.props;
87
-
88
-            if (_fileRecordingSession) {
89
-                this.props._conference?.stopRecording(_fileRecordingSession.id);
90
-                this._toggleScreenshotCapture();
90
+        const {
91
+            _conference,
92
+            _displaySubtitles,
93
+            _fileRecordingSession,
94
+            _localRecording,
95
+            _subtitlesLanguage,
96
+            dispatch,
97
+            localRecordingVideoStop
98
+        } = this.props;
99
+
100
+        if (_localRecording) {
101
+            dispatch(stopLocalVideoRecording());
102
+            if (localRecordingVideoStop) {
103
+                dispatch(setVideoMuted(true));
91 104
             }
105
+        } else if (_fileRecordingSession) {
106
+            _conference?.stopRecording(_fileRecordingSession.id);
107
+            this._toggleScreenshotCapture();
92 108
         }
93 109
 
94 110
         // TODO: this should be an action in transcribing. -saghul
95
-        this.props.dispatch(setRequestingSubtitles(false, false, null));
111
+        this.props.dispatch(setRequestingSubtitles(Boolean(_displaySubtitles), _displaySubtitles, _subtitlesLanguage));
96 112
 
97 113
         this.props._conference?.getMetadataHandler().setMetadata(RECORDING_METADATA_ID, {
98 114
             isTranscribingEnabled: false
@@ -117,16 +133,20 @@ export default class AbstractStopRecordingDialog<P extends IProps>
117 133
  *
118 134
  * @param {Object} state - The Redux state.
119 135
  * @private
120
- * @returns {{
121
- *     _conference: JitsiConference,
122
- *     _fileRecordingSession: Object
123
- * }}
136
+ * @returns {IProps}
124 137
  */
125 138
 export function _mapStateToProps(state: IReduxState) {
139
+    const {
140
+        _displaySubtitles,
141
+        _language: _subtitlesLanguage
142
+    } = state['features/subtitles'];
143
+
126 144
     return {
127 145
         _conference: state['features/base/conference'].conference,
146
+        _displaySubtitles,
128 147
         _fileRecordingSession:
129 148
             getActiveSession(state, JitsiRecordingConstants.mode.FILE),
130
-        _localRecording: LocalRecordingManager.isRecordingLocally()
149
+        _localRecording: LocalRecordingManager.isRecordingLocally(),
150
+        _subtitlesLanguage
131 151
     };
132 152
 }

+ 1
- 1
react/features/subtitles/reducer.ts ファイルの表示

@@ -9,7 +9,7 @@ import {
9 9
  * Default State for 'features/transcription' feature.
10 10
  */
11 11
 const defaultState = {
12
-    _displaySubtitles: true,
12
+    _displaySubtitles: false,
13 13
     _transcriptMessages: new Map(),
14 14
     _requestingSubtitles: false,
15 15
     _language: null

読み込み中…
キャンセル
保存