A user connected to an EnableX session with a “Moderator” role has additional privileges over that of a user with a “Participant” role for the session. The Moderator exercises their privileges for moderating the session by invoking exclusive methods designed to work from their endpoint only, known as Moderator Controls.

Table of Contents

Record Session

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?

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:

  • public void startRecord() – No parameter required.
  • public void stopRecord() – No parameter required.

Observer: public void setRecordingObserver(EnxRecordingObserver-Object)

Callbacks:

  • onStartRecordingEvent – Acknowledgment to the Moderator when recording starts.
  • onStopRecordingEvent – Acknowledgment to the Moderator when recording stops.
  • onRoomRecordingOn – Notification to all the participants when the recording is turned on.
  • onRoomRecordingOff – Notification to all the participants when the recording is turned off.
// Initiate Recording Observer to receive Callbacks
room.setRecordingObserver(this);

room.startRecord(); // To start recording
room.stopRecord(); // To stop recording

public void onStartRecordingEvent(JSONObject jsonobject){
   // You started recording
}

public void onStopRecordingEvent(JSONObject jsonobject){
   // You stopped recording
}

public void onRoomRecordingOn(JSONObject jsonobject){
   // Recording has started - to all
}  

public void onRoomRecordingOff(JSONObject jsonobject){
   // Recording has stopped - to all
}

Error Codes & Exceptions

CodeDescription
5007Unauthorized Access. When a participant tries to invoke startRecord().
5008Unauthorized Access. When a participant tries to invoke stopRecord().
5033Repeated startRecord() call while the previous request is in process.
5034Repeated startRecord() call while the recording has already started.
5035Repeated stopRecord() call while the recording has already stopped.
5036stopRecord() call without starting to record. Non-Contextual method call.

Hard Mute / Unmute Room

The EnxRoom.hardMute() method allows the Moderator to hard-mute the Room where all the participants are muted. A new participant joining a Room in a hard-mute state would also be muted by default. The right to unmute a hard-mute Room lies only with the Moderator and participants cannot unmute their Local Streams either. The EnxRoom.hardUnMute() method is used to put the Room off a hard-mute state.

Class: EnxRoom

Methods:

  • public void hardMute() – No Parameter required.
  • public void hardUnMute() – No Parameter required.

Observer: public void setMuteRoomObserver(EnxMuteRoomObserver-Object)

Callbacks:

  • onReceivedMuteRoom  – Notification to all the participants in the Room when Room is hard-muted.
  • onReceivedUnMuteRoom  – Notification to all the participants in the Room when Room is put off hard- mute state.
  • onMutedRoom  – Acknowledgment to the Moderator when Room is hard-muted.
  • onUnMutedRoom – Acknowledgment to the Moderator when Room is put off hard-mute state.
// Initiate Hard-Mute Observer to receive Callbacks 
room.setMuteRoomObserver(this); 

room.hardMute(); // To hard-mute Room
room.hardUnMute(); // To hard-unmute Room

public void onMutedRoom(JSONObject jsonobject){
 // You hard-muted Room
}

public void onUnMutedRoom(JSONObject jsonobject){
 // You hard-unuted Room
}

public void onReceivedMuteRoom(JSONObject jsonobject){
 // Room is hard-muted - to all
} 

public void onReceivedUnMuteRoom(JSONObject jsonobject){
 // Room is hard-unmuted - to all
}

Error Codes & Exceptions

CodeDescription
5001Unauthorized Access. When a user with a participant role invokes hardMute().
5002Unauthorized Access. When a user with a participant role invokes hardUnMute().
5037Repeated hardMute() request while the previous request is in process.
5038Invalid hardMute() request While the Room is already in a hard-mute state.
5039Invalid hardUnMuteRoom() request while the Room is NOT in a hard-mute state.
5040Repeated hardUnMuteRoom() request while the previous request is in process.

Hard Mute / Unmute Participant

The EnxStream.hardMuteAudio() and EnxStream.hardMuteVideo() methods allow the Moderator to hard-mute a Participant’s Audio and Video Streams respectively. The affected Participant cannot unmute their Audio or Video Streams. The Moderator can unmute the Participant’s Audio or Video Streams using EnxStream.hardUnMuteAudio() and EnxStream.hardUnMuteVideo() methods respectively.

Class: EnxStream

Methods:

  • public void hardMuteAudio(String clientId) – No Parameter required.
  • public void hardMuteVideo(String clientId) – No Parameter required.
  • public void hardUnMuteAudio(String clientId) – No Parameter required.
  • public void hardUnMuteVideo(String clientId) – No Parameter required.

