Using EnableX you may get a RTC session recorded as individual streams and later be transcoded through a post-session service to create a single video file which can be retrieved and re-played using any Video Player. Recording can be started in 2 ways, viz.

Table of Contents

Ways to Record

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 startRecord() method, and to stop may use 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 participant swill be notified using onRoomRecordingOn and onRoomRecordingOff event listener respectively.

Methods:

  • static Future<void> startRecord() – No parameter needed. To start recording
  • static Future<void> stopRecord() – No parameter needed. To stop recording

Event Listeners:

  • onStartRecordingEvent – To moderator to notify that recording has started
  • onStopRecordingEvent – To moderaor to notify that recording has stopped
  • onRoomRecordingOn – To all participant to notify recording is on
  • onRoomRecordingOff – To all participant to notify recording is off
EnxRtc.startRecord(); // To start recording
EnxRtc.stopRecord(); // To stop recording

EnxRtc.onRoomRecordingOn= (Map<dynamic, dynamic> map) {
	// To all participant to notify recording is on
	// map is {"msg":"Room Recording On","result":"0”}
};

EnxRtc.onRoomRecordingOff= (Map<dynamic, dynamic> map) {
	// To all participant to notify recording is off
	// map is {"msg":"Room Recording Off","result":"0”}
};

EnxRtc.onStartRecordingEvent= (Map<dynamic, dynamic> map) {
	// To moderator to notify that recording has started
	// map is {"result":0”,"msg":"Success"}
};

EnxRtc.onStopRecordingEvent= (Map<dynamic, dynamic> map) {
	// To moderator to notify that recording has stopped
	// map is {"result":0”,"msg":"Success"}
};

EnxRtc. onRoomRecordingOff= (Map<dynamic, dynamic> map) {
  // To all participant to notify recording is 
   //where map is
  //{"msg":"Room Recording Off","result":"0”}

};

Note:

  • Moderator can start/stop recording any number of time during a session as he wishes.
  • Moderator can stop recording in a room defined with auto-recording feature.

Get Recording Files

Type of Recording Files

The following type of files you get in the recording process:

  1. Individual Participants Stream Recordings: Each users stream gets recorded individually and are made available for download. These files are in .MKV format.
  2. Transcoded Re-playable Session:  It’s a single composite video file created out of all the individual participant’s streams in the right playtime. These files are created in .MP4 format. Transcoding is a subscription based service. The Transcoded files are made available for download. If moderator has recorded different segment of Video Session, you get multiple .MP4 files, one for each recorded segments. Transcoding is done in a predefined layout.

Note: Individual Stream Recordings are available for download within minutes post session. However, transcoding process to create single playable file takes longer to finish. Therefore, transcoding files may be available for download within 10-45 minutes post session depending on transcoding queue.

Use Server API to get Files

Using Server API you can fetch Archive Reports through a HTTP GET request to its archive route. You may use the following filters to get the right set of Archive Report as designed:

  • For a Period – For a given From and To date
  • For a Room ID
  • For a Room ID within a Period
  • For a specific Session – For a given Conference Number

After getting the Archive Report, you may need to do HTTP GET to each of the URLs given in the Report to download files individually.

Please refer to online documentation for detailed explanation of API calls.

Get Files delivered

EnableX delivers your files your location / server / storage using its Archive Delivery Service. You need to configure your Delivery Loation using Portal.

Portal Login > Video >  Settings > Archive

Using this Tool, define your Delivery Server with Access Credentials. EnableX supports delivery to the following location:

  • FTP / SFTP to your Server
  • SCP to your Server
  • Amazon S3
  • Azure Blob Storage
  • Google Drive

Once configured, EnableX transfers your files and keep them organized in sub-folders in the folder you designated for delivery.

File delivery is a batch process. You may face significant delay in delivery. After a file is delivered to your location, EnableX notifies you through a Webhook Notification to help you automate workflow.

Get notified through Webhook

