Преглед изворни кода

fix(subtitles) keep subtitles state when recording

factor2
Saúl Ibarra Corretgé пре 1 година
родитељ
комит
a6f6b3a2d2

+ 20
- 12
react/features/recording/components/Recording/AbstractStartRecordingDialog.ts Прегледај датотеку

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

+ 37
- 17
react/features/recording/components/Recording/AbstractStopRecordingDialog.ts Прегледај датотеку

26
      */
26
      */
27
     _conference?: IJitsiConference;
27
     _conference?: IJitsiConference;
28
 
28
 
29
+    /**
30
+     * Whether subtitles should be displayed or not.
31
+     */
32
+    _displaySubtitles?: boolean;
33
+
29
     /**
34
     /**
30
      * The redux representation of the recording session to be stopped.
35
      * The redux representation of the recording session to be stopped.
31
      */
36
      */
36
      */
41
      */
37
     _localRecording: boolean;
42
     _localRecording: boolean;
38
 
43
 
44
+    /**
45
+     * The selected language for subtitles.
46
+     */
47
+    _subtitlesLanguage: string | null;
48
+
39
     /**
49
     /**
40
      * The redux dispatch function.
50
      * The redux dispatch function.
41
      */
51
      */
77
     _onSubmit() {
87
     _onSubmit() {
78
         sendAnalytics(createRecordingDialogEvent('stop', 'confirm.button'));
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
         // TODO: this should be an action in transcribing. -saghul
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
         this.props._conference?.getMetadataHandler().setMetadata(RECORDING_METADATA_ID, {
113
         this.props._conference?.getMetadataHandler().setMetadata(RECORDING_METADATA_ID, {
98
             isTranscribingEnabled: false
114
             isTranscribingEnabled: false
117
  *
133
  *
118
  * @param {Object} state - The Redux state.
134
  * @param {Object} state - The Redux state.
119
  * @private
135
  * @private
120
- * @returns {{
121
- *     _conference: JitsiConference,
122
- *     _fileRecordingSession: Object
123
- * }}
136
+ * @returns {IProps}
124
  */
137
  */
125
 export function _mapStateToProps(state: IReduxState) {
138
 export function _mapStateToProps(state: IReduxState) {
139
+    const {
140
+        _displaySubtitles,
141
+        _language: _subtitlesLanguage
142
+    } = state['features/subtitles'];
143
+
126
     return {
144
     return {
127
         _conference: state['features/base/conference'].conference,
145
         _conference: state['features/base/conference'].conference,
146
+        _displaySubtitles,
128
         _fileRecordingSession:
147
         _fileRecordingSession:
129
             getActiveSession(state, JitsiRecordingConstants.mode.FILE),
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
  * Default State for 'features/transcription' feature.
9
  * Default State for 'features/transcription' feature.
10
  */
10
  */
11
 const defaultState = {
11
 const defaultState = {
12
-    _displaySubtitles: true,
12
+    _displaySubtitles: false,
13
     _transcriptMessages: new Map(),
13
     _transcriptMessages: new Map(),
14
     _requestingSubtitles: false,
14
     _requestingSubtitles: false,
15
     _language: null
15
     _language: null

Loading…
Откажи
Сачувај