Callbacks:

  • onHardMutedAudio – Notification to the affected participant when their Audio is hard-muted.
  • onHardUnMutedAudio – Notification to the affected participant when their Audio is lifted off the hard-mute state.
  • onHardMutedVideo – Notification to the affected participant when their Video is hard-muted.
  • onHardUnMutedVideo – Notification to the affected participant when their Video is lifted off the hard-mute state.
  • onReceivedHardMuteAudio – Notification to all the participants in the Room when a user’s Audio is hard-muted.
  • onReceivedHardUnMuteAudio – Notification to all the participants in the Room when a user’s Audio is lifted off the hard-mute state.
  • onReceivedHardMuteVideo – Notification to all the participants in the Room when a user’s Video is hard-muted.
  • onReceivedHardUnMuteVideo – Notification to all the participants in the Room when a user’s Video is lifted off the hard-mute state.
stream.hardMuteAudio(clientId); // To hard-mute user's Audio Stream
stream.hardUnMuteAudio(clientId); // To hard-unmute user's Audio Stream

public void onHardMutedAudio(JSONObject jsonobject){
 // Your audio is hard-muted
}

public void onHardUnMutedAudio(JSONObject jsonobject){
 // Your audio is hard-unmuted
}

public void onReceivedHardUnMuteAudio(JSONObject jsonObject){
 // A User's audio is hard-unmuted - to all
} 

public void onReceivedHardMuteAudio(JSONObject jsonobject){
 // A User's audio is hardmuted - to all
}

// Video Hard-Mute/Hard-Unmute will used in the same way as Audio.  

Error Codes & Exceptions

CodeDescription
5009Unauthorized Access. When a user with a participant role invokes hardMuteAudio().
5010Unauthorized Access. When a user with a participant role invokes hardUnMuteAudio().
5011Unauthorized Access. When a user with a participant role invokes hardMuteVideo().
5012Unauthorized Access. When a user with a participant role invokes hardUnMuteVideo().

Lock / Unlock Room

The EnxRoom.lockRoom() method allows the Moderator to lock the Room which forbids any new user from joining the Session. The Moderator can unlock the Room using EnxRoom.unLockRoom() method to allow subsequent users to join the Session.

ClassEnxRoom

Methods:

  • public void lockRoom()  – No Parameter required.
  • public void unLockRoom()  – No Parameter required.

Callbacks:

  • onAckLockRoom - Acknowledgment to the Moderator when the Room is locked.
  • onLockedRoom - Notification to all the participants in the Room when the room is locked.
  • onAckUnLockRoom - Acknowledgment to the Moderator when the Room is unlocked.
  • onUnLockedRoom - Notification to all the participants in the Room when the room is unlocked.
room.lockRoom();

// Moderator is acknowledged that room has been locked 
public void onAckLockRoom(JSONObject jsonObject) {
	// Handle JSONObject
}

// Participants are notified that room has been locked
public void onLockedRoom(JSONObject jsonObject) {
	// Handle JSONObject
}

room.unLockRoom();

// Moderator is acknowledged that room has been unlocked 
public void onAckUnLockRoom(JSONObject jsonObject) {
	// Handle JSONObject
}

// Participants are notified that room has been unlocked
public void onUnLockedRoom(JSONObject jsonObject) {
	// Handle JSONObject
}

Error Codes & Exceptions

CodeDescription
5115Unauthorized Access. When a user with participant role invokes lockRoom() or unlockRoom().
5117Invalid request. When the Moderator invokes lockRoom() on a locked Room.
5118Invalid request. When the Moderator invokes unlockRoom() on an unlocked Room.

Disconnect User

The EnxRoom.dropUser() method allows the Moderator to disconnect / force-drop one or more participant(s) from the Session.

Class: EnxRoom

Method: public void dropUser(List<String> clientIds)

Parameter:

  • clientIds – Required. List of Client IDs to be disconnected.

Callbacks:

  • onAckDropUser - Acknowledgment to the Moderator when the user is disconnected.
  • onRoomDisconnected - Notification to the affected user with the reason to be disconnected from the Room.
room.dropUser(list);

// Moderator is acknowledged that user has been dropped
public void onAckDropUser(JSONObject jsonObject) {
	// Handle JSONObject
}

Error Codes & Exceptions

CodeDescription
5116Unauthorized Access. When a user with participant role invokes dropUser()

Destroy Session