EnableX may notify you as soon as any file is available for downloading or as soon as a file gets delivered to your location by HTTP POST to a designated Webhook URL. You need to setup the URL at your Project Server. To configure your Webhook URL, follow the path:

Portal Login > Video >  Settings > Preferences > Webhook

Once configured, EnableX does HTTP POST with JSON Raw Body to the URL for you to process. Note that you need to do HTTP GET to each of the URLs given in the JSON to download files individually. JSON Format given below:

// When a Recording files are ready 
{	
	“type”: “recording”,
	“trans_date”: “Datetime”,  /* In UTC */
	“app_id”: “String”,
	“room_id”: “String”,
	“conf_num”: “String”,
	“recording”: [ 
		{ "url": "http://FQDN/path/file" }
	]
}

// When Transcoded Video files is ready
{	
	“type”: “transcoded”,
	“trans_date”: “Datetime”,  /* In UTC */
	“app_id”: “String”,
	“room_id”: “String”,
	“conf_num”: “String”,
	“transcoded”: [ 
		{ "url": "http://FQDN/path/file" }
	]
}

// When Chat Scripts are ready 
{
	“type”: “chatdata”,
	“trans_date”: “Datetime”,  /* In UTC */
	“app_id”: “String”,
	“room_id”: “String”,
	“conf_num”: “String”,
	“chatdata”: [ 
		{ "url": "http://FQDN/path/file" }
	]
}

Please refer to online documentation for detailed explanation of Webhook Notification.

New Way to Record Live with an UI

Availabiity: v2.1.5+

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 given below.

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: EnxRtc

Methodstatic Future startLiveRecording(Map <String, Dynamic> config) – to start live recording – to start live recording.

Parameters:

  • config– Recording configuration. Its a JSON object with following keys:
    • urlDetails – Its a JSON Object to define Custom View and its options. It may be empty to work on default values.
      • 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). If its empty, default layout will be used.
      • 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.

Event Notifications:

  • onACKStartLiveRecording – Acknowledgement to notify that the start recording command has been accepted.
  • onLiveRecordingNotification – Notification to all users when Live Recording gets started. A new user joining the session gets the same notification if the session is being recorded live.

Response Body:

{
	data = {
		status =  {
			resultCode = 0,
                        success = true,
                        error = {
				errorCode = 0;
                                errorDesc = "";
			} 
		},
		startedBy = "7f0f2b04-1ad4-4231-8fdc-9f9e014053b4",
	},
        type = "room-live-recording-on";
}

Code Example:

Map<String, dynamic> config = {
	"urlDetails": {}
};

//Method calling
await EnxRtc.startLiveRecording(config);

// Acknowledgement
EnxRtc.onACKStartLiveRecording=(Map<dynamic, dynamic> map){
      print('onACKStartLiveRecording' + jsonEncode(map));
}

// Notification to all 
EnxRtc.onLiveRecordingNotification=(Map<dynamic, dynamic> map){
      print('onLiveRecordingNotification' + jsonEncode(map));
}

Error Codes / Exceptions

CodeDescription
7000Generic Server Error
7011Start Live Recording timeout, Internal Server Error
7012Live Recording Request is in Process
7013Start Live Recording Request timeout, Internal Server Error
7014Recording will be made available post-session with a delay
7015Live Recording can’t be started now, please try after 2 minutes
7016Start Recording Input Parameters missing, Internal Server Error
7017Start Live Recording Input Parameters missing, Internal Server Error
7018Can’t start Live Recording, Internal Server Error
7019Live Recording already running
7020Start Streaming Failed, Internal Server Error
7201Only moderator can start Live Recording
7202Invalid URL format
7203Room is disconnecting, cannot start live recording
7204Live Recording error
7205Can’t start Live Recording, Fall-back tried but legacy recording already started

Stop Live Recording

MethodEnxRtc.stopLiveRecording() – To stop live recording

