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 recording
  • stopRecord() – 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?

Play a Recorded File

In case you want to play Recorded File directly from EnableX Server, please note that those files are password protected. EnableX Implemented HTTP Basic Authentication to secure recorded file storage.

Therefore, any Video Player, may not use the file-paths only to play them from EnableX Server. Player must provide access credentials to pass through the authentication process to play the file.

cordova plugin add cordova-plugin-video-player

For next steps, refer the following:

  • https://github.com/moust/cordova-plugin-videoplayer
  • https://ionicframework.com/docs/native/video-player

Note:

  • There is an alternate way. You should download the files from EnableX Server to your Server and play from there without or with any security measure you may like to deploy.
  • Files from EnableX Storage gets deleted after 72 hours. So, accessing them from EnableX Server to play is not guaranteed beyond 72 hours.