The EnxRoom.destroy() method allows the Moderator to conclude an ongoing session.

Method: public void destroy() – No Parameter required.

Callbacks:

  • onAckDestroy – Acknowledgment to the Moderator when the session is destroyed.
  • onRoomDisconnected - Notification to all users in the Room when the session is destroyed.
room.destroy();

// Moderator is acknowledged that session is destroyed
public void onAckDestroy(JSONObject jsonObject) {
	// Handle JSONObject
}

Error Codes & Exceptions

CodeDescription
5116Unauthorized Access. When a user with participant role invokes destroy().

Moderate Participant’s entry to a Session

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:

  • public void approveAwaitedUser(String clientId)
  • public void denyAwaitedUser(String clientId)

Parameters:

  • clientId: Client ID of the user awaiting the Moderator’s approval.

Callbacks:

  • onUserAwaited – Notification to the Moderator when a user awaits their permission to join Room.
  • onRoomAwaited – Notification to the user when they await Moderator’s permission to join Room with { “event_type”: “knock” } in the JSON Payload.
  • onAckForApproveAwaitedUser – Acknowledgment to the Moderator when the user is granted permission to join Room.
  • onRoomConnected – Notification to the user when the user is permitted to join Room.
  • onAckForDenyAwaitedUser – Acknowledgment to the Moderator when the user is denied permission to join Room.
  • onRoomDisconnected – Notification to the user along with a reason for denial when the user is denied access to the Room.
// Moderator is notified about awaited user
public void onUserAwaited(JSONObject jsonObject)  {
	// Awaited Client Info in the jsonObject, e.g.
	// {"id","String", "name": "String”} 
	
	enxRoom.approveAwaitedUser(jsonObject.id);  // To allow user to join room

	enxRoom.denyAwaitedUser(jsonObject.id); // To deny user 
	 
};

public void onAckForApproveAwaitedUser(JSONObject jsonObject) {
	// User has been allowed entry	
}

public void onAckForDenyAwaitedUser(JSONObject jsonObject) {
	// User has been denied entry	
}

To manage awaited users when moderator joins late

If the Moderator joins after the participant(s) have sent a request to join the Session in a Knock-enabled Room, then the Moderator can get the list of participants awaiting approval using room.awaitedParticipants. You can utilize this attribute to build UI for Moderator controls to handle pending approvals.

// e.g. room.awaitedParticipants

[
	{	"clientId”: "String", 
		"name": "String" 
	}
]

Floor Access Control in Lecture Mode

In Lecture Mode, only the Moderator can publish a stream in the Room and the participants can only subscribe to the Moderator’s stream. If a participant(s) wants to publish their Stream during the session, they need to request the Moderator for Floor Access.

The Floor Access Controls are implemented using the following APIs:

Request Floor Access

The EnxRoom.requestFloor() method allows a Participant to request the Moderator for Floor Access.

Class: EnxRoom

Method: public void requestFloor() – No parameter required.

Observer: public void setChairControlObserver( EnxChairControlObserver-Object )

Callbacks:

  • onFloorRequested – Acknowledgment to the Participant when their request is received by the Moderator.
  • onFloorRequestReceived – Notification to the Moderator when a Participant’s access request is received.
// Initiate Chair Control Observer to receive Callbacks
room.setChairControlObserver(this);
 
room.requestFloor(); // To request floor access

public void onFloorRequested(JSONObject jsonobject){
 // Your Request is received by Moderator
}

public void onFloorRequestReceived(JSONObject jsonobject){
 // Moderator receives floor access request
 // JSON has requesting participant information
}

Error Codes & Exceptions:

CodeDescription
5003Unauthorized Access. When a user with a Moderator role invokes requestFloor().
5041Repeated requestFloor() call while the previous request is in process.
5042Repeated requestFloor() call after the request has already been registered with the Moderator.
5067Unable to process the request for a Room in group mode. Non-Contextual method call.

Cancel Requested Floor Access

The Enxroom.cancelFloor() method allows participants to cancel their request for Floor Access pending for Moderator’s approval.

ClassEnxRoom

Method: public void cancelFloor() - No Parameter required.

Callbacks

  • onCancelledFloorRequest - Notification to the Moderator when the participant cancels the Floor Access Request.
  • onFloorCancelled - Acknowledgment to the Participant when their Floor Access Request is canceled.
 room.cancelFloor();

// Moderator receives cancellation request 
public void onCancelledFloorRequest(JSONObject jsonObject) {
	// Handle JSONObject
}

