Using EnableX you may get an RTC session recorded as individual streams and later be transcoded through a post-session service to create a single video file that can be retrieved and replayed using any Video Player. Recording can be started in 2 ways, viz.
Table of Contents
Auto-Recording
You may define a room to start recording automatically as and when a session starts in the room. You may pass { settings: { auto_recording: true }}
in the JSON Payload while creating a room to ensure a session is recorded automatically.
On-Demand Recording
Client API call helps you start and stop recording as and when needed. The available methods are accessible to Moderator only. Therefore, on the Moderator End-Point, you may require to create UI to use the methods to start or stop recording a session.
To start session recording on demand you may use window.EnxRtc.startRecord()
method, and to stop may use window.EnxRtc.stopRecord()
method. On successful initiation of recording and stopping of recording the moderator will be notified using onStartRecordingEvent
and onStopRecordingEvent
event listeners. Also, all other participants will be notified using onRoomRecordingOn
and onRoomRecordingOff
event listener respectively.
Methods:
startRecord()
– No parameter is needed. Starts recordingstopRecord()
– No parameter is needed. Stops recording
Event Listeners:
-
onStartRecordingEvent
– To moderator to notify that recording has started -
onStopRecordingEvent
– To moderator to notify that recording has stopped -
onRoomRecordingOn
– To all participants to notify recording is on -
onRoomRecordingOff
– To all participants to notify recording is off
// To Start Recording window.EnxRtc.startRecord(); // Add Event Listeners // Moderator is acknowledged that Recording has been started. window.EnxRtc.addEventListner("onStartRecordingEvent", function (data) { console.log(JSON.stringify(data.data)); }); // All Participants are notified that Recording has been started. window.EnxRtc.addEventListner("onRoomRecordingOn ", function (data) { console.log(JSON.stringify(data.data)); }); // To Stop Recording window.EnxRtc.stopRecord(); // Add Event Listeners // Moderator is acknowledged that Recording has been stopped.window.EnxRtc.addEventListner("onStopRecordingEvent", function (data) { console.log(JSON.stringify(data.data)); }); // All Participants are notified that Recording has been stopped. window.EnxRtc.addEventListner("onRoomRecordingOff", function (data) { console.log(JSON.stringify(data.data)); });
Note:
- Moderator can start/stop recording any number of times during a session as she wishes.
- Moderator can stop recording in a room defined with the auto-recording feature.
Refer: How to fetch Recordings?