Przeglądaj źródła

feat(external_api) add ability to start transcriptions together with recordings

factor2
Saúl Ibarra Corretgé 1 rok temu
rodzic
commit
d8079a4232
2 zmienionych plików z 29 dodań i 10 usunięć
  1. 25
    8
      modules/API/API.js
  2. 4
    2
      modules/API/external/external_api.js

+ 25
- 8
modules/API/API.js Wyświetl plik

100
 } from '../../react/features/participants-pane/actions';
100
 } from '../../react/features/participants-pane/actions';
101
 import { getParticipantsPaneOpen, isForceMuted } from '../../react/features/participants-pane/functions';
101
 import { getParticipantsPaneOpen, isForceMuted } from '../../react/features/participants-pane/functions';
102
 import { startLocalVideoRecording, stopLocalVideoRecording } from '../../react/features/recording/actions.any';
102
 import { startLocalVideoRecording, stopLocalVideoRecording } from '../../react/features/recording/actions.any';
103
-import { RECORDING_TYPES } from '../../react/features/recording/constants';
103
+import { RECORDING_METADATA_ID, RECORDING_TYPES } from '../../react/features/recording/constants';
104
 import { getActiveSession, supportsLocalRecording } from '../../react/features/recording/functions';
104
 import { getActiveSession, supportsLocalRecording } from '../../react/features/recording/functions';
105
 import { startAudioScreenShareFlow, startScreenShareFlow } from '../../react/features/screen-share/actions';
105
 import { startAudioScreenShareFlow, startScreenShareFlow } from '../../react/features/screen-share/actions';
106
 import { isScreenAudioSupported } from '../../react/features/screen-share/functions';
106
 import { isScreenAudioSupported } from '../../react/features/screen-share/functions';
629
          * @param { string } arg.youtubeStreamKey - The youtube stream key.
629
          * @param { string } arg.youtubeStreamKey - The youtube stream key.
630
          * @param { string } arg.youtubeBroadcastID - The youtube broadcast ID.
630
          * @param { string } arg.youtubeBroadcastID - The youtube broadcast ID.
631
          * @param { Object } arg.extraMetadata - Any extra metadata params for file recording.
631
          * @param { Object } arg.extraMetadata - Any extra metadata params for file recording.
632
+         * @param { boolean } arg.transcription - Whether a transcription should be started or not.
632
          * @returns {void}
633
          * @returns {void}
633
          */
634
          */
634
         'start-recording': ({
635
         'start-recording': ({
640
             rtmpBroadcastID,
641
             rtmpBroadcastID,
641
             youtubeStreamKey,
642
             youtubeStreamKey,
642
             youtubeBroadcastID,
643
             youtubeBroadcastID,
643
-            extraMetadata = {}
644
+            extraMetadata = {},
645
+            transcription
644
         }) => {
646
         }) => {
645
             const state = APP.store.getState();
647
             const state = APP.store.getState();
646
             const conference = getCurrentConference(state);
648
             const conference = getCurrentConference(state);
715
                     mode: JitsiRecordingConstants.mode.STREAM,
717
                     mode: JitsiRecordingConstants.mode.STREAM,
716
                     streamId: youtubeStreamKey || rtmpStreamKey
718
                     streamId: youtubeStreamKey || rtmpStreamKey
717
                 };
719
                 };
718
-            } else {
719
-                logger.error('Invalid recording mode provided');
720
-
721
-                return;
722
             }
720
             }
723
 
721
 
724
             if (isScreenshotCaptureEnabled(state, true, false)) {
722
             if (isScreenshotCaptureEnabled(state, true, false)) {
725
                 APP.store.dispatch(toggleScreenshotCaptureSummary(true));
723
                 APP.store.dispatch(toggleScreenshotCaptureSummary(true));
726
             }
724
             }
727
-            conference.startRecording(recordingConfig);
725
+
726
+            // Start audio / video recording, if requested.
727
+            if (typeof recordingConfig !== 'undefined') {
728
+                conference.startRecording(recordingConfig);
729
+            }
730
+
731
+            if (transcription) {
732
+                APP.store.dispatch(setRequestingSubtitles(true, false, null));
733
+                conference.getMetadataHandler().setMetadata(RECORDING_METADATA_ID, {
734
+                    isTranscribingEnabled: true
735
+                });
736
+            }
728
         },
737
         },
729
 
738
 
730
         /**
739
         /**
731
          * Stops a recording or streaming in progress.
740
          * Stops a recording or streaming in progress.
732
          *
741
          *
733
          * @param {string} mode - `local`, `file` or `stream`.
742
          * @param {string} mode - `local`, `file` or `stream`.
743
+         * @param {boolean} transcription - Whether the transcription needs to be stopped.
734
          * @returns {void}
744
          * @returns {void}
735
          */
745
          */
736
-        'stop-recording': mode => {
746
+        'stop-recording': (mode, transcription) => {
737
             const state = APP.store.getState();
747
             const state = APP.store.getState();
738
             const conference = getCurrentConference(state);
748
             const conference = getCurrentConference(state);
739
 
749
 
743
                 return;
753
                 return;
744
             }
754
             }
745
 
755
 
756
+            if (transcription) {
757
+                APP.store.dispatch(setRequestingSubtitles(false, false, null));
758
+                conference.getMetadataHandler().setMetadata(RECORDING_METADATA_ID, {
759
+                    isTranscribingEnabled: false
760
+                });
761
+            }
762
+
746
             if (mode === 'local') {
763
             if (mode === 'local') {
747
                 APP.store.dispatch(stopLocalVideoRecording());
764
                 APP.store.dispatch(stopLocalVideoRecording());
748
 
765
 

+ 4
- 2
modules/API/external/external_api.js Wyświetl plik

1446
      * @param { string } options.youtubeStreamKey - The youtube stream key.
1446
      * @param { string } options.youtubeStreamKey - The youtube stream key.
1447
      * @param { string } options.youtubeBroadcastID - The youtube broadcast ID.
1447
      * @param { string } options.youtubeBroadcastID - The youtube broadcast ID.
1448
      * @param {Object } options.extraMetadata - Any extra metadata params for file recording.
1448
      * @param {Object } options.extraMetadata - Any extra metadata params for file recording.
1449
+     * @param { boolean } arg.transcription - Whether a transcription should be started or not.
1449
      * @returns {void}
1450
      * @returns {void}
1450
      */
1451
      */
1451
     startRecording(options) {
1452
     startRecording(options) {
1456
      * Stops a recording or streaming session that is in progress.
1457
      * Stops a recording or streaming session that is in progress.
1457
      *
1458
      *
1458
      * @param {string} mode - `file` or `stream`.
1459
      * @param {string} mode - `file` or `stream`.
1460
+     * @param {boolean} transcription - Whether the transcription needs to be stopped.
1459
      * @returns {void}
1461
      * @returns {void}
1460
      */
1462
      */
1461
-    stopRecording(mode) {
1462
-        this.executeCommand('stopRecording', mode);
1463
+    stopRecording(mode, transcription) {
1464
+        this.executeCommand('stopRecording', mode, transcription);
1463
     }
1465
     }
1464
 
1466
 
1465
     /**
1467
     /**

Ładowanie…
Anuluj
Zapisz