// Participant is acknowedged that floor request is cancelled
public void onFloorCancelled(JSONObject jsonObject) {
	// Handle JSONObject
}

Error Codes & Exceptions

CodeDescription
5003Unauthorized Access. When a user with moderator role invokes cancelFloor().
5041Repeated cancelFloor() call while a previous request is in process.
5042Repeated cancelFloor() call after the request has already been canceled.
5067Unable to process the request for a Room in group mode. Non-Contextual method call.

Deny Floor Access

The EnxRoom.denyFloor() method allows the Moderator to deny a Participant’s request for Floor Access.

ClassEnxRoom

Method: public void denyFloor(String clientID) 

Parameter:

clientID – Client ID of the Participant requesting Floor Access.

Observerpublic void setChairControlObserver( EnxChairControlObserver-Object )

Callbacks:

  • onProcessFloorRequested – Acknowledgment to the Moderator when the Floor Access has been denied.
  • onDeniedFloorRequest – Notification to the Participant when the Floor Access has been denied.
// Initiate Chair Control Observer to receive Callbacks
room.setChairControlObserver(this); 

room.denyFloor(clientId); // To deny floor access to a clientId

public void onProcessFloorRequested(JSONObject jsonobject){
 // You denied floor access to a Participant
}

public void onDeniedFloorRequest(JSONObject jsonobject){
 // Participant is notified that he is denied Floor Access
}

Error Codes & Exceptions:

CodeDescription
5005Unauthorized Access. When a user with participant role invokes denyFloor().
5045When an invalid Client ID is passed to denyFloor().
5047Repeated denyFloor() call while the previous request is in process.
5048denyFloor() called after granting Floor Access. Non-Contextual Method Call.
5067Unable to process the request for a Room in group mode. Non-Contextual method call.

Grant Floor Access

The EnxRoom.grantFloor() method allows the Moderator to grant Floor Access to one or more Participants one by one. Note that at any given point in time, only one Participant can be granted floor access. To grant Floor Access to others, the Moderator must release Floor Access from the existing participant.

Class: EnxRoom

Method: public void grantFloor(String clientID)

Observer: public void setChairControlObserver( EnxChairControlObserver-Object )

Callbacks:

  • onProcessFloorRequested – Acknowledgment to the Moderator when Participant is granted Floor Access.
  • onGrantedFloor – Notification to the Participant when Floor Access is received.
// Initiate Chair Control Observer to receive Callbacks
room.setChairControlObserver(this); 

room.grantFloor(clientId); // To grant floor access to a clientId

public void onProcessFloorRequested(JSONObject jsonobject){
 // You granted floor access to a Participant
}

public void onGrantedFloor(JSONObject jsonobject){
 // Participant is notified that he is granted Floor Access
 room.publish(localStream); // Publish now
}

Error Codes & Exceptions

CodeDescription
5004Unauthorized Access. When a user with participant role invokes grantFloor().
5045When Invalid Client ID is passed to grantFloor().
5043Repeated grantFloor() call while the previous request is in process.
5044Repeated grantFloor() call after successfully granting Floor Access.
5046grantFloor() to another Participant without releasing the Floor Access from the existing Participant.
5069Unable to grant Floor Access when Floor Release is in process.
5067Unable to process the request for a Room in group mode. Non-Contextual method call.

Finish Floor Access

The EnxRoom.finishFloor() allows the Participant to announce the completion of Floor Access and release Floor Access.

ClassEnxRoom

Method: public void finishFloor() – No Parameter required.

Callbacks: 

  • onFinishedFloorRequest: Notification to the Moderator when the Participant finishes Floor Access.
  • onFloorFinished: Acknowledgment to the Participant when Floor Access is finished.
room.finishFloor();

// Moderator received Floor Finish notification 
public void onFinishedFloorRequest(JSONObject jsonObject) {
	// Handle JSONObject
}

// Participants is acknowledged that floor access is finished
public void onFloorFinished(JSONObject jsonObject) {
	// Handle JSONObject
}

Error Codes & Exceptions

CodeDescription
5003Unauthorized Access. When a user with moderator role invokes finishFloor().
5041Repeated finishFloor() call while the previous request is in process.
5042When participant retries finishFloor() after finishing the Floor Access.
5067Unable to process the request for a Room in group mode. Non-Contextual method call.

Note: In case of an error, <null> is received at the first Index and Error Info at the second Index.

Release Floor Access

