Floor Access Control
In the Lecture Mode, only the moderator can publish a stream in a room, and the participants can only subscribe to the moderator's stream. If participants want to publish their streams during a session, they must request the moderator for floor access to do this.
The Web SDK provides the following methods for managing floor access:
- requestFloor(): To request the moderator for floor access.
- cancelFloor(): To cancel the request for floor access.
- denyFloor(): To deny a participant's request for floor access.
- grantFloor(): To grant floor access to one or more participants in sequence.
- finishFloor(): To announce the completion of floor access and its availability for subsequent requests.
- releaseFloor(): To terminate floor access granted to a participant.
- inviteToFloor(): To invite a participant of an ongoing conference to the floor.
- cancelFloorInvite(): To cancel a floor invitation sent to a participant.
- acceptInviteFloorRequest(): To accept a floor invitation and talk.
- rejectInviteFloor(): To reject a floor invitation.
Request Floor Access
The EnxRoom.requestFloor()
method allows a participant to request the moderator for floor access.
- Method:
EnxRoom.requestFloor(Callback)
- Parameters:
Callback
: Callback Function. To obtain status of request.
- Event Notifications:
floor-requested
: Notification to the moderator when a participant's access request is received.
Sample Code
room.requestFloor(function (arg) {if(arg.result == 1701) { // Success} else { // Error// Print arg.msg}});// Notification: To Moderator. Received Floor Access Requestroom.addEventListener("floor-requested", function (evt) {// evt JSON// evt.users.clientId, evt.users.name});
Error Codes
Code | Description |
---|---|
4101 | Unauthorized Access. When a user with a moderator role invokes requestFloor() . |
1702 | Repeated floor request when a previous floor request is pending with the moderator. |
Cancel a Requested Floor Access
The Enxroom.cancelFloor()
method allows participants to cancel their floor access request pending moderator approval.
- Method:
EnxRoom.cancelFloor(Callback)
- Parameters:
Callback
: Callback Function. To obtain status of request.
- Event Notifications:
floor-cancelled
: Notification to the moderator when a participant cancels a floor access request.
Sample Code
room.cancelFloor(function (arg) {if(arg.result == 0) {// Floor Reqeust is cancelled}});// Notification: To Moderator. Floor Access request cancelledroom.addEventListener("floor-cancelled", function (evt) {// evt JSON// evt.msg.clientId = The participant who cancelled});
Error Codes
Code | Description |
---|---|
4101 | Unauthorized Access. When a user with moderator role invokes cancelFloor(). |
1707 | Invalid Request. When a participant tries cancelFloor() without requesting floor access. |
Deny Floor Access
The EnxRoom.denyFloor()
method allows moderators to deny a participant's request for floor access.
- Method:
EnxRoom.denyFloor(ClientID, Callback)
- Parameters:
ClientID
: String. ClientID of the user who is denied floor access.Callback
: Callback Function. To obtain status of request.
- Event Notifications:
floor-denied
: Notification to the denied participant and all moderators, along with the responsible moderator's ID who denied floor access.
Sample Code
room.denyFloor(clientId, function (arg) {if (arg) { // Success} else { // Error// Print arg.msg}});// Notification: To affected participant and moderators. Denied requestroom.addEventListener("floor-denied", function (evt) {// evt JSON// evt.msg.moderatorId = The modeator who denied// evt.msg.clientId = The Participan who is denied});
Error Codes
Code | Description |
---|---|
4101 | Unauthorized access. When a participant invokes denyFloor(). |
1711 | When denyFloor() is called with an invalid Client ID. |
Grant Floor Access
The EnxRoom.grantFloor()
method allows the moderator to grant floor access to one or more participants individually. Note that at any given time, only one participant can be granted floor access. To grant floor access to other participants, the moderator must release floor access from the existing participant.
- Method:
Enxroom.grantFloor(clientID, Callback)
- Parameters:
ClientID
: String. ClientID of the user who is granted floor access.Callback
: Callback Function. To obtain status of request.
- Event Notifications:
floor-granted
: Notification to the denied participant and all moderators, along with the responsible moderator's ID who granted floor access.
Sample Code
room.grantFloor(clientId, function (arg) {if (arg) { // Success} else { // Error// Print arg.msg}});// Notification: To affected participant and moderators. Denied requestroom.addEventListener("floor-granted", function (evt) {// evt JSON// evt.msg.moderatorId = The modeator who denied// evt.msg.clientId = The Participan who is granted access// Participant to publish stream.room.publish(localStream);});
Error Codes
Code | Description |
---|---|
4101 | Unauthorized access. When a participant uses grantFloor() . |
1711 | When grantFloor() is called with an invalid Client ID. |
1703 | Repeated grantFloor() method call from a partcipant after floor access is granted to the participant. |
1173 | Failed to grant floor access to the participant. |
1131 | Participants cannot publish a stream without floor access. |
1710 | Floor access requests/floor access grants have exceeded the permissible limit. |
Complete a Granted Floor Access
The EnxRoom.finishFloor()
allows participants to announce the completion and release of granted floor access.
- Method:
EnxRoom.finishFloor(Callback)
- Parameters:
Callback
: Callback Function. To obtain status of request.
- Event Notification:
floor-finished
: Notification to all the moderators when a participant finishes the floor access.
Sample Code
room.finishFloor(function (arg) {if (arg) { // Success} else { // Error// Print arg.msg}});// Moderators receive notificationroom.addEventListener("floor-finished", function (evt) {// evt JSON// evt.msg.clientId : The participant who finished floor access});
Release Floor Access
The Enxroom.releaseFloor()
method allows moderators to terminate the floor access granted to a participant. It unpublishes the participant's streams and makes the floor available for access.
- Method:
EnxRoom.releaseFloor(ClientID, Callback)
- Parameters:
ClientID
: String. Client ID of the participant whose floor access will be released.Callback
: Callback Function. To obtain status of request.
- Event Notifications:
release-floor
: Notification to the affected participant and moderators when floor access is released, along with the Moderator ID of the responsible moderator.
Sample Code
room.relaseFloor(clientId, function (arg) {if (arg) { // Success} else { // Error// Print arg.msg}});// Notification: To affected participant and moderators. Floor is releasedroom.addEventListener("release-floor", function (evt) {// evt JSON// evt.msg.moderatorId = The moderator who released floor access// evt.msg.clientId = The participant whose floor access is released});
Invite to Floor
In the Lecture mode, where only a moderator can speak and control speakers in the room through Floor Access Control methods, the Invite Floor methods provide more options to the moderator to organize a conference in this mode.
Invite Participants to a Floor
The EnxRoom.inviteToFloor()
method allows moderators to invite participants in the ongoing conference to the floor and talk.
- Method:**
EnxRoom.inviteToFloor(ClientId, callack)
- Parameters:
ClientID
: String. The client ID of the invited participant.Callback
: Callback Function. To obtain status of request.
- Event Notifications:
floor-invited
: Notification to all the moderators in the room and the invited participant when the participant is invited to join the floor.
Sample Code
// Invite a participantroom.inviteToFloor (clientId, function (resp) {if (resp.result) { // Success} else { // Error// Print arg.msg}});// Notification: To invited participant and moderatorsroom.addEventListener("floor-invited", function (evt) {// evt JSON/*{"type": "floor-invited","users": {"id": "inviteToFloor","clientId": "STRING","name": "String","moderator": "STRING"}}*/});
Error Codes
Code | Description |
---|---|
5086 | The endpoint application is not connected to the room. |
5097 | inviteToFloor() is not applicable in a Chat-Only room. Non-contextual method call. |
5006 | A user with a participant role is not authorized to invoke inviteToFloor(). |
5045 | Unable to invite a user with an invalid client ID. |
Cancel Floor Invitation
The EnxRoom.cancelFloorInvite()
method allows moderators to cancel a floor invitation sent to a participant.
- Method:
EnxRoom.cancelFloorInvite(ClientId, Callback)
- Parameters:
ClientID
: String. Client Id of the participant whose invitation needs to be canceled.Callback
: Callback Function. To obtain status of request.
- Event Notifications:
floor-invite-cancelled
: Notification to the invited participant and other moderators in the room when the invitation is canceled by a moderator.
Sample Code
// Cancel floor invitation of a participantroom.cancelFloorInvite(clientId, function (resp) {if (resp.result) { // Success} else { // Error// Print arg.msg}});// Notification: To invited participant and moderatorsroom.addEventListener("floor-invite-cancelled", function (evt) {// evt is JSON/*{"type": "floor-invite-cancelled","users": {"id": "cancelFloorInvite","clientId": "STRING","name": "String","moderatorId": "STRING"}}*/});
Error Codes
Code | Description |
---|---|
5086 | The endpoint application is not connected to the room. |
5097 | cancelFloorInvite() is not applicable in a Chat-Only room. Non-contextual method call. |
5006 | A user with a participant role is not authorized to invoke cancelFloorInvite(). |
5045 | Unable to cancel the invitation for an invalid client ID. |
Accept Floor Invitation
The EnxRoom.acceptInviteFloorRequest()
method allows participants to accept the invitation to the floor and talk.
- Method:
EnxRoom.acceptInviteFloorRequest (String clientId)
- Parameters:
Callback
: Callback Function. To obtain status of request.
- Event Notifications:
floor-accepted
: Notification to all the moderators in the room when a participant accepts the invitation.
Sample Code
// To accept invitation to join floorroom.acceptInviteFloorRequest (function (resp) {if (resp.result) { // Success// Participant to publish stream.room.publish(localStream);} else { // Error// Print arg.msg}});// Notification: to moderatorsroom.addEventListener("floor-accepted", function (evt) {// evt is JSON, e.g./*{"type": "floor-accepted","users": {"id": "floorAccepted","clientId": "STRING","result": 1739,"msg": "Floor accepted"}}*/});
Error Codes
Code | Description |
---|---|
5086 | The endpoint application is not connected to the room. |
5097 | acceptInviteFloorRequest() is not applicable in a Chat-Only room. Non-contextual method call. |
5006 | A user with a moderator role is not authorized to invoke acceptInviteFloorRequest(). |
5045 | Unable to accept the invitation for an invalid client ID. |
Reject Floor Invitation
The EnxRoom.rejectInviteFloor()
method allows invited participants to reject the floor invitation.
- Method:
EnxRoom.rejectInviteFloor(Callback)
- Parameters:
Callback
: Callback Function. To obtain status of request.
- Event Notifications:
floor-rejected
: Notification to all the moderators including the moderator who sent the invitation when the participant rejects the invitation to join the floor.
Sample Code
// To reject the invitation to join the floorroom.rejectInviteFloor (function (resp) {if (resp.result) { // Success} else { // Error// Print arg.msg}});// Notification: To moderators. Invitation rejectedroom.addEventListener("floor-rejected", function (evt) {// evt JSON/*{"type": "floor-rejected","users": {"id": "floorRejected","clientId": "STRING","result": 1709,"msg": "Floor rejected"}}*/});
Error Codes
Code | Description |
---|---|
5086 | The endpoint application is not connected to the room. |
5097 | rejectInviteFloor() not applicable in a Chat-Only room. Non-contextual method call. |
5006 | A user with a moderator role is not authorized to invoke rejectInviteFloor(). |
5045 | Unable to reject the invitation for an invalid client ID. |
Restore a Moderator's Session
If a moderator is disconnected during a session, the list of floor access requests and participants currently with floor access can be retrieved through the room metadata when the moderator is reconnected.
Structured Data JSON
room.raisedHands
: An array of Client IDs requesting floor access.room.approvedHands
: An array of Client IDs currently having floor access.