Ver código fonte

feat(external_api) include transcription state in recordingStatusChanged

factor2
Saúl Ibarra Corretgé 1 ano atrás
pai
commit
0be3e2b103

+ 4
- 2
modules/API/API.js Ver arquivo

1917
      * @param {boolean} on - True if recording is on, false otherwise.
1917
      * @param {boolean} on - True if recording is on, false otherwise.
1918
      * @param {string} mode - Stream or file or local.
1918
      * @param {string} mode - Stream or file or local.
1919
      * @param {string} error - Error type or null if success.
1919
      * @param {string} error - Error type or null if success.
1920
+     * @param {boolean} transcription - True if a transcription is being recorded, false otherwise.
1920
      * @returns {void}
1921
      * @returns {void}
1921
      */
1922
      */
1922
-    notifyRecordingStatusChanged(on, mode, error) {
1923
+    notifyRecordingStatusChanged(on, mode, error, transcription) {
1923
         this._sendEvent({
1924
         this._sendEvent({
1924
             name: 'recording-status-changed',
1925
             name: 'recording-status-changed',
1925
             on,
1926
             on,
1926
             mode,
1927
             mode,
1927
-            error
1928
+            error,
1929
+            transcription
1928
         });
1930
         });
1929
     }
1931
     }
1930
 
1932
 

+ 17
- 11
react/features/recording/middleware.ts Ver arquivo

101
             (recorderSession: any) => {
101
             (recorderSession: any) => {
102
                 if (recorderSession) {
102
                 if (recorderSession) {
103
                     recorderSession.getID() && dispatch(updateRecordingSessionData(recorderSession));
103
                     recorderSession.getID() && dispatch(updateRecordingSessionData(recorderSession));
104
-                    recorderSession.getError() && _showRecordingErrorNotification(recorderSession, dispatch);
104
+                    recorderSession.getError() && _showRecordingErrorNotification(recorderSession, dispatch, getState);
105
                 }
105
                 }
106
 
106
 
107
                 return;
107
                 return;
133
             dispatch(updateLocalRecordingStatus(true, onlySelf));
133
             dispatch(updateLocalRecordingStatus(true, onlySelf));
134
             sendAnalytics(createRecordingEvent('started', `local${onlySelf ? '.self' : ''}`));
134
             sendAnalytics(createRecordingEvent('started', `local${onlySelf ? '.self' : ''}`));
135
             if (typeof APP !== 'undefined') {
135
             if (typeof APP !== 'undefined') {
136
-                APP.API.notifyRecordingStatusChanged(true, 'local');
136
+                APP.API.notifyRecordingStatusChanged(
137
+                    true, 'local', undefined, isRecorderTranscriptionsRunning(getState()));
137
             }
138
             }
138
         } catch (err: any) {
139
         } catch (err: any) {
139
             logger.error('Capture failed', err);
140
             logger.error('Capture failed', err);
154
             };
155
             };
155
 
156
 
156
             if (typeof APP !== 'undefined') {
157
             if (typeof APP !== 'undefined') {
157
-                APP.API.notifyRecordingStatusChanged(false, 'local', err.message);
158
+                APP.API.notifyRecordingStatusChanged(
159
+                    false, 'local', err.message, isRecorderTranscriptionsRunning(getState()));
158
             }
160
             }
159
 
161
 
160
             dispatch(showErrorNotification(props, NOTIFICATION_TIMEOUT_TYPE.MEDIUM));
162
             dispatch(showErrorNotification(props, NOTIFICATION_TIMEOUT_TYPE.MEDIUM));
172
                 dispatch(playSound(RECORDING_OFF_SOUND_ID));
174
                 dispatch(playSound(RECORDING_OFF_SOUND_ID));
173
             }
175
             }
174
             if (typeof APP !== 'undefined') {
176
             if (typeof APP !== 'undefined') {
175
-                APP.API.notifyRecordingStatusChanged(false, 'local');
177
+                APP.API.notifyRecordingStatusChanged(
178
+                    false, 'local', undefined, isRecorderTranscriptionsRunning(getState()));
176
             }
179
             }
177
         }
180
         }
178
         break;
181
         break;
237
                     }
240
                     }
238
 
241
 
239
                     if (typeof APP !== 'undefined') {
242
                     if (typeof APP !== 'undefined') {
240
-                        APP.API.notifyRecordingStatusChanged(true, mode);
243
+                        APP.API.notifyRecordingStatusChanged(
244
+                            true, mode, undefined, isRecorderTranscriptionsRunning(state));
241
                     }
245
                     }
242
                 }
246
                 }
243
             } else if (updatedSessionData?.status === OFF && oldSessionData?.status !== OFF) {
247
             } else if (updatedSessionData?.status === OFF && oldSessionData?.status !== OFF) {
269
                 }
273
                 }
270
 
274
 
271
                 if (typeof APP !== 'undefined') {
275
                 if (typeof APP !== 'undefined') {
272
-                    APP.API.notifyRecordingStatusChanged(false, mode);
276
+                    APP.API.notifyRecordingStatusChanged(
277
+                        false, mode, undefined, isRecorderTranscriptionsRunning(state));
273
                 }
278
                 }