The Enxroom.releaseFloor() method allows the Moderator to terminate the Floor Access granted to a Participant. This unpublishes the participant’s streams and makes the Floor available for access again.

Class: EnxRoom

Method: public void releaseFloor(String clientId)

Parameter:

clientId – Client ID of the Participant whose Floor Access is being released.

Observer: public void setChairControlObserver( EnxChairControlObserver-Object )

Callbacks:

  • onProcessFloorRequested – Acknowledgment to the Moderator when the Floor Access is released.
  • onReleasedFloorRequest – Notification to the Participant when their Floor Access is revoked.
// Initiate Chair Control Observer to receive Callbacks
room.setChairControlObserver(this); 

room.releaseFloor(clientId); // To release floor access of the Participant

public void onProcessFloorRequested(JSONObject jsonobject){
 // You got floor access released from the Participant
}

public void onReleasedFloorRequest(JSONObject jsonobject){
 // Participant is notified that floor access is revoked
}

Error Codes & Exceptions:

CodeDescription
5006Unauthorized Access. When a user with participant role invokes releaseFloor()
5045Invalid Client ID passed to releaseFloor().
5049Repeated releaseFloor() call while the previous request is in process.
5050releaseFloor() called without granting Floor Access. Non-Contextual Method Call.
5067Unable to process the request for a Room in group mode. Non-Contextual method call.

Note: The Object EnxRoom.setChairControlObserver() needs to be called only once for any one or all of the above methods to receive callbacks.

Restore Moderator Session

If the Moderator gets disconnected during a session, the list of Floor Access Requests and participants currently with Floor Access can be retrieved via the Room-Meta-Data when the Moderator gets reconnected.

Structured Data JSON

  • room.getRoomMetaData().getJSONArray("raisedHands") – An Array of Client IDs requesting floor access.
  • room.getRoomMetaData().getJSONArray("approvedHands") An Array of Client IDs currently having floor access.

Invite to Floor

In lecture mode, where only the Moderator can speak and control speakers in the Room through Floor Access Control methods, the Invite to Floor methods provide more options to the Moderator to organize a conference in lecture mode.

Invite Participant to Floor

The EnxRoom.inviteToFloor() method allows the Moderator to invite any Participant in the ongoing conference to the Floor and talk.

Class: EnxRoom

Method: public void inviteToFloor(String clientId) 

Parameter:

clientId – String. The client ID of the invited Participant.

Callback:

  1. onACKInviteToFloorRequested – Acknowledgment to the Moderator when an invitation to Floor is sent to the Participant.

Response Body:

{
   msg = Success; 
   result = 0;
} 
  • onInviteToFloorRequested – Notification to all the Moderators in the Room when an invitation to Floor is sent to the Participant.

Response Body:

{
    clientId = "cae0afbc-fb94-4743-8c04-ae48e9d3eb52"; 
    id = inviteToFloor; 
    name = Jay;
} 
  • onInvitedForFloorAccess – Notification to the invited Participant when an invitation to Floor is received.

Response Body:

 {  
        clientId = "9554a040-58bd-4f0b-a010-7f92c54b2918"; 
        id = inviteToFloor; 
        moderator = "e2b48879-3754-49f2-bf86-08a73347e408"; 
        name = Jay; 
 } 
// invitation sent to participant to come on floor and talk
EnxRoom.inviteToFloor(clientId); 

//Acknowledgment to the moderator who invited
@Override 
public void onACKInviteToFloorRequested(JSONObject jsonObject) 

//Notification to all the moderators in the room
@Override
public void onInviteToFloorRequested(JSONObject jsonObject)

//Notification to the invited participant
@Override 
public void onInvitedForFloorAccess(JSONObject jsonObject)  

Error Codes & Exceptions:

CodeDescription
5086 Endpoint application is not connected to a Room. 
5097inviteToFloor() is not applicable in a Chat-Only Room. Non-Contextual method call.
5006A User with a participant role is not authorized to invoke inviteToFloor().
5045Unable to invite a user with an invalid client ID. 
5067Unable to process the request for a Room in group mode. Non-Contextual method call.

Cancel Invitation to Floor

The EnxRoom.cancelFloorInvite() method allows the Moderator to cancel a Floor Invitation sent to a Participant.

Class: EnxRoom

Method: public void cancelFloorInvite(String clientId)

Parameter:

clientId – Client Id of the Participant whose invitation needs to be canceled.

Callback:

  • onProcessFloorRequested – Acknowledgment to the Moderator when Cancel Invitation request is sent to the Participant.

Response Body:

