Using Portal 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 recordingstatic 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:
- Individual Participants Stream Recordings: Each users stream gets recorded individually and are made available for download. These files are in .MKV format.
- 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 Video API to get Files
Using Video 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
Portal 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. Portal supports delivery to the following location:
- FTP / SFTP to your Server
- SCP to your Server
- Amazon S3
- Azure Blob Storage
- Google Drive
Once configured, Portal 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, Portal notifies you through a Webhook Notification to help you automate workflow.
Get notified through Webhook
Portal 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, portal 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" } }
- 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.
- URL is optional. If you skip it, portal uses a default layout.
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
Method: static 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.
- urlDetails – Its a JSON Object to define Custom View and its options. It may be empty to work on default values.
Event Notifications:
– Acknowledgement to notify that the start recording command has been accepted.onACKStartLiveRecording
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
Code | Description |
---|---|
7000 | Generic Server Error |
7011 | Start Live Recording timeout, Internal Server Error |
7012 | Live Recording Request is in Process |
7013 | Start Live Recording Request timeout, Internal Server Error |
7014 | Recording will be made available post-session with a delay |
7015 | Live Recording can’t be started now, please try after 2 minutes |
7016 | Start Recording Input Parameters missing, Internal Server Error |
7017 | Start Live Recording Input Parameters missing, Internal Server Error |
7018 | Can’t start Live Recording, Internal Server Error |
7019 | Live Recording already running |
7020 | Start Streaming Failed, Internal Server Error |
7201 | Only moderator can start Live Recording |
7202 | Invalid URL format |
7203 | Room is disconnecting, cannot start live recording |
7204 | Live Recording error |
7205 | Can’t start Live Recording, Fall-back tried but legacy recording already started |
Stop Live Recording
Method: EnxRtc.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
Code | Description |
---|---|
7000 | Generic Server Error |
7031 | Stop Live Recording timeout, Internal Server Error |
7032 | Stop Live Recording timeout, Internal Server Error |
7033 | Stop Live Recording timeout, Internal Server Error |
7034 | Used internally |
7035 | Failed to stop fall-back legacy recording |
7036 | Only moderator can stop Live Recording |
7037 | Room is disconnecting, Live Recording will be stopped |
Error Codes
Call State Change Event
Code | Description |
---|---|
7000 | Generic Server Error |
7021 | Streaming/Recording Not requested, Invalid State |
7022 | Start Streaming Failed, Internal Server Error |
7023 | Call State Changed, could not find RTMP URL |
7024 | Start Live Recording Failed, Internal Server Error |
7025 | Call State Changed, could not get recording_name or recording_path |
7026 | Call State Changed, got state as disconnected |
7027 | Call State Changed, wrong state in request |
7028 | Call State Changed, could not find allocated broker |
7029 | Call State Changed Input Parameter confNum missing |
Start Streaming
Code | Description |
---|---|
7000 | Generic Server Error |
7001 | Start Streaming timeout, Internal Server Error |
7002 | Start Streaming Request is in process |
7003 | Start streaming Request timeout, Internal Server Error |
7004 | Streaming Can’t be started now, Please try after 2 minutes |
7005 | Start Streaming Input Parameters missing, Internal Server Error |
7006 | Start Streaming Input Parameters missing, please provide rtmpUrl and url |
7007 | Start Streaming Input Parameters missing, Internal Server Error |
7008 | Only moderator can start streaming |
7009 | Invalid or undefined streaming configuration |
7101 | rtmpUrl should not exceed more than 3 values |
7102 | Invalid rtmp or url format |
7103 | Room is disconnecting, cannot start streaming |
Stop Streaming
Error | Description |
---|---|
7000 | Generic Server Error |
7041 | Stop Streaming timeout, Internal Server Error |
7042 | Stop Streaming Failed, Internal Server Error |
7043 | Stop Streaming Failed, Internal Server Error |
7044 | Only the moderator can stop streaming |
7045 | Room is disconnecting, streaming will be stopped |
Generic Error
Error | Description |
---|---|
7000 | Stop Streaming/Recording service Timeout |
7000 | Stop Streaming/Live Recording service Failed, Internal Server Error |
7000 | Invalid input stop Streaming/Recording service Failed, Internal Server Error |
Move File CallBack
Error | Description |
---|---|
7000 | Generic Server Error |
7051 | Recording File Movement failed |
7052 | Recording File Movement failed |
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 |
Other Error Codes
Error | Description |
---|---|
7061 | Internal Server Error Live Recording cannot be started, please try again |
7071 | Only moderator can change live recording params |
7072 | Only moderator can change streaming params |
7073 | User didn’t provided supported layout, Error in changing liveRecording |
7074 | Live Recording/streaming not running cannot change params |
7075 | User didn’t provided layout, Error in changing liveRecording |
7076 | Recording file movement in process, cannot move log files now |
7077 | Log File Movement failed |
7078 | Room is disconnecting, cannot change streaming params |
7079 | Room is disconnecting, cannot change live recording params |
Play a Recorded File
In case you want to play Recorded File directly from video Server, please note that those files are password protected. 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 Video 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 Video Server to your Server and play from there without or with any security measure you may like to deploy.
- Files from portal Storage gets deleted after 72 hours. So, accessing them from Video Server to play is not guaranteed beyond 72 hours.