You can record an RTC session as individual streams and also get it transcoded through a post-session service to create a single composite video file that can be retrieved and replayed using any Video Player. You can configure the Room for auto-recording or invoke APIs to start recording when required.

For details on fetching recorded sessions, refer to How to fetch Recordings?

Table of Contents

Auto-Recording

You can configure a Room with { settings: { auto_recording: true }} during Room Creation to automatically start recording the RTC session taking place in the Room. The Moderator can still stop recording in a Room with Auto-Recording by utilizing the stopRecord() method given below.

On-Demand Recording

The EnxRoom.startRecord() method allows the Moderator to start recording the session and EnxRoom.stopRecord() method is used to stop recording. You might need to provide these options on UI for the Moderator to access them.

There is no limit to the number of times a Moderator can start/stop recording.

Class: EnxRoom

Methods:

  • public void startRecord() – No parameter required.
  • public void stopRecord() – No parameter required.

Observer: public void setRecordingObserver(EnxRecordingObserver-Object)

Callbacks:

  • onStartRecordingEvent – Acknowledgment to the Moderator when recording starts.
  • onStopRecordingEvent – Acknowledgment to the Moderator when recording stops.
  • onRoomRecordingOn – Notification to all the participants when the recording is turned on.
  • onRoomRecordingOff – Notification to all the participants when the recording is turned off.
// Initiate Recording Observer to receive Callbacks
room.setRecordingObserver(this);

room.startRecord(); // To start recording
room.stopRecord(); // To stop recording

public void onStartRecordingEvent(JSONObject jsonobject){
   // You started recording
}

public void onStopRecordingEvent(JSONObject jsonobject){
   // You stopped recording
}

public void onRoomRecordingOn(JSONObject jsonobject){
   // Recording has started - to all
}  

public void onRoomRecordingOff(JSONObject jsonobject){
   // Recording has stopped - to all
}

Error Codes & Exceptions

CodeDescription
5007Unauthorized Access. When a participant tries to invoke startRecord().
5008Unauthorized Access. When a participant tries to invoke stopRecord().
5033Repeated startRecord() call while the previous request is in process.
5034Repeated startRecord() call while the recording has already started.
5035Repeated stopRecord() call while the recording has already stopped.
5036stopRecord() call without starting to record. Non-Contextual method call.

New Way to Record Live with an UI

Availability: v2.1.2+

Recording Live refers to a new process of creating a transcoded file in a live session with a custom layout without having to record individual streams. So, using Live Recording has double advantage:

  • You get a transcoded file within minutes post session. Not to wait longer alike previous transcoding process.
  • You have an option to define your own layout for the live recording process unlike previous transcoding process that creates in a predefined layout.

Auto Live Recording

You can configure a Room with to start Live Recording automatically as soon as the first person joing the Room. This may be done while creating a Room with the following settings:

"settings": { 
	"live_recording": {
		"auto_recording: true, 
		"url": "https://your-custom-view-url"
	}
}

Moderator can still stop live recording in a Room by using the stopRecord() method.

On-Demand Live Recording

Using SDK methods, a Moderator can start / stop live recording any time as he demands. The EnxRoom.startLiveRecording() method allows the Moderator to start live recording the session and EnxRoom.stopLiveRecording() stops it.

Start Live Recording

Class: EnxRoom

Observer: public void setLiveRecordingObserver(EnxLiveRecordingObserver enxLiveRecordingObserver)

Methodpublic void startLiveRecording(JSONObject jsonObject);

Parameter:

streamingConfig: Streaming configuration. Its a JSON object with following keys:

  • urlDetails – Its a JSON Object to define Custom View and its options.
    • url – To specify the URL of custom view. (Know how to create Custom View for Live Recording. Its the same way as we create View for Live Streaming).
    • any_custom_key_object – You may use any custom key or object that the your Custom View handles to change view/layout etc through query string.

Callback:

  • onACKStartLiveRecording – Acknowledgment callback to the Moderator when the Live Recording starts.

Response Body:

                     {data ={
                    	confNum = 534010000012;
                   	isRecordingInitiated = 1;
                    	type = RecordingInitiated;
 };
                     status ={
                    	error ={
                	    errorCode = 0;
               		errorDesc = "";
};
                    	resultCode = 0;
                   	success = 1;
                    	};
              	}
  • onRoomLiveRecordingOn – Notification to all the users in the room that the Live Recording has started.
  • onRoomLiveRecordingUpdate – Intermediate Notifications to all users about progress of the Live-Recording process.
  • onRoomLiveRecordingFailed – Notification to all users if Live Recording failed to start or failed after getting started.

Response Body:

                              {
                                  data =         {
                                  data =             {
                                         data =                 {
                                                      confNum = 534010000012;
                                                      isRecordingInitiated = 1;
                                                      type = RecordingInitiated;
                                                      };
                                         status =                 {
                                               error =                     {
                                               errorCode = 0;
                                               errorDesc = "";
                                               };
                                               resultCode = 0;
                                               success = 1;
                                         };
                                  streamerDetails =                 {
                                               agentId = "d6acdf34-01f3-ca66-2bcc-789363adc043";
                                               broadCastStreamerID = "b5296afd-1357-1de1-c89d-5dc0aca3e5ae";
                                  };
                           };
                    startedBy = "7f0f2b04-1ad4-4231-8fdc-9f9e014053b4";
                           };
                    type = "liveRecording-started";
                    },
enxRoom.setLiveRecordingObserver(this);   //To get Live recording callback, the user needs to set this live recording observer


enxRoom.startLiveRecording(jsonObject) 