{ 
    msg = Success; 
    request =  { 
        id = processFloorRequest; 
 	params =  { 
            action = cancelFloorInvite;
            clientId = "cae0afbc-fb94-4743-8c04-ae48e9d3eb52"; 
       		}; 
	}; 
  	result = 0; 
} 
  • onCanceledFloorInvite – Notification to the invited Participant and other Moderators in the Room when invitation is canceled by the Moderator.

Response Body for the Participant:

{ 
        clientId = "a067fd70-1461-4ca4-befc-2b570c0db494"; 
        id = cancelFloorInvite; 
        moderator = "e2b48879-3754-49f2-bf86-08a73347e408"; 
        name = JayiOS; 
} 

Response Body for other Moderators:

{ 
        clientId = "ade30ef1-595d-4364-b4f5-1d9420f24b0f"; 
        id = cancelFloorInvite; 
        name = JayiOS; 
} 
// Cancel Floor invitation request sent by the Moderator
EnxRoom.cancelFloorInvite(clientId); 

// Acknowledgment to the Moderator that Cancel Floor Invitation is initiated
@Override 
public void onProcessFloorRequested(JSONObject jsonObject) 

// Notification to the invited participant and other Moderators in the Room that invitation is canceled
@Override 
public void onCanceledFloorInvite(JSONObject jsonObject) 

Error Codes & Exceptions:

CodeDescription
5086 Endpoint application is not connected to a Room. 
5097cancelFloorInvite() not applicable in a Chat-Only Room. Non-Contextual method call.
5006A User with a participant role is not authorized to invoke cancelFloorInvite().
5045Unable to cancel invitation for an invalid client ID. 
5067Unable to process the request for a Room in group mode. Non-Contextual method call.

Accept Invitation to Floor

The EnxRoom.acceptInviteFloorRequest() method allows the Participant to accept the invitation to the Floor and talk.

Class: EnxRoom

Method: public void acceptInviteFloorRequest(String clientId) 

Parameter:

clientIdClient Id of the Participant who has received the invitation to the Floor.

Callbacks:

  • onProcessFloorRequested – Acknowledgment to the Participant when they accept the invitation to the Floor.

Response Body:

{ 
    msg = Success; 
    request =     { 
        id = processFloorRequest; 
        params =  { 
            action = acceptFloor; 
            clientId = "18c9b8bb-142e-44a7-b30b-6701cd9e62d9"; 
        }; 
    }; 
    result = 0;
} 
  • onAcceptedFloorInvite – Notification to all the Moderators in the Room including the one who sent the invitation when the Participant accepts invitation.

Response Body:

{ 
        clientId = "8ed7241c-36d9-4224-b8f3-7d015718d09e"; 
        id = floorAccepted; 
        msg = "Floor accepted"; 
        result = 1738; 
}
// Participant accepts the invitation to Floor
EnxRoom.acceptInviteFloorRequest(clientId);

// Acknowledgment to the Participant when they accept the invitation to the Floor
@Override 
public void onProcessFloorRequested(JSONObject jsonObject) 

// Notification to all the Moderators in the Room including the one who sent the invitation
@Override 
public void onAcceptedFloorInvite(JSONObject jsonObject) 

Error Codes & Exception:

CodeDescription
5086 Endpoint application is not connected to a Room. 
5097acceptInviteFloorRequest() not applicable in a Chat-Only Room. Non-Contextual method call.
5006A User with a Moderator role is not authorized to invoke acceptInviteFloorRequest().
5045Unable to accept the invitation for an invalid client ID. 
5067Unable to process the request for a Room in group mode. Non-Contextual method call.

Reject Invitation to Floor

The EnxRoom.rejectInviteFloor() method allows the invited Participant to reject the invitation to the Floor.

Class: EnxRoom

Method: public void rejectInviteFloor(String clientId) 

Parameter:

clientId – Client Id of the Participant who has received the invitation to the Floor.

Callbacks:

  • onProcessFloorRequested – Acknowledgment to the Participant when they reject the invitation to Floor.

Response Body:

{ 
    msg = Success; 
    request =     { 
        id = processFloorRequest; 
        params =  { 
            action = rejectFloor; 
            clientId = "87184b36-26b3-4450-b908-6d9de6a457c5"; 
        }; 
    }; 
    result = 0; 
} 
  • onRejectedInviteFloor – Notification to all the Moderators including the one who sent the invitation when the Participant rejects the invitation.

Response Body:

