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

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 Enx.startRecord() method, and to stop may use Enx.stopRecord() method. On successful initiation of recording and stopping of recording the moderator will be notified using startRecordingEvent and stopRecordingEvent callbacks; also, all other participant swill be notified using roomRecordingOn and roomRecordingOff Callbacks respectively.

Methods:

  • Enx.startRecord() – No parameter needed. To start recording
  • Enx.stopRecord() – No parameter needed. To stop recording

Callbacks:

  • startRecordingEvent – To moderator to notify that recording has started
  • stopRecordingEvent – To moderaor to notify that recording has stopped
  • roomRecordingOn – To all participant to notify recording is on
  • roomRecordingOff – To all participant to notify recording is off
Enx.startRecord(); // Start Recording

// To moderator: Recording started
startRecordingEvent : event=>{
	// event = { result: 0, msg: “success”}
}

// To participants: Recording started
roomRecordingOn :event =>{
	// event = { result: 0, msg: "Room recording On"}
}

Enx.stopRecord(); // Stop Recording

// To moderator: Recording stopped
stopRecordingEvent : event=>{
	// event = { result : 0, msg : “success”}
}

// To participants: Recording stopped
roomRecordingOff :event =>{
	// event = { result: 0, msg: "Room recording Off"}
}

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.

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.

npm install --save react-native-video

var username = 'Username';
var password = 'Password';
var videoFilePath = 'URL';

var basicAuth = ='Basic' + binaryToBase64(
	utf8.encode(username + ':' + password)
);

<Video source={{
	uri: videoFilePath,
	headers: {
		'Authorization': basicAuth
	}
}}

ref={(ref) => {
	this.player = ref
}}

onBuffer={this.onBuffer}                
onError={this.videoError}/>

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.