// Where streamingConfig/jsonObject =                
{
  "urlDetails": {
    "url": "url",
    "layOut": {},
    "chatOverlay": true/false
  }
}

public void onACKStartLiveRecording( JSONObject jsonobject) {
 // To the Moderator - Live Recording has started
}

public void onRoomLiveRecordingOn( JSONObject jsonobject) {
 // To all the participants - Live Recording started
}

public void onRoomLiveRecordingUpdate( JSONObject jsonobject) {
 // To all the participants - Live Recording updates
}

public void onRoomLiveRecordingFailed( JSONObject jsonobject) {
 // To all the participants - Live Recording failed
}

Error Codes / Exceptions

CodeDescription
5086Endpoint application is not connected to the Room.
5097Start Live Recording methods are not available in the Chat-Only Room.
5138Failed to Start Live Recording with invalid configuration parameter.
5122Start Live Recording is in progress. Retrying to Start Live Recording is illegible.
5139Live Recording is already running. Retrying to Start Live Recording is illegible.

Stop Live Recording

Class: EnxRoom

Method

  • For Android SDK v2.1.2 – public void stopLiveRecording(JSONObject jsonObject);

Parameter:

streamingConfig: Optional. Streaming configuration. You may pass Streaming configuration data as it was passed with startLiveRecording() method.

  • For Android SDK v2.1.3+ – public void stopLiveRecording()

Callback:

  • onACKStopLiveRecording – Acknowledgment callback when the Live Recording stops.

Response Body:

{
                    data ={
                    data ={
                           confNum = 534010000012;
                           isRecordingStopped = 1;
                           type = recordingStopped;
                           };
                           isRecordingStarted = 0;
                           status ={
                           error = {
                           errorCode = 0;
                           errorDesc = "";
                           };
                           resultCode = 0;
                           success = 1;
                           };
                           streamerDetails ={
                           agentId = "d6acdf34-01f3-ca66-2bcc-789363adc043";
                    broadCastStreamerID = "b5296afd-1357-1de1-c89d-5dc0aca3e5ae";
                           };
                    };
                    status = {
                           error ={
                           errorCode = 0;
			   errorDesc = "";
            };
            resultCode = 0;
            success = 1;
        };
        streamerDetails =         {
            agentId = "d6acdf34-01f3-ca66-2bcc-789363adc043";
            broadCastStreamerID = "b5296afd-1357-1de1-c89d-5dc0aca3e5ae";
        };
    }
  • onRoomLiveRecordingOff – Notification to all users in the conference that the Live Recording has stopped.

Response Body:

                     {
        data =         {
            data =             {
                data =                 {
                    data =                     {
                        confNum = 534010000012;
                        isRecordingStopped = 1;
                        type = recordingStopped;
                    };
                    isRecordingStarted = 0;
                    status =                     {
                        error =                         {
                            errorCode = 0;
                            errorDesc = "";
                        };
                        resultCode = 0;
                        success = 1;
                    };
                    streamerDetails =                     {
                        agentId = "d6acdf34-01f3-ca66-2bcc-789363adc043";
                        broadCastStreamerID = "b5296afd-1357-1de1-c89d-5dc0aca3e5ae";
                    };
                };
                status =                 {
                    error =                     {
                        errorCode = 0;
                        errorDesc = "";
                    };
                    resultCode = 0;
                    success = 1;
                };
                streamerDetails =                 {
                    agentId = "d6acdf34-01f3-ca66-2bcc-789363adc043";
                    broadCastStreamerID = "b5296afd-1357-1de1-c89d-5dc0aca3e5ae";
                };
            };
            stoppedBy = "7f0f2b04-1ad4-4231-8fdc-9f9e014053b4";
        };
        type = "liveRecording-stopped";
    }
enxRoom.stopLiveRecording(jsonObject) 

// For v2.1.2 - Where streamingConfig/jsonObject =                
{
  "urlDetails": {
    "url": "url",
    "layOut": {},
    "chatOverlay": true/false
  }
}

enxRoom.stopLiveRecording()     // For v2.1.3+


public void onACKStopLiveRecording( JSONObject jsonobject) {
 // To the owner - Live Recording has stopped
}

public void onRoomLiveRecordingOff ( JSONObject jsonobject) {
 // To the participants - Live Recording stopped
}

Error Codes / Exceptions

CodeDescription
5086Endpoint application is not connected to the Room.
5097Start Live Recording methods are not available in the Chat-Only Room.
5138Failed to Start Live Recording with invalid configuration parameter passed.
5122Start Live Recording is in progress. Retrying to Start Live Recording is illegible.
5140Live Recording is not running in room. To Stop Live Recording is illegible.
5141Stop Live Recording is in progress. Retrying to Stop Live Recording is illegible.

Error Codes

Live Recording Waiting Queue

ErrorDescription
7039Live recording request was in waiting, successfully removed the request from waiting
7046Streaming request was in waiting, successfully removed the request from waiting
7080Live recording/streaming request in waiting queue failed to start
7081Live recording/streaming request in waiting queue failed to start
7104 Streaming request is in waiting, will be started soon
7105 Last streaming request is in waiting
7207Live Recording request is in waiting, will be started soon
7208Last live Recording request is in waiting

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.

Map<String, String> header= new HashMap<String, String>(1);
final String cred = "USERNAME" + ":" + "PASSWORD";
final String auth = "Basic "+ Base64.encodeToString(cred.getBytes(),Base64.URL_SAFE|Base64.NO_WRAP);
header.put("Authorization", auth);

videoView.setVideoURI(Uri.parse("VIDEO_URL"),header);
videoView.start();

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.