{ 
        clientId = "57ab3a52-2d85-4a22-a4b4-d58b90ea84ec"; 
        id = floorRejected; 
        msg = "Floor Denied"; 
        result = 1709; 
} 
// Participant rejects invitation to Floor
EnxRoom.rejectInviteFloor(clientId);

// Acknowledgment to the Participant wen they reject invitation to the Floor
@Override 
public void onProcessFloorRequested(JSONObject jsonObject) 

// Notification to the Moderators when Participant rejects invitation to the Floor
@Override 
public void onRejectedInviteFloor(JSONObject jsonObject) 

Error Codes & Exceptions:

CodeDescription
5086 Endpoint application is not connected to a Room. 
5097rejectInviteFloor() not applicable in a Chat-Only Room. Non-Contextual method call.
5006A User with a Moderator role is not authorized to invoke rejectInviteFloor().
5045Unable to reject the invitation for an invalid client ID. 
5067Unable to process the request for a Room in group mode. Non-Contextual method call.

Change Participant’s Role

The EnxRoom.switchUserRole() method allows the Moderator to promote a Participant to act as a Moderator in the ongoing Session. This newly appointed Moderator gets access to Moderator Controls and the former Moderator becomes a Participant in the Session. The new Moderator can further grant the Moderator role to another participant if so desired.

Class: EnxRoom

Method: public void switchUserRole(String ClientId)

Parameter: ClientId – Client ID of the participant who is being designated as Moderator

Callbacks:

  • onSwitchedUserRoleChange – Acknowledgment to the Moderator when a Switch User Role is requested.
  • onUserRoleChanged – Notification to all participants in the Room when a participant is newly appointed as the Moderator. The appointed moderator is notified with extra information required to moderate the Session.
room.switchUserRole(clientId); // Role Change Request from Moderator

public void onSwitchedUserRole(JSONObject jsonObject){
	// Moderator is acknowledged
}

public void onUserRoleChanged(JSONObject jsonObject){
	// All Participants are notified - jsonObject
	/*
	{	"moderator": false, // You are not a moderator
		"clientId": "XXX"   // New Moderator's Client ID
	}
	*/
    
	// New Moderator is notified  - jsonObject
	/*
	{   "moderator": true,  // You are a moderator
		"clientId": "XXX",  // New Moderator's Client ID i.e. You
		"raisedHands":[],   // List of Client IDs requesting Floor Access
		"approvedHands":[]  // List of Client IDs with Floor Access
	}
	*/
}

Error Codes & Exceptions

CodeDescription
5085Unauthorized Access. When a user with participant role invokes switchUserRole()

Start / Stop Live Streaming

The EnxRoom.startStreaming() method allows the Moderator to forward live Video Sessions over RTMP Stream to any live streaming CDNs supporting this protocol. The EnxRoom.stopStreaming() method is used to stop forwarding RTMP Stream.

Class: EnxRoom

Methods:

  • public void startStreaming(JSONObject streamingDetails)
  • public void stopStreaming(JSONObject streamingDetails)  

Parameters:

  • streamingDetails – Configuration options JSON object for forwarding streams.
    • rtmpDetails.rtmpUrl – Use “RTM-URL/RTMP-KEY” from CDN Provider
    • rtmpDetails.urlDetails.url – Optional RTMP Streaming View URL. If not given, a default Streaming View will be applied.

Callbacks:

  • onAckStartStreaming – Acknowledgment to the Moderator when RTMP Streaming starts.
  • onAckStopStreaming – Acknowledgment to the Moderator when RTMP Streaming starts.
  • onStreamingNotification – Notification to all the Participants in the Room when RTMP Streaming starts/stops.
JSONObject jsonObject = new JSONObject();