274
             }
279
             }
275
         }
280
         }
312
  * in recording session.
317
  * in recording session.
313
  *
318
  *
314
  * @private
319
  * @private
315
- * @param {Object} recorderSession - The recorder session model from the
320
+ * @param {Object} session - The recorder session model from the
316
  * lib.
321
  * lib.
317
  * @param {Dispatch} dispatch - The Redux Dispatch function.
322
  * @param {Dispatch} dispatch - The Redux Dispatch function.
323
+ * @param {Function} getState - The Redux getState function.
318
  * @returns {void}
324
  * @returns {void}
319
  */
325
  */
320
-function _showRecordingErrorNotification(recorderSession: any, dispatch: IStore['dispatch']) {
321
-    const mode = recorderSession.getMode();
322
-    const error = recorderSession.getError();
326
+function _showRecordingErrorNotification(session: any, dispatch: IStore['dispatch'], getState: IStore['getState']) {
327
+    const mode = session.getMode();
328
+    const error = session.getError();
323
     const isStreamMode = mode === JitsiMeetJS.constants.recording.mode.STREAM;
329
     const isStreamMode = mode === JitsiMeetJS.constants.recording.mode.STREAM;
324
 
330
 
325
     switch (error) {
331
     switch (error) {
367
     }
373
     }
368
 
374
 
369
     if (typeof APP !== 'undefined') {
375
     if (typeof APP !== 'undefined') {
370
-        APP.API.notifyRecordingStatusChanged(false, mode, error);
376
+        APP.API.notifyRecordingStatusChanged(false, mode, error, isRecorderTranscriptionsRunning(getState()));
371
     }
377
     }
372
 }
378
 }

+ 11
- 3
react/features/transcribing/subscriber.ts Ver arquivo

7
 import { showNotification } from '../notifications/actions';
7
 import { showNotification } from '../notifications/actions';
8
 import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';
8
 import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';
9
 import { RECORDING_OFF_SOUND_ID, RECORDING_ON_SOUND_ID } from '../recording/constants';
9
 import { RECORDING_OFF_SOUND_ID, RECORDING_ON_SOUND_ID } from '../recording/constants';
10
+import { isLiveStreamingRunning, isRecordingRunning } from '../recording/functions';
10
 
11
 
11
 import { isRecorderTranscriptionsRunning } from './functions';
12
 import { isRecorderTranscriptionsRunning } from './functions';
12
 
13
 
17
     /* selector */ isRecorderTranscriptionsRunning,
18
     /* selector */ isRecorderTranscriptionsRunning,
18
     /* listener */ (isRecorderTranscriptionsRunningValue, { getState, dispatch }) => {
19
     /* listener */ (isRecorderTranscriptionsRunningValue, { getState, dispatch }) => {
19
         if (isRecorderTranscriptionsRunningValue) {
20
         if (isRecorderTranscriptionsRunningValue) {
20
-            notifyTranscribingStatusChanged(true);
21
+            notifyTranscribingStatusChanged(getState, true);
21
             maybeEmitRecordingNotification(dispatch, getState, true);
22
             maybeEmitRecordingNotification(dispatch, getState, true);
22
         } else {
23
         } else {
23
-            notifyTranscribingStatusChanged(false);
24
+            notifyTranscribingStatusChanged(getState, false);
24
             maybeEmitRecordingNotification(dispatch, getState, false);
25
             maybeEmitRecordingNotification(dispatch, getState, false);
25
         }
26
         }
26
     }
27
     }
58
 /**
59
 /**
59
  * Notify external application (if API is enabled) that transcribing has started or stopped.
60
  * Notify external application (if API is enabled) that transcribing has started or stopped.
60
  *
61
  *
62
+ * @param {Function} getState - The Redux state.
61
  * @param {boolean} on - True if transcribing is on, false otherwise.
63
  * @param {boolean} on - True if transcribing is on, false otherwise.
62
  * @returns {void}
64
  * @returns {void}
63
  */
65
  */
64
-function notifyTranscribingStatusChanged(on: boolean) {
66
+function notifyTranscribingStatusChanged(getState: IStore['getState'], on: boolean) {
65
     if (typeof APP !== 'undefined') {
67
     if (typeof APP !== 'undefined') {
68
+        const state = getState();
69
+        const isRecording = isRecordingRunning(state);
70
+        const isStreaming = isLiveStreamingRunning(state);
71
+        const mode = isRecording ? JitsiRecordingConstants.mode.FILE : JitsiRecordingConstants.mode.STREAM;
72
+
73
+        APP.API.notifyRecordingStatusChanged(isRecording || isStreaming, mode, undefined, on);
66
         APP.API.notifyTranscribingStatusChanged(on);
74
         APP.API.notifyTranscribingStatusChanged(on);
67
     }
75
     }
68
 }
76
 }

Carregando…
Cancelar
Salvar