浏览代码

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 年前
父节点
当前提交
fbfaed07b2
共有 2 个文件被更改,包括 50 次插入6 次删除
  1. 17
    6
      modules/API/API.js
  2. 33
    0
      modules/API/external/external_api.js

+ 17
- 6
modules/API/API.js 查看文件

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
          * For youtube streams, `youtubeStreamKey` must be passed on. `youtubeBroadcastID` is optional.
228
          * For youtube streams, `youtubeStreamKey` must be passed on. `youtubeBroadcastID` is optional.
228
          * For dropbox recording, recording `mode` should be `file` and a dropbox oauth2 token must be provided.
229
          * For dropbox recording, recording `mode` should be `file` and a dropbox oauth2 token must be provided.
229
          * For file recording, recording `mode` should be `file` and optionally `shouldShare` could be passed on.
230
          * For file recording, recording `mode` should be `file` and optionally `shouldShare` could be passed on.
231
          *
232
          *
232
          * @param { string } arg.mode - Recording mode, either `file` or `stream`.
233
          * @param { string } arg.mode - Recording mode, either `file` or `stream`.
233
          * @param { string } arg.dropboxToken - Dropbox oauth2 token.
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
          * @param { boolean } arg.shouldShare - Whether the recording should be shared with the participants or not.
237
          * @param { boolean } arg.shouldShare - Whether the recording should be shared with the participants or not.
235
          * Only applies to certain jitsi meet deploys.
238
          * Only applies to certain jitsi meet deploys.
236
          * @param { string } arg.youtubeStreamKey - The youtube stream key.
239
          * @param { string } arg.youtubeStreamKey - The youtube stream key.
237
          * @param { string } arg.youtubeBroadcastID - The youtube broacast ID.
240
          * @param { string } arg.youtubeBroadcastID - The youtube broacast ID.
238
          * @returns {void}
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
             const state = APP.store.getState();
252
             const state = APP.store.getState();
242
             const conference = getCurrentConference(state);
253
             const conference = getCurrentConference(state);
243
 
254
 
253
                 return;
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
                 return;
270
                 return;
260
             }
271
             }
286
                 }
297
                 }
287
             } else if (mode === JitsiRecordingConstants.mode.STREAM) {
298
             } else if (mode === JitsiRecordingConstants.mode.STREAM) {
288
                 recordingConfig = {
299
                 recordingConfig = {
289
-                    broadcastId: youtubeBroadcastID,
300
+                    broadcastId: youtubeBroadcastID || rtmpBroadcastID,
290
                     mode: JitsiRecordingConstants.mode.STREAM,
301
                     mode: JitsiRecordingConstants.mode.STREAM,
291
-                    streamId: youtubeStreamKey
302
+                    streamId: youtubeStreamKey || rtmpStreamKey
292
                 };
303
                 };
293
             } else {
304
             } else {
294
                 logger.error('Invalid recording mode provided');
305
                 logger.error('Invalid recording mode provided');

+ 33
- 0
modules/API/external/external_api.js 查看文件

1047
         return setVideoInputDevice(this._transport, label, deviceId);
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
      * Returns the configuration for electron for the windows that are open
1084
      * Returns the configuration for electron for the windows that are open
1052
      * from Jitsi Meet.
1085
      * from Jitsi Meet.

正在加载...
取消
保存