JSONObject rtmpDetails = new JSONObject();
rtmpDetails.put("rtmpUrl", "RTMP_URL/RTMP_KEY"");
jsonObject.put("rtmpDetails", rtmpDetails);

/* Optional Streaming View URL */
JSONObject urlDetails = new JSONObject();
urlDetails.put("url", "URL-TO-USE-AS-STREAMING-VIEW");
jsonObject.put("urlDetails", urlDetails);

room.startStreaming(jsonObject); // Start Streaming
room.Moderator (jsonObject);     // Stop Streaming

public void onAckStartStreaming(JSONObject jsonObject){
	 // Acknowledges that Streaming Started
}

public void onAckStopStreaming(JSONObject jsonObject){
	 // Acknowledges that Streaming Stopped
}

public void onStreamingNotification(JSONObject jsonObject){
	 // Notifies all that Streaming Started/Stopped
}

Error Codes & Exceptions

CodeDescription
5121Repeated startStreaming() call while the previous request is in process.
5122Repeated startStreaming() call after Streaming has started.
5123Repeated stopStreaming() call while the previous request is in process.
5124stopStreaming() called without starting a Stream first. Non-Contextual Method Call.
5125Invalid Stream configuration.

Pin User Stream(s)

The EnxRoom.pinUsers() method allows the Moderator to pin a user(s) 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 they are 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 talker on top. 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, the user is notified via onRoomConnected event with Room Meta Information, which contains the list of pinned users as "pinnedUsers": [ /*client-ids*/ ].

The EnxRoom.unpinUsers() method is used to unpin the user(s).

Class: EnxRoom

Methods:

  • public void pinUsers(List<String> clientIds)
  • public void unpinUsers(List<String> clientIds)

Parameters:

  • clientIds – Array of Client IDs of users whose streams need to be pinned or unpinned.

Callbacks:

  • onAckPinUsers – Acknowledgment to the Moderator when the users are pinned.
  • onAckUnpinUsers – Acknowledgment to the Moderator when the users are unpinned.
  • onPinnedUsers – Notification to everyone in the Room with an updated list of pinned users.
List<String> clientIds = new ArrayList<>(); 
clientIds.add("clientId1");
clientIds.add("clientId2");
 
enxRoom.pinUsers(clientIds);	// To pin
enxRoom.unpinUsers(clientIds);	// To unpin

// Moderator is acknowledged for pinning user
public void onAckPinUsers(JSONObject jsonObject){ 

}

// Moderator is acknowledged for unpinning user
public void onAckUnpinUsers(JSONObject jsonObject){ 

}

// Everyone is notified wtih updated pinned list
public void onPinnedUsers(JSONObject jsonObject){ 

}

Error Codes & Exceptions:

CodeDescription
5003Unauthorized Access. When a user with participant role invokes pinUser() or unpinUser().
5126Invalid client IDs passed.

Spotlight

The EnxRoom.addSpotlightUsers() method allows the Moderator to spotlight a user which pushes the user’s Stream to the top of Active Talker List irrespective of the user’s activity level. Spotlighting publishes the chosen user’s Stream in the Room even if they are 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 via onRoomConnected event with Room Meta Information, which contains the list of spotlightUsers.

Further active talkers list JSON received with onActiveTalkersUpdated callback has “spotlight” key with boolean value. Spotlighted users have spotlight: true in the list.

The EnxRoom.removeSpotlightUsers() method is used to remove the spotlight from user(s) Streams.

Class: EnxRoom

Methods:

  • public void addSpotlightUsers(List clientIds) 
  • public void removeSpotlightUsers(List clientIds) 

Parameters:

  • clientIds – Array of Client IDs of users whose streams are spotlighted or removed from the spotlight.

Callbacks:

  • onAckAddSpotlightUsers – Acknowledgment to the Moderator when spotlight request is received with the following JSON { "result": 0, clients: [] }:
    • result: 0 for success.
    • clients: Array of Client IDs being added.
  • onAckRemoveSpotlightUsers – Acknowledgment to the Moderator when spotlight removal request is received with the following JSON { "result": 0, clients: [] }:
    • result: 0 for success.
    • clients: Array of Client IDs being added.
  • didUpdatedSpotlightUsers– Notification to everyone in the Room when the spotlighted user list update is received with the following JSON { "moderator_id": String, clients: [] }:
    • moderator_id: Moderator’s Id who updates the spotlight user list.
    • clients: Array of Client IDs of users who are spotlighted.
List clientIds = new ArrayList<>(); 
clientIds.add("clientId1");
clientIds.add("clientId2");
 
enxRoom.addSpotlightUsers(clientIds);	// To spotlight
enxRoom.removeSpotlightUsers(clientIds);// To remove from spotlight

// Moderator who spotlights users is acknowledged 
public void onAckAddSpotlightUsers (JSONObject jsonObject){ 
	// JSON { "result": 0,  clients: [] }
}

// Moderator who removes users from Spotlight is acknowledged 
public void onAckRemoveSpotlightUsers (JSONObject jsonObject){ 
	// JSON { "result": 0,  clients: [] }
}

// Everyone is notified with updated Spotlight list
public void onUpdateSpotlightUsers(JSONObject jsonObject){ 
	// JSON { "moderator_id": "String",  clients: [] }
}

Explore Android SDK