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:
- (void)startRecord
– No parameter required.- (void)stopRecord
– No parameter required.
Delegate Methods:
-
- startRecordingEvent
– Acknowledgment to the Moderator when recording starts. -
- stopRecoedingEvent
– Acknowledgment to the Moderator when recording stops. -
- roomRecordOn
– Notification to all the participants when the recording is turned on. -
- roomRecordOff
– Notification to all the participants when the recording is turned off.
[room startRecord]; // To start recording // To all participants that recording has started -(void)roomRecordOn:(NSArray*)Data{ /* Data is [ { "msg":"Room Recording On", "result":"0" }, "<null>" ] */ } // To acknowledge the moderator that recording has started -(void)startRecordingEvent:(NSArray *)response{ /* response is [ { "result":0, "msg":"Success" }, "<null>" ] */ } [room stopRecord]; // To stop recording // To all participants that recording has stopped -(void)roomRecordOff:(NSArray*)Data{ /*Data is [ { "msg":"Room Recording Off", "result":"0" }, "<null>" ] */ } // To acknowledge the moderator that recording has stopped -(void)stopRecordingEvent:(NSArray *)response{ /* response is [ { "result":0, "msg":"Success" }, "<null>" ] */ }
Error Codes & Exceptions
Code | Description |
---|---|
5007 | Unauthorized Access. When a participant tries to invoke startRecord() . |
5008 | Unauthorized Access. When a participant tries to invoke stopRecord() . |
5033 | Repeated startRecord() call while the previous request is in process. |
5034 | Repeated startRecord() call while the recording has already started. |
5035 | Repeated stopRecord() call while the previous request is in process. |
5036 | stopRecord() call without starting to record. Non-Contextual method call. |
Note: In case of error, <null> is received at 1st Index, and Error Info at 2nd Index.
New Way to Record Live with an UI
Availabiity: 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" } }
- Know more about Room Creation Payload using our Video API.
- Know how to create Custom View for Live Recording. Its the same way as we create View for Live Streaming.
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
Method: -(void)startLiveRecording:(NSDictionary *_Nonnull)streamingConfig;
Parameter:
streamingConfig
: Streaming configuration.
Callback:
didACKStartLiveRecording
– Acknowledgment callback to the Moderator when the Live Recording starts.didRoomLiveRecordingOn
– Notification to all users in the conference that the Live Recording has started.didRoomLiveRecordingFailed
– Notification to the users that recording failed to start or failed later after getting started.didRoomLiveRecordingUpdated
– Intermediate Notifications to all users with updates on the Live-Recording start request.
[enxRoom startLiveRecording: streamingConfig]; -(void)room:(EnxRoom* _Nullable)room didACKStartLiveRecording:(NSArray *_Nullable)data { // To the Moderator - Live Recording has started } -(void)room:(EnxRoom* _Nullable)room didRoomLiveRecordingOn:(NSArray *_Nullable)data { // To all the participants - Live Recording started } -(void)room:(EnxRoom* _Nullable)room didRoomliverecordingFailed:(NSArray*_Nullable)data { // To the executor of Method - Live Recording failed to start } -(void)room:(EnxRoom* _Nullable)room didRoomliverecordingUpdated:(NSArray*_Nullable)data { // To the executor of Method - Intermediate updates on the start recording progress }
Error Codes / Exceptions
Code | Description |
---|---|
5086 | Endpoint application is not connected to the Room. |
5097 | Start Live Recording methods are not available in the Chat-Only Room. |
5138 | Failed to Start Live Recording with invalid configuration parameter. |
5122 | Start Live Recording is in progress. Retrying to Start Live Recording is illegible. |
5139 | Live Recording is already running. Retrying to Start Live Recording is illegible. |
Stop Live Recording
The EnxRoom.stopLiveRecording()
method is used to stop live recording.
Class: EnxRoom
Method:
- For iOS SDK v2.1.2 –
-(void)stopLiveRecording:(NSDictionary *_Nonnull)streamingConfig;
Parameter:
streamingConfig
: Optional. Streaming configuration.
- For iOS SDK v2.1.3+ –
-(void)stopLiveRecording;
Callback:
didACKStopLiveRecording
– Acknowledgment callback to the Moderator when the Live Recording stops.
– Notification to all the participants in the conference that the Live Recording has stopped.didRoomLiveRecordingOff
[enxRoom stopLiveRecording:streamingConfig]; // For v2.1.2 [enxRoom stopLiveRecording]; // For v2.1.3+ -(void)room:(EnxRoom* _Nullable)room didACKStopLiveRecording:(NSArray *_Nullable)data { // To the Moderator - Live Recording has stopped } -(void)room:(EnxRoom* _Nullable)room didRoomliverecordingOff:(NSArray*_Nullable)data { // To all the participants - Live Recording stopped }
Error Codes / Exceptions
Code | Description |
---|---|
5086 | Endpoint application is not connected to the Room. |
5097 | Start Live Recording methods are not available in the Chat-Only Room. |
5138 | Failed to Start Live Recording with invalid configuration parameter passed. |
5122 | Start Live Recording is in progress. Retrying to Start Live Recording is illegible. |
5140 | Live Recording is not running in the room. To Stop Live Recording is illegible. |
5141 | Stop Live Recording is in progress. Retrying to Stop Live Recording is illegible. |
Error Codes
Live Recording Waiting Queue
Error | Description |
---|---|
7039 | Live recording request was in waiting, successfully removed the request from waiting |
7046 | Streaming request was in waiting, successfully removed the request from waiting |
7080 | Live recording/streaming request in waiting queue failed to start |
7081 | Live 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 |
7207 | Live Recording request is in waiting, will be started soon |
7208 | Last live Recording request is in waiting |
Play a Recorded File
In case you want to play Recorded File directly from Video Server, please note that those files are password protected. The portal Implemented HTTP Basic Authentication to secure recorded file storage.
Therefore, any Video Player, may not use the file-paths only to play them from the Video Server. Player must provide access credentials to pass through the authentication process to play the file.
let headerString = “USERNAME:PASSWORD” let videoFileURL = "URL" let data = headerString.data(using: .utf8) let basicAuth = “Basic” + date!.base64EncodedString( options: NSData.Base64EncodingOptions(rawValue: 0)) let headers = {“Authorization” : basicAuth } let asset = AVURLAsset( url: videoFileURL, options: { "AVURLAssetHTTPHeaderFieldsKey" : headers } ) let playerItem = AVPlayerItem(asset: asset) player = AVPlayer(playerItem: item)
Note:
- There is an alternate way. You should download the files from the Video Server to your Server and play from there without or with any security measure you may like to deploy.
- Files from the Portal Storage gets deleted after 72 hours. So, accessing them from Video Server to play is not guaranteed beyond 72 hours.