Event Notifications:

  • onACKStopLiveRecording – Acknowledgement that stop recording request is received.

Response Body:

{
	data = {
		status: {
                        resultCode: 0,
                        success: true,
                        error: { errorCode: 0, errorDesc: '' }
		},                                         
                stoppedBy = "7f0f2b04-1ad4-4231-8fdc-9f9e014053b4",
	},
        type = "room-live-recording-off";
}
//Method calling
await EnxRtc.stopLiveRecording(config);

// Acknowledgement
EnxRtc.onACKStopLiveRecording=(Map<dynamic, dynamic> map){
      print('onACKStopLiveRecording' + jsonEncode(map));
}

Error Codes / Exceptions

CodeDescription
7000Generic Server Error
7031Stop Live Recording timeout, Internal Server Error
7032Stop Live Recording timeout, Internal Server Error
7033Stop Live Recording timeout, Internal Server Error
7034Used internally
7035Failed to stop fall-back legacy recording
7036Only moderator can stop Live Recording
7037Room is disconnecting, Live Recording will be stopped

Error Codes

Call State Change Event

Code Description
7000Generic Server Error
7021Streaming/Recording Not requested, Invalid State
7022Start Streaming Failed, Internal Server Error
7023Call State Changed, could not find RTMP URL
7024Start Live Recording Failed, Internal Server Error
7025Call State Changed, could not get recording_name or recording_path
7026Call State Changed, got state as disconnected
7027Call State Changed, wrong state in request
7028Call State Changed, could not find allocated broker
7029Call State Changed Input Parameter confNum missing

Start Streaming

CodeDescription
7000Generic Server Error
7001Start Streaming timeout, Internal Server Error
7002Start Streaming Request is in process
7003Start streaming Request timeout, Internal Server Error
7004Streaming Can’t be started now, Please try after 2 minutes
7005Start Streaming Input Parameters missing, Internal Server Error
7006Start Streaming Input Parameters missing, please provide rtmpUrl and url
7007Start Streaming Input Parameters missing, Internal Server Error
7008Only moderator can start streaming
7009Invalid or undefined streaming configuration
7101rtmpUrl should not exceed more than 3 values
7102Invalid rtmp or url format
7103Room is disconnecting, cannot start streaming

Stop Streaming

ErrorDescription
7000Generic Server Error
7041Stop Streaming timeout, Internal Server Error
7042Stop Streaming Failed, Internal Server Error
7043Stop Streaming Failed, Internal Server Error
7044Only the moderator can stop streaming
7045Room is disconnecting, streaming will be stopped

Generic Error

ErrorDescription
7000Stop Streaming/Recording service Timeout
7000Stop Streaming/Live Recording service Failed, Internal Server Error
7000Invalid input stop Streaming/Recording service Failed, Internal Server Error

Move File CallBack

ErrorDescription
7000Generic Server Error
7051Recording File Movement failed
7052Recording File Movement failed

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

Other Error Codes

ErrorDescription
7061Internal Server Error Live Recording cannot be started, please try again
7071Only moderator can change live recording params
7072Only moderator can change streaming params
7073User didn’t provided supported layout, Error in changing liveRecording
7074Live Recording/streaming not running cannot change params
7075User didn’t provided layout, Error in changing liveRecording
7076Recording file movement in process, cannot move log files now
7077Log File Movement failed
7078Room is disconnecting, cannot change streaming params
7079Room is disconnecting, cannot change live recording params

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.

# https://pub.dev/packages/video_player

// HTTP Basic Authentication Credentials
String username = Username';
String password = 'Password';
String videoFilePath = 'URL';

String basicAuth = 'Basic ' + base64Encode(utf8.encode('$username:$password'));

VideoPlayerController _controller;
_controller = VideoPlayerController.network(
	videoFilePath,
	httpHeaders: {'authorization': basicAuth},);

_controller.addListener(() {
	setState(() {});
});

_controller.setLooping(true);
_controller.initialize();

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.