Ver código fonte

feat(iFrame): Add recording options for RTMP streaming.

Add methods for start/stop recording in addition to the commands that we already have.
master
Jaya Allamsetty 4 anos atrás
pai
commit
fbfaed07b2
2 arquivos alterados com 50 adições e 6 exclusões
  1. 17
    6
      modules/API/API.js
  2. 33
    0
      modules/API/external/external_api.js

+ 17
- 6
modules/API/API.js Ver arquivo

@@ -223,7 +223,8 @@ function initCommands() {
223 223
         },
224 224
 
225 225
         /**
226
-         * Starts a file recording or streaming depending on the passed on params.
226
+         * Starts a file recording or streaming session depending on the passed on params.
227
+         * For RTMP streams, `rtmpStreamKey` must be passed on. `rtmpBroadcastID` is optional.
227 228
          * For youtube streams, `youtubeStreamKey` must be passed on. `youtubeBroadcastID` is optional.
228 229
          * For dropbox recording, recording `mode` should be `file` and a dropbox oauth2 token must be provided.
229 230
          * For file recording, recording `mode` should be `file` and optionally `shouldShare` could be passed on.
@@ -231,13 +232,23 @@ function initCommands() {
231 232
          *
232 233
          * @param { string } arg.mode - Recording mode, either `file` or `stream`.
233 234
          * @param { string } arg.dropboxToken - Dropbox oauth2 token.
235
+         * @param { string } arg.rtmpStreamKey - The RTMP stream key.
236
+         * @param { string } arg.rtmpBroadcastID - The RTMP braodcast ID.
234 237
          * @param { boolean } arg.shouldShare - Whether the recording should be shared with the participants or not.
235 238
          * Only applies to certain jitsi meet deploys.
236 239
          * @param { string } arg.youtubeStreamKey - The youtube stream key.
237 240
          * @param { string } arg.youtubeBroadcastID - The youtube broacast ID.
238 241
          * @returns {void}
239 242
          */
240
-        'start-recording': ({ mode, dropboxToken, shouldShare, youtubeStreamKey, youtubeBroadcastID }) => {
243
+        'start-recording': ({
244
+            mode,
245
+            dropboxToken,
246
+            shouldShare,
247
+            rtmpStreamKey,
248
+            rtmpBroadcastID,
249
+            youtubeStreamKey,
250
+            youtubeBroadcastID
251
+        }) => {
241 252
             const state = APP.store.getState();
242 253
             const conference = getCurrentConference(state);
243 254
 
@@ -253,8 +264,8 @@ function initCommands() {
253 264
                 return;
254 265
             }
255 266
 
256
-            if (mode === JitsiRecordingConstants.mode.STREAM && !youtubeStreamKey) {
257
-                logger.error('Failed starting recording: missing youtube stream key');
267
+            if (mode === JitsiRecordingConstants.mode.STREAM && !(youtubeStreamKey || rtmpStreamKey)) {
268
+                logger.error('Failed starting recording: missing youtube or RTMP stream key');
258 269
 
259 270
                 return;
260 271
             }
@@ -286,9 +297,9 @@ function initCommands() {
286 297
                 }
287 298
             } else if (mode === JitsiRecordingConstants.mode.STREAM) {
288 299
                 recordingConfig = {
289
-                    broadcastId: youtubeBroadcastID,
300
+                    broadcastId: youtubeBroadcastID || rtmpBroadcastID,
290 301
                     mode: JitsiRecordingConstants.mode.STREAM,
291
-                    streamId: youtubeStreamKey
302
+                    streamId: youtubeStreamKey || rtmpStreamKey
292 303
                 };
293 304
             } else {
294 305
                 logger.error('Invalid recording mode provided');

+ 33
- 0
modules/API/external/external_api.js Ver arquivo

@@ -1047,6 +1047,39 @@ export default class JitsiMeetExternalAPI extends EventEmitter {
1047 1047
         return setVideoInputDevice(this._transport, label, deviceId);
1048 1048
     }
1049 1049
 
1050
+    /**
1051
+     * Starts a file recording or streaming session depending on the passed on params.
1052
+     * For RTMP streams, `rtmpStreamKey` must be passed on. `rtmpBroadcastID` is optional.
1053
+     * For youtube streams, `youtubeStreamKey` must be passed on. `youtubeBroadcastID` is optional.
1054
+     * For dropbox recording, recording `mode` should be `file` and a dropbox oauth2 token must be provided.
1055
+     * For file recording, recording `mode` should be `file` and optionally `shouldShare` could be passed on.
1056
+     * No other params should be passed.
1057
+     *
1058
+     * @param {Object} options - An object with config options to pass along.
1059
+     * @param { string } options.mode - Recording mode, either `file` or `stream`.
1060
+     * @param { string } options.dropboxToken - Dropbox oauth2 token.
1061
+     * @param { boolean } options.shouldShare - Whether the recording should be shared with the participants or not.
1062
+     * Only applies to certain jitsi meet deploys.
1063
+     * @param { string } options.rtmpStreamKey - The RTMP stream key.
1064
+     * @param { string } options.rtmpBroadcastID - The RTMP broacast ID.
1065
+     * @param { string } options.youtubeStreamKey - The youtube stream key.
1066
+     * @param { string } options.youtubeBroadcastID - The youtube broacast ID.
1067
+     * @returns {void}
1068
+     */
1069
+    startRecording(options) {
1070
+        this.executeCommand('startRecording', options);
1071
+    }
1072
+
1073
+    /**
1074
+     * Stops a recording or streaming session that is in progress.
1075
+     *
1076
+     * @param {string} mode - `file` or `stream`.
1077
+     * @returns {void}
1078
+     */
1079
+    stopRecording(mode) {
1080
+        this.executeCommand('startRecording', mode);
1081
+    }
1082
+
1050 1083
     /**
1051 1084
      * Returns the configuration for electron for the windows that are open
1052 1085
      * from Jitsi Meet.

Carregando…
Cancelar
Salvar