diff --git a/modules/API/API.js b/modules/API/API.js index e1c7c3cb7..397d2a692 100644 --- a/modules/API/API.js +++ b/modules/API/API.js @@ -223,7 +223,8 @@ function initCommands() { }, /** - * Starts a file recording or streaming depending on the passed on params. + * Starts a file recording or streaming session depending on the passed on params. + * For RTMP streams, `rtmpStreamKey` must be passed on. `rtmpBroadcastID` is optional. * For youtube streams, `youtubeStreamKey` must be passed on. `youtubeBroadcastID` is optional. * For dropbox recording, recording `mode` should be `file` and a dropbox oauth2 token must be provided. * For file recording, recording `mode` should be `file` and optionally `shouldShare` could be passed on. @@ -231,13 +232,23 @@ function initCommands() { * * @param { string } arg.mode - Recording mode, either `file` or `stream`. * @param { string } arg.dropboxToken - Dropbox oauth2 token. + * @param { string } arg.rtmpStreamKey - The RTMP stream key. + * @param { string } arg.rtmpBroadcastID - The RTMP braodcast ID. * @param { boolean } arg.shouldShare - Whether the recording should be shared with the participants or not. * Only applies to certain jitsi meet deploys. * @param { string } arg.youtubeStreamKey - The youtube stream key. * @param { string } arg.youtubeBroadcastID - The youtube broacast ID. * @returns {void} */ - 'start-recording': ({ mode, dropboxToken, shouldShare, youtubeStreamKey, youtubeBroadcastID }) => { + 'start-recording': ({ + mode, + dropboxToken, + shouldShare, + rtmpStreamKey, + rtmpBroadcastID, + youtubeStreamKey, + youtubeBroadcastID + }) => { const state = APP.store.getState(); const conference = getCurrentConference(state); @@ -253,8 +264,8 @@ function initCommands() { return; } - if (mode === JitsiRecordingConstants.mode.STREAM && !youtubeStreamKey) { - logger.error('Failed starting recording: missing youtube stream key'); + if (mode === JitsiRecordingConstants.mode.STREAM && !(youtubeStreamKey || rtmpStreamKey)) { + logger.error('Failed starting recording: missing youtube or RTMP stream key'); return; } @@ -286,9 +297,9 @@ function initCommands() { } } else if (mode === JitsiRecordingConstants.mode.STREAM) { recordingConfig = { - broadcastId: youtubeBroadcastID, + broadcastId: youtubeBroadcastID || rtmpBroadcastID, mode: JitsiRecordingConstants.mode.STREAM, - streamId: youtubeStreamKey + streamId: youtubeStreamKey || rtmpStreamKey }; } else { logger.error('Invalid recording mode provided'); diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.js index 924ca0f50..19a118aa9 100644 --- a/modules/API/external/external_api.js +++ b/modules/API/external/external_api.js @@ -1047,6 +1047,39 @@ export default class JitsiMeetExternalAPI extends EventEmitter { return setVideoInputDevice(this._transport, label, deviceId); } + /** + * Starts a file recording or streaming session depending on the passed on params. + * For RTMP streams, `rtmpStreamKey` must be passed on. `rtmpBroadcastID` is optional. + * For youtube streams, `youtubeStreamKey` must be passed on. `youtubeBroadcastID` is optional. + * For dropbox recording, recording `mode` should be `file` and a dropbox oauth2 token must be provided. + * For file recording, recording `mode` should be `file` and optionally `shouldShare` could be passed on. + * No other params should be passed. + * + * @param {Object} options - An object with config options to pass along. + * @param { string } options.mode - Recording mode, either `file` or `stream`. + * @param { string } options.dropboxToken - Dropbox oauth2 token. + * @param { boolean } options.shouldShare - Whether the recording should be shared with the participants or not. + * Only applies to certain jitsi meet deploys. + * @param { string } options.rtmpStreamKey - The RTMP stream key. + * @param { string } options.rtmpBroadcastID - The RTMP broacast ID. + * @param { string } options.youtubeStreamKey - The youtube stream key. + * @param { string } options.youtubeBroadcastID - The youtube broacast ID. + * @returns {void} + */ + startRecording(options) { + this.executeCommand('startRecording', options); + } + + /** + * Stops a recording or streaming session that is in progress. + * + * @param {string} mode - `file` or `stream`. + * @returns {void} + */ + stopRecording(mode) { + this.executeCommand('startRecording', mode); + } + /** * Returns the configuration for electron for the windows that are open * from Jitsi Meet.