A User connected to an EnableX Session with Role “Moderator” has more privileges than a “Participant” over the session. The Moderator exercises his privileges by executing exclusive methods designed to work from his End Point only, are known as Moderator Controls.
Table of Contents
Record a Session
Using EnableX you may get an 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 replayed using any Video Player. Recording can be started in 2 ways :-
- 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: You may create UI to start and stop recording by Moderator as and when needed during a session.
Note!
- Moderator can start/stop recording unlimited time during a session.
- Moderator can stop recording in a room defined with the auto-recording feature.
Record using Web SDK
To start on-demand recording sessions, use EnxRoom.startRecord()
method, and to stop, use EnxRoom.stopRecord() method. On successful starting and stopping of recording all client endpoint will be notified using room-record-on
and room-record-off
respectively. You will need to listen to these events to perform UI updates.
// To start recording room.startRecord( function( result, error ) { if (result == 0) { // Recording started } }); // To stop recording room.stopRecord( function( result, error ) { if (result == 0){ // Recording stopped } }); // Notification recording started to all room.addEventListener( "room-record-on", function(event) { // Recording started, Update UI }); // Notification recording stopped to all room.addEventListener( "room-record-off", function(event) { // Recording stopped, Update UI });
Record using Android SDK
To start on-demand recording session, use EnxRoom.startRecord()
method, and to stop, use EnxRoom.stopRecord() method. On successful starting and stopping of recording, all client endpoint will be notified using designated callbacks to update UI accordingly.
room.startRecord(); // To start recording room.stopRecord(); // To stop recording // Callback to Moderator on Start / Stop of Recording public void onStartRecordingEvent(JSONObject jsonobject) {} public void onStopRecordingEvent(JSONObject jsonobject) {} // Callback to others on Start / Stop of Recording public void onRoomRecordingOn(JSONObject jsonobject) {} public void onRoomRecordingOff(JSONObject jsonobject) {}
Record using iOS SDK
To start on-demand recording session, use EnxRoom.startRecord()
method, and to stop, use EnxRoom.stopRecord()
method.
[room startRecord]; // To start recording // To all participants that recording has started -(void)roomRecordOn:(NSArray*)Data{ /* Data is [{ "msg":"Room Recording On", "result":"0" }] */ } // To acknowledge the moderator that recording has started -(void)startRecordingEvent:(NSArray *)response{ /* response is [{ "result":0, "msg":"Success" }] */ } [room stopRecord]; // To stop recording // To all participants that recording has stopped -(void)roomRecordOff:(NSArray*)Data{ /*Data is [{ "msg":"Room Recording Off", "result":"0" }] */ } // To acknowledge the moderator that recording has stopped -(void)stopRecordingEvent:(NSArray *)response{ /* response is [{ "result":0, "msg":"Success" }] */ }
Record using React Native SDK
To start on-demand recording session, use Enx.startRecord()
method, and to stop, use Enx.stopRecord()
method.
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"} }
Hard Mute / Unmute Room
When the Moderator wishes no audio in the Room, he may put the Room in a Hard Mute state. Any new user who joins the room in the Hard mMute state will not be able to send audio stream.
Hard Muting Room using Web SDK
To put Room into a Hard Mute state, you may use EnxRoom.hardMute()
method; and to lift the imposed restriction you may use EnxRoom.hardUnmute()
method. All users connected to the Room are notified with events hard-mute-room
on enforcing hard mute. On the other hand, users are notified with event hard-unmute-room
on lifting the imposed restriction.
/* Enforcing Room into hard-mute state */ room.hardMute( function(result) { if (result != 0){ // Error } else { // Success } }); /* Ending hard-mute state of room */ room.hardUnmute( function(result) { if (result != 0){ // Error } else { // Success } }); /* When room is muted, all participants are notified */ room.addEventListener("hard-mute-room", function(event) { // Room is muted }); /* When room is unmuted, all participants are notified */ room.addEventListener("hard-unmute-room", function(event) { // Room is unmuted });
Hard Muting Room using Android SDK
To put Room into a Hard mute state, you may use EnxRoom.hardMute()
method; and to lift the imposed restriction you may use EnxRoom.hardUnmute()
method. All users connected to the Room are notified with callbacks onReceivedHardMute
and onReceivedHardUnMute
whereas Moderator is notified with callbacks onHardMuted
and onHardUnMuted
.
room.hardMute(); // To mute room.hardUnMute(); // To unmute // Callback to Moderator on Mute/Unmute Room public void onHardMuted(JSONObject jsonobject) {} public void onHardUnMuted(JSONObject jsonobject) {} // Callback to others on Mute/Unmute Room public void onReceivedHardMute(JSONObject jsonobject) {} public void onReceivedHardUnMute(JSONObject jsonobject) {}
Hard Muting Room using iOS SDK
iOS SDK offers hard muting audio and force dropping the video of selected participant using EnxStream.hardMuteAudio()
and EnxStream.hardMuteVideo()
methods respectively. You may lift the enforced muting state of Audio or Video using EnxStream.hardUnMuteAudio()
and EnxStream.hardUnMuteVideo()
methods respectively.
[stream hardMuteAudio:@”clientId”]; // To hard-mute user's audio -(void)didReceiveHardMutedAudio:(NSArray *)Data{ // Your audio is hard-muted } -(void)didHardMuteAudio:(NSArray *)Data{ // You hard-muted user's audio } [stream hardUnMuteAudio:@”clientId”]; //To hard un-mute user's audio -(void)didReceivedHardUnmutedAudio:(NSArray *)Data{ // Your audio is hard-unmuted } -(void)didHardUnMuteAudio:(NSArray *)Data{ // You hard-unmuted user's audio } // Video Hard-Mute/Hard-Unmute will used in the same way as Audio.
Hard Muting Room using React Native SDK
To put room into hard mute state, you may use Enx.hardMute()
method; and to disable you may use EnxRoom.hardUnmute()
method.
Enx.hardMute (); // To hard mute room // To Moderator - Room is hard muted mutedAllUser: event=>{ // event= { result: 0, msg : “room muted” } } // To Participants - Room is hard muted hardMutedAll :event =>{ // event= { msg : “Room is muted”, status: true } } Enx.hardUnmute (); // To hard un-mute room // To Moderator - Room is hard unmuted unMutedAllUser : event=>{ // event= { result: 0, msg : “room un-muted” } } // To Participants - Room is hard unmuted hardUnmuteAllUser :event =>{ // event= { msg : “Room is un-muted”, status: false } }
Hard Mute / Unmute User
The Moderator may enforce a Hard Mute on any selected participant in the Room. The affected participant will not have audible audio until the hard-mute is disabled.
Hard Muting User using Web SDK
Web SDK offers hard muting audio and force dropping video of the selected participant using EnxStream.hardMuteAudio()
and EnxStream.hardMuteVideo()
methods respectively. You may lift the enforced muting state of Audio or Video using EnxStream.hardUnmuteAudio()
and EnxStream.hardUnmuteVideo()
methods respectively. The affected participant is notified using related events, viz. hardmute-user-audio
, hardunmute-user-audio
, hardmute-user-video
, hardunmute-user-video
.
/* Hard Mute User's Audio */ stream.hardMuteAudio( function(response) { if (response.result === 0) { // Success } else { // Failed } }); /* Hard Mute User's Video*/ stream.hardUnmuteAudio( function(response) { if (response.result === 0) { // Success } else { // Failed } }); stream.addEventListener('hardmute-user-audio', function(event) { // You are hard muted }); stream.addEventListener('hardunmute-user-audio', function(event) { // Hard mute state has been lifted for you }); // Example to force-drop Video will also be similar to hard-mute audio
Hard Muting User using Android SDK
Android SDK offers hard muting audio and force dropping video of the selected participant using EnxStream.hardMuteAudio() and EnxStream.hardMuteVideo() methods respectively. You may lift the enforced muting state of Audio or Video using EnxStream.hardUnMuteAudio() and EnxStream.hardUnMuteVideo() methods respectively. The affected participant is notified using related callbacks, viz. onReceivedHardMuteAudio, onReceivedHardMuteVideo, onReceivedHardUnMuteAudio, onReceivedHardUnMuteVideo. Similarly, the Moderator is notified using related callbacks too, viz. onHardMutedAudio
, onHardMutedVideo
, onHardUnMutedAudio
, onHardUnMutedVideo
.
stream.hardMuteAudio(clientId); // To mute Audio stream.hardUnMuteAudio(clientId); // To unmute Audio // Callback to Moderator on hard Mute/Unmute User's Audio public void onHardMutedAudio(JSONObject jsonobject) {} public void onHardUnMutedAudio(JSONObject jsonobject) {} // Callback to others on Mute/Unmute User's Audio public void onReceivedHardMuteAudio(JSONObject jsonobject) {} public void onReceivedHardUnMuteAudio(JSONObject jsonobject) {} stream.hardMuteVideo(clientId); // To stop Video stream.hardUnMuteVideo(clientId); // To restart Video // Callback to Moderator on hard stop/start User's Video public void onHardMutedVideo(JSONObject jsonobject) {} public void onHardUnMutedVideo(JSONObject jsonobject) {} // Callback to others on hard stop/start User's Video public void onReceivedHardMuteVideo(JSONObject jsonobject) {} public void onReceivedHardUnMuteVideo(JSONObject jsonobject) {}
Hard Muting User using iOS SDK
iOS SDK offers hard muting audio and force dropping the video of selected participant using EnxStream.hardMuteAudio()
and EnxStream.hardMuteVideo()
methods respectively. You may lift the enforced muting state of Audio or Video using EnxStream.hardUnMuteAudio()
and EnxStream.hardUnMuteVideo()
methods respectively.
[stream hardMuteAudio:@”clientId”]; // To hard-mute user's audio -(void)didReceiveHardMutedAudio:(NSArray *)Data{ // Your audio is hard-muted } -(void)didHardMuteAudio:(NSArray *)Data{ // You hard-muted user's audio } [stream hardUnMuteAudio:@”clientId”]; //To hard un-mute user's audio -(void)didReceivedHardUnmutedAudio:(NSArray *)Data{ // Your audio is hard-unmuted } -(void)didHardUnMuteAudio:(NSArray *)Data{ // You hard-unmuted user's audio } // Video Hard-Mute/Hard-Unmute will used in the same way as Audio.
Hard Muting User using React Native SDK
React Native SDK offers hard muting audio and force dropping the video of selected participant using Enx.hardMuteAudio()
and Enx.hardMuteVideo()
methods respectively. You may lift the enforced muting state of Audio or Video using Enx.hardUnMuteAudio() and Enx.hardUnMuteVideo) )
methods respectively.
Enx.hardMuteAudio(streamId,clientId); // To hard mute user's audio // To Moderator: User's audio is hard muted hardMuteAudio : event=>{ // event = {result: 0 } } // To affected Participant: Your audio is hard muted receivedHardMutedAudio :event =>{ // { result: 0, clientId: "XXX", msg: "user audio hard muted" } } Enx.hardUnmuteAudio(streamId,clientId); // To hard unmute user's audio // To Moderator: User's audio is hard unmuted hardUnmuteAudio : event=>{ // event = {result: 0 } } // To affected Participant: Your audio is hard unmuted receivedHardUnmutedAudio :event =>{ // { result: 0, clientId: "XXX", msg: "user audio hard unmuted" } } // Similar coding for User's video mute/unmute
Control Floor Access
In the Lecture Mode, only the Moderator publishes stream into the room whereas all other participants just subscribe and see/listen to the Moderator. During a session, if any participant would want to ask questions the Moderator can exercises control over the floor by deciding who he allows to publish the stream.
Please follow the steps below to deploy Control Floor Access by the moderator:
Request Floor Access
A participant requests for Floor access when he wants to talk. The request is forwarded to Moderator using a notification event.
Floor Request using Web SDK – Read more…
room.requestFloor(function (arg) { if(arg.result == 1701) { /* Success */ } else { /* Error - Print arg.msg */ } }); // Moderator receives Floor Access Request room.addEventListener("floor-requested", function (evt) { /* evt.users.clientId, evt.users.name */ });
Floor Request using Android SDK – Read more..
room.requestFloor(); // Participant requests Floor Access // Callback at Participant end when floor access is requested public void onFloorRequested(JSONObject jsonObject){} // Callback at Moderator End receiving request for Floor Access public void onFloorRequestReceived(JSONObject jsonObject){}
Floor Request using iOS SDK – Read more…
[room requestFloor]; -(void)didFloorRequestReceived:(NSArray *)Data{ /* Data is [{ "clientId": "xxx", // Who requested "name": "iOS" }] */ }
Floor Request using React Native SDK – Read more…
Enx.requestFloor(); // Participant requests floor access // Participant is acknowledged floorRequested : event =>{ // event { result:1701, msg:'Floor Request Received' } } // Moderator receive Floor Access Request floorRequestReceived : event =>{ // event { clientId : 1234, name : 'android' } }
Grant Floor Access
The Moderator may need to maintain a list of participants who requested floor access. Moderator may grant floor access to one or many users. Note that at any given point of time, only one person may be granted floor access. To grant access to others, the moderator must release floor access from the current participant who has floor access.
Grant Floor Access using Web SDK – Read more..
room.grantFloor(clientId, function (arg) { if (arg) { /* Success */ } else { /* Error - Print arg.msg */ } }); // Participant is notified about granted Floor Access room.addEventListener("floor-granted", function (evt) { // room.publish(localStream); // Publish stream });
Grant Floor Access using Android SDK – Read mor
room.grantFloor(clientId); // Grant Floor access to a participant // Callback at the Participant end when floor access is granted public void onGrantedFloorRequest(JSONObject jsonObject){} // Callback at Moderator End after granting floor access public void onProcessFloorRequested(JSONObject jsonObject){}
Grant Floor Access using iOS SDK – Read more…
[room grantFloor:@”clientId”]; // Moderator grants floor access // Participant receives floor access -(void)didGrantFloorRequested:(NSArray *)Data{ /* Data is [{ "result":1708, "msg":"Floor Granted", "clientId":"XXX" }] */ }
Grant Floor Access using React Native SDK – Read more…
Enx.grantFloor(ClientId); // To grant floor access to ClientId // To participant: Floor Access granted grantedFloorRequest : event =>{ // event = { result:1708, msg:'Floor Granted', clientId: "XXX" } } //To moderator: Acknowledgement processFloorRequested : event =>{ // event = { result:1708, msg:'Floor Granted' } }
Deny Floor Access
Alternately, the Moderator may simply deny a request for floor access.
Deny Floor Access using Web SDK – Read more…
room.denyFloor(clientId, function (arg) { if (arg) { /* Success */ } else { /* Error - Print arg.msg */ } }); // Participant is notified about denied request room.addEventListener("floor-denied", function (evt) { });
Deny Floor Access using Android SDK – Read more..
room.denyFloor(clientId); // Deny Floor access to a participant // Callback at the Participant end when floor access is denied public void onDeniedFloorRequest(JSONObject jsonObject){} // Callback at Moderator End after denying floor access public void onProcessFloorDenied(JSONObject jsonObject){}
Deny Floor Access using iOS SDK – Read more…
[room denyFloor:@”clientId”]; // Moderator denies floor access // Participant is notified about denied floor access -(void)didDenyFloorRequested:(NSArray *)Data{ /* Data is [{ "result":4117, "msg":"Floor Request Denied", "clientId":"XXX" }] */ }
Deny Floor Access using React Native SDK – Read more…
Enx.denyFloor(ClientId); // To deny floor access to ClientId // To participant: Floor Access request denied deniedFloorRequest : event =>{ // event = { result:4117, msg:'Floor request denied', clientId: "XXX" } } //To moderator: Acknowledgement processFloorRequested : event =>{ // event = { result:1709, msg:'Floor Denied' } }
Release Floor Access
The Moderator may terminate floor access granted to some participant. Upon terminating, the user’s stream(s) get unpublished. It’s necessary to release floor access first before giving out floor access to another participant.
Release Floor Access using Web SDK – Read more…
room.relaseFloor(clientId, function (arg) { if (arg) { /* Success */ } else { /* Error - Print arg.msg */ } }); // Participant is notified to release floor, stream gets unpublished room.addEventListener("release-floor", function (evt) { });
Release Floor Access using Android SDK – Read more…
room.releaseFloor(clientId); // Release Access from a participant // Callback at the Participant end when floor access is released public void onReleasedFloorRequest(JSONObject jsonObject){} // Callback at Moderator End after releasing floor access public void onProcessFloorRequested(JSONObject jsonObject){}
Release Floor Access using iOS SDK – Read more…
[room releaseFloor:@”clientId”]; // Moderator revokes granted floor access // Participant is notified moderator has revoked floor access -(void)didReleaseFloorRequested:(NSArray *)Data{ /* Data is [{ "result":1712, "msg":"Floor Released", "clientId":"XXX" }] */ }
Release Floor Access using React Native SDK – Read more…
Enx.releaseFloor(ClientId); // To release floor access floor ClientId // To participant: Floor Access released floorReleased : event =>{ // event = { result:1712, msg:'Floor released', clientId: "XXX" } } //To moderator: Acknowledgement processFloorRequested : event =>{ // event = { result:1712, msg:'Floor Released' } }
Restore Moderator Session
In case the Moderator gets disconnected during a session, the list of received floor requests and participants currently with floor access can be retrieved by reconnecting to the room in the Room-Meta viz.
room.raisedHands
– An Array of Client-IDs who requested floor-accessroom.approvedHands
– An Array of Client-IDs who currently has floor access
Explore Developer Guide