Session Management
The Web SDK provides the following methods for managing video sessions:
- startRecord(): To start recording a session.
- stopRecord(): To stop recording a session.
- startLiveRecording(): To start live recording of a session (v.2.1.2 and later).
- stopLiveRecording(): To stop live recording of a session (v.2.1.2 and later).
- hardMute(): To hard-mute a room.
- hardUnMute(): To put the room off a hard-mute state.
- hardMuteUserAudio(): To hard-mute audio streams of a participant.
- hardMuteUserVideo(): To hard-mute video streams of a participant.
- hardUnMuteUserAudio(): To unmute audio streams of a participant.
- hardUnMuteUserVideo(): To unmute video streams of a participant.
- lock(): To lock a room.
- unLock(): To unlock a room.
- approveAwaitedUser(): To approve a user's entry.
- denyAwaitedUser(): To decline a user's entry.
- dropUser(): To disconnect/force-drop one or more participants from a session.
- extendConferenceDuration(): To extend the duration of a session.
- destroy(): To conclude an ongoing session.
- switchUserRole(): To promote a participant to act as a moderator in the ongoing session.
- pinUsers(): To pin a user to the Active Talker list.
- unpinUsers(): To unpin a user from the Active Talker list.
- addSpotlightUsers(): To spotlight a user.
- removeSpotlightUsers(): To remove the spotlight from users streams.
- switchRoomMode(): To switch the room mode.
Record a Session (Legacy Recording)
You can record an RTC session as an individual stream and 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.
A session can be recorded in the following ways:
Auto-Recording a Session
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 of the room can stop the recording using the stopRecord() method.
On-Demand Recording
The EnxRoom.startRecord()
method allows a moderator to start recording a session. You can use this method to provide options on the UI for the moderator to access them. There is no limit to the number of times a moderator can start recording.
- Method:
EnxRoom.startRecord(Callback)
- Event Notifications:
room-record-on
: Notification to all the participants in a room along with Moderator ID when the recording is turned on.
Sample Code
// To start recordingroom.startRecord( function( result, error ) {if (result == 0) {// Recording started}});// Notification: TO all. Recording startedroom.addEventListener( "room-record-on", function(event) {// Recording started, Update UI// event.message.moderatorId = Moderator who stated recording.});
Stop Recording a Session
The EnxRoom.stopRecord()
method is used to stop recording of a session. There is no limit to the number of times a moderator can start/stop recording.
- Method:
EnxRoom.stopRecord(Callback)
- Event Notifications:
room-record-off
: Notification to all the participants in a room along with Moderator ID when the recording is turned off.
Sample Code
// To stop recordingroom.stopRecord( function( result, error ) {if (result == 0){// Recording stopped}});// Notification recording stopped to allroom.addEventListener( "room-record-off", function(event) {// Recording stopped, Update UI// event.message.moderatorId = Moderator who stopped recording.});
Record a Session (Live Recording)
This functionality is available in Web SDK 2.1.2 and later.
Recording live refers to a new process of creating a transcoded file in a live session with a custom layout without recording individual streams.
It provides the following advantage:
- You get a transcoded file within minutes post-session without waiting for long like the previous transcoding process.
- Unlike the previous transcoding processes created in a predefined layout, you can define your own layout for the live recording process.
A session can be live-recorded in the following ways:
Auto Live-Recording
You can configure a room to automatically start live recording when the first person joins the room. To do this, add the following settings while creating a room:
"settings": {"live_recording": {"auto_recording: true,"url": "https://your-custom-view-url"}}
For more information, see the the following:
- Room Creation Payload using Video API.
- Create a View for Live Recording. It is the same as creating a view for live streaming.
A moderator can stop live recording in a room using the stopRecord()
method.
On-Demand Live Recording
The EnxRoom.startLiveRecording()
method allows moderators to start live recording of video sessions.
- Method:
EnxRoom.startLiveRecording(config, callback)
- Parameters:
config
:Recording 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. How to create a Custom View for Live Recordingany_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
: The Callback function.
- Event Notifications:
room-live-recording-on
: Notification to all users when live recording is started. A new user joining the session also gets the same notification if the session is being recorded live.room-live-recording-failed
: Notification to the moderator who tried to start live recording when the recording fails.room-live-recording-updated
: Intermediate notification to the moderator who tried to start live recording with the start-process updates.
Sample Code
var myRecordConfig={};myRecordConfig.urlDetails = {"url": "url","layOut": {},"chatOverlay": false};room.startLiveRecording(myRecordConfig, function(resp){if(resp.data.status.resultCode == 0) {// Recording initiated}});room.addEventListener("room-live-recording-on", function(event) {// Live recording is on. JSON Explained given below});room.addEventListener("room-live-recording-failed", function(event) {// Failed to live record});
Sample Response: Event JSON with room-live-recording-on
{"data": {"status": {"resultCode" : 0,"success" : true,"error" : {"errorCode" : 0,"errorDesc" : ""}},"startedBy" : "7f0f2b04-1ad4-4231-8fdc-9f9e014053b4"},"type" : "room-live-recording-on"}
Stop Live Recording
The EnxRoom.stopLiveRecording()
method allows moderators to stop live recording of video sessions.
- Method:
EnxRoom.stopLiveRecording(config, callback)
- Parameters:
config
: JSON Object. Optional. You can pass the recording configuration data as it was passed with thestartLiveRecording()
method.callback
: Callback function
- Event Notifications:
room-live-recording-off
: Notification to all users when live recording stops.
Sample Code
var myRecordConfig={};room.stopLiveRecording(myRecordConfig, function(resp){if(resp.data.status.resultCode == 0) {// Stopping live recording}});// Notification: To all. Live Recording stopped.room.addEventListener("room-live-recording-off", function(event) {// Live recording stopped. event JSON given later.});
Sample Response: Event JSON with room-live-recording-off
{"data": {"status": {"resultCode": 0," succes"s: true,"error": {"errorCode": 0,"errorDesc": ''}},"stoppedBy": "7f0f2b04-1ad4-4231-8fdc-9f9e014053b4",},"type": "room-live-recording-off"}
Error Codes
Call State Change Event
Code | Description |
---|---|
7000 | A generic server error has occurred. |
7021 | Streaming/recording is not requested. The state is not valid. |
7022 | The request to start streaming has failed. An internal server error has occurred. |
7023 | The call state is changed. The RTMP URL is not found. |
7024 | The request to start the live recording has failed. An internal server error has occurred. |
7025 | The call state is changed. The recording_name or recording_path is not obtained. |
7026 | The call state is changed. The state is fetched as disconnected. |
7027 | The call state is changed. The request contains a wrong state. |
7028 | The call state is changed. The allocated broker is not found. |
7029 | The call state is changed. The confNum input parameter is missing. |
Start Streaming
Code | Description |
---|---|
7000 | A generic server error has occurred. |
7001 | The request to start streaming has timed-out. An internal server error has occurred. |
7002 | The request to start streaming is in process. |
7003 | The request to start streaming has failed. An internal server error has occurred. |
7004 | Streaming cannot be started now. Try it again after 2 minutes. |
7005 | Input parameters for starting the stream are missing. An internal server error has occurred. |
7006 | Input parameters, rtmpUrl and url, for starting the stream are missing. Specify these parameters. |
7007 | Input parameters for starting the stream are missing. An internal server error has occurred. |
7008 | Only the moderator can start streaming. |
7009 | An invalid or undefined streaming configuration is specified. |
7011 | Request to start the live recording has timed-out. An internal server error has occurred. |
7012 | Live recording request is in process. |
7013 | Request to start the live recording has timed-out. An internal server error has occurred. |
7014 | Recording will be made available post-session with a delay. |
7015 | Live recording cannot be started now. Try it again after 2 minutes. |
7016 | Input paramters to start the recording are missing. An internal server error has occurred. |
7017 | Input parameters to start live recording are missing. An internal server error has occurred. |
7018 | Cannot start live recording. An internal server error has occurred. |
7019 | Live recording is already running. |
7020 | Failed to start streaming. An internal server error has occurred. |
7101 | rtmpUrl should not exceed more than 3 values. |
7102 | An invalid value or format of RTMP URL is specified. |
7103 | The room is disconnecting and cannot start streaming . |
7201 | Only a moderator can start live recording. |
7202 | Invalid format of the URL. |
7203 | The room is disconnecting, cannot start live recording. |
7204 | Live recording has encountered an error. |
7205 | Cannot start live recording, tried fall-back but legacy recording has already started. |
Stop Streaming
Code | Description |
---|---|
7000 | A generic server error has occurred. |
7031 | The request to stop the live recording has timed-out. An internal server error has occurred. |
7032 | The request to stop the live recording has timed-out. An internal server error has occurred. |
7033 | The request to stop the live recording has timed-out. An internal server error has occurred. |
7034 | Used internally |
7035 | Failed to stop the fall-back legacy recording. |
7036 | Only the moderator can stop live recording. |
7037 | The room is disconnecting, the live recording of the room will be stopped. |
7041 | The request to stop streaming has timed-out. An internal server error has occurred. |
7042 | The request to stop streaming has timed-out. An internal server error has occurred. |
7043 | The request to stop streaming has failed. An internal server error has occurred. |
7044 | Only the moderator can stop streaming. |
7045 | The room is disconnecting and streaming will be stopped. |
Generic Error
Code | Description |
---|---|
7000 | The stop streaming/recording service has timed-out. An internal server error has occurred. |
7000 | The stop streaming/recording service has failed. An internal server error has occurred. |
7000 | The stop streaming/recording service has failed due to invalid input. An internal server error has occurred. |
Move File CallBack
Code | Description |
---|---|
7000 | A generic server error has occurred. |
7051 | Movement of the recording file has failed. |
7052 | Movement of the recording file has failed. |
Live Recording Waiting Queue
Code | Description |
---|---|
7039 | The live recording request was in the waiting queue. It is successfully removed from the queue. |
7046 | The streaming request was was in the waiting queue. It is successfully removed from the queue. |
7080 | The live recording/streaming request in the waiting queue has failed to start. |
7081 | The live recording/streaming request in the waiting queue has failed to start. |
7104 | The streaming request is in the waiting queue and will be started soon. |
7105 | The last streaming request is in the waiting queue. |
7207 | The live recording request is in the waiting queue and will be started soon. |
7208 | The last live recording request is in the waiting queue. |
Miscellaneous
Code | Description |
---|---|
7061 | An internal server error has occurred. Live Recording cannot be started. Try again after sometime. |
7071 | Only moderator can change the live recording parameters. |
7072 | Only moderator can change the streaming parameters. |
7073 | The user has not provided the supported layout. An error has occurred while changing liveRecording. |
7074 | The live recording/streaming is not running. The parameters cannot be changed. |
7075 | The user has not provided the layout. An error has occurred while changing liveRecording. |
7076 | Movement of the recording file is in process. The log files cannot be moved now. |
7077 | Movement of the log file has failed. |
7078 | The room is disconnecting, the streaming parameters cannot be changed. |
7079 | The room is disconnecting, the live recording parameters cannot be changed. |
Watermark a Recorded File
You may want to watermark your recorded files with an image file uploaded through your portal against your project. Only Transcoded files are watermarked.
Perform the following actions to watermark a transcoded file:
Upload a Watermarking File
Upload a watermark file against your project from Portal Login > Video > Settings > Recording > Watermarking. The file must meet the following specifications:
- Image Format: PNG
- Image Dimension: 140×140 pixels (maximum)
Enable a Room for Watermarking
You need to create a room with watermarking enabled in it as shown in the below example.
Sample Code
{ "name": "My room","owner_ref": "XOXO","settings": {"watermark": true}}
Get the Recording Files
Type of Recording Files
The following type of files are obtained in the recording processes:
- Individual Participant Stream Recording Files: In the legacy recording process, each user's stream is individually recorded and is made available for download. These files are in the MKV format.
- Transcoded Re-playable Session Video File: It is a single composite video file created from all the individual participant streams in the suitable playtime. These files are created in MP4 format. Transcoding is a subscription-based service. The transcoded files are made available for download. If the moderator has recorded different segments of a video session, you get multiple MP4 files, one for each recorded segment. Transcoding is performed in a predefined layout.
- Re-playable Live-Recording File: It is a single Video file created through Live Recording process. These files are created in MP4 format. If the moderator has recorded different segments of a video session, you get multiple MP4 files, one for each recorded segment. Live-recording is performed in a custom layout.
Note: Individual stream recordings are available for download within minutes after the session is completed. However, the transcoding process to create a single playable file takes longer to finish. Therefore, transcoding files may be downloaded within 10-45 minutes post-session, depending on the length of the transcoding queue.
Get Recording Files using Video API
Using the Video API, you can fetch archive reports through an HTTP GET request to its archive route. You can use the following filters to get the right set of archive reports 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 issue an HTTP GET request to each URL provided in the report to download the files individually.
For a detailed explanation of API calls, click here.
Get Recording Files delivered
EnableX delivers your files to your location, server, or storage using its Archive Delivery service. You need to configure your delivery location through the EnableX portal (Portal Login > Video > Settings > Archive). Using this service, define your delivery server with access credentials.
Supported Delivery Locations
EnableX supports delivery to the following locations:
- FTP/SFTP to your Server
- SCP to your Server
- Amazon S3
- Azure Blob Storage
- Google Drive
Once the delivery folder is configured, EnableX transfers your files and keeps them organized in sub-folders in the folder you designated for delivery.
File delivery is a batch process. You may face a 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 Webhook Notification When a Recording File is Available
EnableX may notify you as soon as any file is available for downloading or when a file is delivered to your location by HTTP POST to a designated Webhook URL. You need to set up the URL on your Project Server. To configure your Webhook URL, log in to the EnableX portal, go to Video > Settings > Preferences > Webhook.
Once configured, EnableX makes an HTTP POST request with the JSON raw body to the URL for you to process. Note that you need to do HTTP GET to each URL in the JSON to download the files individually.
Sample Code
// When the individual stream 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 the transcoded video files are ready{"type": "transcoded",i "trans_date": "Datetime", // In UTC"app_id": "String","room_id": "String","conf_num": "String","transcoded": [{ "url": "http://FQDN/path/file" }]}// When live-recorded files are ready{"type": "live_recording","trans_date": Number, // In UTC"app_id": "String","room_id": "String","conf_num": "String","url": "http://FQDN/path/file","file_size": "String", // In byte}// When the 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" }]}
More information: Webhook Notifications.
Hard Mute or Unmute a Room
Hard Mute a Room
The EnxRoom.hardMute()
method allows moderators to hard-mute a room where all the participants are muted. A new participant joining a room in a hard-mute state is automatically muted. The right to unmute a hard-muted room lies only with the moderator. Participants can neither unmute a room or their local streams.
- Method:
EnxRoom.hardMute(Callback)
- Event Notifications:
hard-mute-room
: Notification to all the participants in the room along with Moderator ID when the room is hard-muted.
Sample Code
room.hardMute(function (result, error) {/* result JSON{ "result": 0,"msg": "Room is muted"}*/});// Notification: To all. Room is hard-mutedroom.addEventListener("hard-mute-room", function (res) {// res.moderator = Moderator who hard-muted Room.});
Hard Unmute a Room
The EnxRoom.hardUnMute()
method is used to change the hard-mute state of a room.
- Method:
EnxRoom.hardUnmute(Callback)
- Event Notifications:
hard-unmute-room
: Notification to all the participants in the room along with Moderator ID when the hard-mute state of the room is changed.
Sample Code
room.hardUnmute(function (result, error) {/* Result JSON{ "result": 0,"msg": "Room is un-muted"}*/});// Notification: To all. Room is hard-unmutedroom.addEventListener("hard-unmute-room", function (res) {// res.moderator = Moderator who hard-unmuted Room.});
Hard Mute or Unmute a Participant
Hard Mute a Participant
The EnxRoom.hardMuteUserAudio()
and EnxRoom.hardMuteUserVideo()
methods allow moderators to hard-mute the audio and video streams of participants. The affected participants cannot unmute their audio and video streams.
The right to hard-mute a participant lies only with the moderator.
- Methods:
hardMuteUserAudio(clientId, Callback)
: To hard-mute participant's audiohardMuteUserVideo(clientId, Callback)
: To hard-mute participant's video
- Parameters:
clientId
: String. The user whose audio/video needs to be hard-muted.
- Event Notifications:
hardmute-user-audio
: Notification to the affected participant when his audio is hard-muted.hardmute-user-video
: Notification to the affected participant when his video is hard-muted.user-audio-muted
: Notification to all the participants in the room when a participant's audio is hard-muted.user-video-muted
: Notification to all the participants in the room when a participant's video is hard-muted.
All event messages include the Moderator ID who hard-muted audio/video of a participant.
Sample Code
// Hard mute User's audioroom.hardMuteUserAudio(clientId, function(response) {if (response.result === 0) {// Success}else {// Failed}});// Hard mute User's videoroom.hardMuteUserVideo (clientId, function(response) {if (response.result === 0) {// Success}else {// Failed}});// Notification: To affected user. Hard muted audioroom.addEventListener('hardmute-user-audio', function(event) {// event.moderator = Who hard-muted user's Audio.});// Notification: To affected user. Hard muted videoroom.addEventListener('hardmute-user-video', function(event) {// event.moderator = Who hard-muted user's Video.});// Notification: To all. Audio muted for a userroom.addEventListener('user-audio-muted', function(event) {// Info about user event.stream.attributes});// Notification: To all. Video muted for a userroom.addEventListener('user-video-muted', function(event) {// Info about user event.stream.attributes});
Hard Unmute a Participant
Moderators can unmute a participant's audio or video streams using EnxRoom.hardUnMuteUserAudio()
and EnxRoom.hardUnMuteUserVideo()
methods.
The right to hard-unmute a participant lies only with the moderator.
- Methods:
hardUnmuteUserAudio(clientId, Callback)
: To hard-unmute participant's audiohardUnmuteUserVideo(clientId, Callback)
: To hard-unmute participant's video
- Parameter:
clientId
: String. The user whose audio/video needs to be hard-unmuted.
- Event Notifications:
hardunmute-user-audio
: Notification to the affected participants when their audio is lifted off the hard-mute state.hardunmute-user-video
: Notification to the affected participant when their video is lifted off the hard-mute state.user-audio-unmuted
: Notification to all the participants in the room when a participant's audio is lifted off the hard-mute state.user-video-unmuted
: Notification to all the participants in the room when a participant's video is lifted off the hard-mute state.
All event messages carry Moderator ID who hard-unmuted audio/video of a participant.
Sample Code
// Hard mute User's audioroom.hardMuteUserAudio(clientId, function(response) {if (response.result === 0) {// Success}else {// Failed}});// Hard mute User's videoroom.hardMuteUserVideo (clientId, function(response) {if (response.result === 0) {// Success}else {// Failed}});// Notification: To affected user. Hard unmuted audioroom.addEventListener('hardmute-user-audio', function(event) {// event.moderator = Who hard-unmuted user's Audio.});// Notification: To affected user. Hard unmuted videoroom.addEventListener('hardmute-user-video', function(event) {// event.moderator = Who hard-unmuted user's Video.});// Notification: To all. Audio unmuted for a userroom.addEventListener('user-audio-muted', function(event) {// Info about user event.stream.attributes});// Notification: To all. Video unmuted for a userroom.addEventListener('user-video-muted', function(event) {// Info about user event.stream.attributes});
Room Entry Restrictions
Lock a Room
The EnxRoom.lock()
method allows moderators to lock a room, which forbids any new user from joining the session.
The right to lock/unlock a room lies only with the moderator.
- Method:
EnxRoom.lock()
- Event Notification:
room-locked
: Notification to all the participants in the room when the room is locked along with the Moderator ID of the moderator who locked the room.
Sample Code
room.lock();// Notifications: To all. Room is lockedroom.addEventListener('room-locked', function(event) {});
Error Codes
Code | Description |
---|---|
4101 | Unauthorized access. A user with the participant role has called lockRoom(). |
4121 | Retrying to lock the room which is already in the requested state. |
Unlock a Room
Moderators can unlock a room using the EnxRoom.unLock()
method to allow subsequent users to join the session.
The right to lock/unlock a room lies only with the moderator.
- Method:
EnxRoom.unlock()
- Event Notifications:
room-unlocked
: Notification to all the participants in the room when the room is unlocked along with the Moderator ID of the moderator who unlocked the room.
Sample Code
room.unlock();// Notifications: To all. Room is unlockedroom.addEventListener('room-locked', function(event) {});
Error Codes
Code | Description |
---|---|
4101 | Unauthorized access. A user with the participant role has called unlockRoom(). |
4121 | Retrying to unlock a room which is already in the requested state. |
Moderated Entry to a Room
In a knock-enabled Room, a user needs to wait until the Moderator grants them permission to join the Session. The EnxRoom.approveAwaitedUser()
method allows the Moderator to approve a user’s entry and EnxRoom.denyAwaitedUser()
method is used to decline a user’s entry to the Session.
- Methods:
EnxRoom.approveAwaitedUser(ClientID, Callback)
: To allow userEnxRoom.denyAwaitedUser(ClientID, Callback)
: To deny user
- Parameters:
ClientID
: ClientID of the user who is allowed or denied entry to the Room.
- Event Notifications:
user-awaited
: Notification to the moderator when a user awaits permission to join the room.room-allowed
: Notification to the user when the user is permitted to join the room after waiting in a wait-for-moderator or knock-enabled room.room-disconnected
: Notification to the user when he is denied entry.
Sample Code
// Moderator is notified about awaited userroom.addEventListener("user-awaited", function(event, user) {// Client Info: user.clientId// Create UI for Moderator Interaction to allow// To allowroom.approveAwaitedUser(clientId, function(success, error) {// Check Success / Error result});// To denyroom.denyAwaitedUser(clientId, function(success, error) {// Check Success / Error result});});
Manage Awaited Users When the Moderator Joins Late
If a moderator joins a session after the participants have sent a request to join the session in a knock-enabled room, then the moderator can get a list of participants awaiting moderator's approval using room.awaitedParticipants
. You can utilize this attribute to build the UI for moderator controls to handle pending approvals.
Sample JSON: JSON For room.awaitedParticipants
[{ "clientId": "String","name": "String"}]
Wait-for-Moderator Rooms
The Wait-For-Moderator Rooms restrict participants from joining a session till the moderator of the session has joined. The participants are restricted by setting settings.wait_for_moderator
to true
while creating a room. Once a moderator joins, all the awaited participants automatically allowed in the session. All subsequent participants can join the session directly.
Participants connecting to a room do not receive room-connected
events until the moderator joins the session. They are connected to the room when room.waitRoom is set to true. This event can send a message or display a waiting lobby for the users who are waiting to join.
- Event Notification:
room-allowed
: Notification to the participants shortly after the moderator joins the session. The participants are directed to the session subsequently.
Sample Code
// Participant are notified that the Moderator is inroom.addEventListener("room-allowed", function(event) {// Show a message or move the users out of lobby});
Disconnect a User
The EnxRoom.dropUser()
method allows moderators to disconnect or force-drop one or more participants from a session.
- Method:
EnxRoom.dropUser(ClientIds, Callback)
- Parameters:
ClientIds
: String, Required. Array of Client Ids to be disconnected. You can also pass an empty array "[]" to disconnect all the users.Callback
: Callback function to know status of the request.
- Event Notification:
room-disconnected
: Notification to the affected users with the reason of disconnection from the room.
Sample Code
// To disconnect a specified userroom.dropUser([ClientId], function(res) {if (res.result == 0) {// Request processed}});// To disconnect all users, pass an empty arrayroom.dropUser([], function(res) {if (res.result == 0) {// Request processed}});// Notifications: To all affected users.room.addEventListener("room-disconnected", function(event) {// Event may be processed to know reasonif (event.message.cause.msg === 'disconnected-by-moderator') {// Show message to user}});
Extend a Session
The duration of a room is limited. It is specified in minutes and defined during the room creation. This time is counted as soon as the first user joins the session.
The EnxRoom.extendConferenceDuration()
allows you to extend the duration of a session beyond the configured value. The extension process is explained below:
- An Extension window opens 10 minutes before the specified closure time of a session. All the connected users are notified of this event.
- Users can trigger an extension of the session by calling
extendConferenceDuration()
. Once triggered, the Extension Window is closed, thus preventing subsequent extension requests. - If the extension is not triggered, the final Extension window opens 5 minutes before the scheduled closure of the session. All the connected users are notified of this event.
- The session can be extended by 10 to 30 minutes. The extended period can vary as there is no restriction on the number of times a session is extended.
- When a session is extended, the previous steps are repeated.
- Method:
EnxRoom.extendConferenceDuration( Callback )
- Parameters:
Callback
: Callback function. This helps to know extension request status. The response includesextendedTime
key to show how many minutes the extension has been granted for.
- Event Notifications:
conference-remaining-duration
: Notification to everyone in the room when an Extension window is open. It carries a JSON to show how many minutes are left before the closure of the scheduled session.
Sample Code
// Notification: To all. Extension window is openroom.addEventListener('conference-remaining-duration', function(event) {var timeLeft = event.message.timeLeft;// Show UI to all users or to participant to// trigger EXTEND by caling method.// To extend sessionroom.extendConferenceDuration( function(message) {if(message.result== 0) {var extended_minutes = message.extendedTime;}});});
Conclude an Ongoing Session
The EnxRoom.destroy()
method lets moderators conclude an ongoing session.
- Method:
EnxRoom.destroy()
- Event Notification:
room-disconnected
: Notification to all users in the room when a session is destroyed.
Sample Code
room.destroy();// Notification: To all. Room disconnected.room.addEventListener("room-disconnected", function(event) {// Event may be processed to know the reasonif (event.message.cause.msg === 'disconnected-by-moderator') {// Show message to the user}});
Switch Participant Roles
The EnxRoom.switchUserRole()
method allows moderators to promote a participant to act as a moderator in an ongoing session. The newly appointed moderator is provided access to the moderator controls, and the former moderator becomes a participant in the session. If desired, the new moderator can grant the moderator role to another participant in the session.
- Method:
EnxRoom.switchUserRole(ParticipantId, Callback)
- Parameter:
ParticipantID
: String. Client ID of the participant who is designated as a moderator.Callback
: Callback function to get status of request.
- Event Notifications:
user-role-changed
: Notification to all the participants in the room when a participant is newly appointed as the moderator. The newly appointed moderator is notified with extra information required to moderate the session.
Sample Code
room.switchUserRole (participantId, function(status) {if ( status.result == 0) {// Succeeded}else {// Failed message: status.msg}});// Notification: To allroom.addEventListener('user-role-changed', function (evt) {// evt JSON explained later})
Sample JSON: JSON returned with Event user-role-changed
{ "raisedHands": [], //Raised Hand Requests"approvedHands": [], // Who has floor control"moderator": {"new" : "new client_id:,// New Moderartor"old" : "old clientId" // Old Moderartor}}
Pin a User
The EnxRoom.pinUsers()
method allows moderators to pin a user to the Active Talker list irrespective of the user's activity level. A pinned user's stream is always published in the room, even if the user is not talking. The inactive pinned users are placed in the Active Talker List after the actively talking users in a descending order based on the activity level, with the most active talkers at the top of the list. The total number of pinned users in a room is restricted to (max_active_talkers – 1) based on the room configuration.
On joining a room, a user is notified through a room-connected
event with room meta information, which contains the list of pinned users as "pinnedUsers": [ "client-ids" ]
.
- Methods:
EnxRoom.pinUsers(clientIds, callback)
: To pin usersEnxRoom.unpinUsers(clientIds, callback)
: To unpin users
- Parameters:
clientIds
: Array . Client IDs of users whose streams need to be pinned or unpinned.callback
: Callback function. Returns on pin/unpin request. It returns a list of clintIds who are pinned or unpinned.
- Event Notifications:
updated-pinned-users
: Notification to everyone in the Room with an updated list of pinned users in a JSON format.
Sample Code
// To pin usersroom.pinUsers(clientIDs, function(resp) {// resp json { "result": Number, "clients": [] }})// To unpin usersroom.unpinUsers(clientIDs, function(resp) {// resp json { "result": Number, "clients": [] }})// Notification: To all. Updated list of pinned usersroom.addEventListener('updated-pinned-users', function(event) {// event json { "moderator_id": "who updated", "clientIds": [] }});
Spotlight a User
The EnxRoom.addSpotlightUsers()
method allows moderators to spotlight a user, pushing the user's stream to the top of the Active Talker list irrespective of the user's activity level. Spotlighting publishes the chosen user's stream in the room even if the user is not talking. The moderator can spotlight as many users as max_active_talkers defined in the room configuration.
On joining a room, the user is notified through a room-connected
event with room meta information, which contains the list of spotlightUsers
.
In addition, the JSON containing the active talkers list received with the active-talkers-updated
callback includes a "spotlight" key with a boolean value. Spotlighted users have spotlight: true
in the list.
- Methods:
EnxRoom.addSpotlightUsers(clientIds[], callback)
- To add in SpotlightEnxRoom.removeSpotlightUsers(clientIds[], callback)
- To remove from Spotlight
- Parameters:
clientIds
: Array . Client IDs of users whose streams need to be spotlighted or taken off spotlight.callback
: Callback function. Returns on pin/unpin request. It returns a list of clintIds who are pinned or unpinned.
- Event Notifications:
spotlight-users
: Notification to everyone in the Room with an updated list of spotlighted users in a JSON format.
Sample Code
// To add spotlight usersroom.addSpotlightUsers(clientIDs, function(resp) {// resp json { "result": Number, "clients": [] }})// To remove users from Spotlightroom.removeSpotlightUsers(clientIDs, function(resp) {// resp json { "result": Number, "clientIds": [] }})// Notification: To all. Updated Spotlighted user listroom.addEventListener('spotlight-users', function(event) {// event json { "moderator_id": "who updated", "users": [] }});
Switch the Room Mode
A room defined with group
or lecture
mode may be switched to the other mode at runtime, that is, in an ongoing session. The EnxRoom.switchRoomMode()
method is executed by the moderator to switch to other modes instantly.
When a room is switched from group
or lecture
mode:
- The audio/video streams of all participants are dropped from the room with a notification to each participant.
- All the features of the Lecture mode, such as floor access control are activated.
- All active breakout rooms are terminated.
On the other hand, when a room is switched from group
or lecture
mode:
-
A notification is sent to each participant, allowing them to publish their audio/video streams into the room.
-
Due to privacy concerns, the SDK does not automatically start publishing audio/video streams, but application developers must decide whether to automatically publish the streams or prompt the participants to publish.
-
Method:
EnxRoom.switchRoomMode(roomMode, callback)
-
Parameters:
roomMode
: String. Enumerated valueslecture
,group
. The mode to which you want to switch the room into.
-
Event Notifications:
room-mode-switched
: Notification to everyone in the room when the mode of operation of the room is switched to the desired mode.
Sample Code
// To switch to group moderoom.room.switchRoomMode("group", function (resp) {if (resp.result == 0) {// Success}});// Notification to allroom.addEventListener("room-mode-switched", function (evt) {// evt is JSON, example./*{"type": "room-mode-switched","message": {"mode": "group"}}*/});