Floor Access Control
Floor Access Control is used in Lecture Mode sessions. In Lecture Mode, only the moderator can publish a stream into the room — participants can only subscribe to the moderator's stream. If a participant wants to speak or share their camera, they must first request floor access from the moderator.
The floor access lifecycle works as follows:
- A participant sends a floor request to the moderator
- The moderator grants or denies the request
- If granted, the participant can now publish their stream
- The participant finishes and releases the floor, or the moderator releases it
Participants call requestFloor() to ask the moderator for permission to publish their
stream. The moderator receives the request and can act on it.
- Method:
window.EnxRtc.requestFloor()
| Event | Fired To | Description |
|---|---|---|
onFloorRequested | Requesting participant | Acknowledges that the request was sent to the moderator |
onFloorRequestReceived | Moderator | Delivers the incoming floor request to the moderator |
// Participant requests the floor
window.EnxRtc.requestFloor();
// Participant: request sent acknowledgement
window.EnxRtc.addEventListner("onFloorRequested", function(data) {
console.log("Floor request sent:", JSON.stringify(data.data));
showWaitingForFloorUI();
});
// Moderator: incoming floor request
window.EnxRtc.addEventListner("onFloorRequestReceived", function(data) {
console.log("Floor request received:", JSON.stringify(data.data));
showFloorRequestNotification(data.data.clientId, data.data.name);
});
A participant can withdraw a pending floor request at any time before the moderator acts on it.
- Method:
window.EnxRtc.cancelFloor()
| Event | Fired To | Description |
|---|---|---|
onFloorCancelled | Requesting participant | Acknowledges the floor request was cancelled |
onCancelledFloorRequest | Moderator | Notifies the moderator that the participant withdrew their request |
window.EnxRtc.cancelFloor();
// Participant: confirmed cancellation
window.EnxRtc.addEventListner("onFloorCancelled", function(data) {
console.log("Floor request cancelled (self):", JSON.stringify(data.data));
hideWaitingForFloorUI();
});
// Moderator: participant withdrew their request
window.EnxRtc.addEventListner("onCancelledFloorRequest", function(data) {
console.log("Floor request withdrawn by:", JSON.stringify(data.data));
removeFloorRequestFromList(data.data.clientId);
});
The moderator calls grantFloor() to approve a participant's floor request. The approved
participant gains the ability to publish their stream. The granted participant and all other moderators
in the room are notified.
- Method:
window.EnxRtc.grantFloor(clientId) - Parameter:
clientId— String. Client ID of the participant being granted floor access
| Event | Fired To | Description |
|---|---|---|
onProcessFloorRequested | Moderator | Acknowledges the moderator's grant action |
onGrantedFloorRequest | Granted participant & other moderators | Notifies the granted participant and moderators; includes the moderator's ID who granted it |
window.EnxRtc.grantFloor(clientId);
// Moderator: action acknowledged
window.EnxRtc.addEventListner("onProcessFloorRequested", function(data) {
console.log("Floor grant processed:", JSON.stringify(data.data));
});
// Granted participant and other moderators
window.EnxRtc.addEventListner("onGrantedFloorRequest", function(data) {
console.log("Floor granted to:", JSON.stringify(data.data));
if (data.data.clientId === myClientId) {
enablePublishing(); // Start publishing your stream
}
});
The moderator calls denyFloor() to reject a participant's floor request. The denied
participant and other moderators are notified.
- Method:
window.EnxRtc.denyFloor(clientId) - Parameter:
clientId— String. Client ID of the participant being denied
| Event | Fired To | Description |
|---|---|---|
onProcessFloorRequested | Moderator | Acknowledges the deny action |
onDeniedFloorRequest | Denied participant & other moderators | Notifies of the denial with the moderator's ID who denied it |
window.EnxRtc.denyFloor(clientId);
window.EnxRtc.addEventListner("onProcessFloorRequested", function(data) {
console.log("Floor deny processed:", JSON.stringify(data.data));
});
window.EnxRtc.addEventListner("onDeniedFloorRequest", function(data) {
console.log("Floor denied:", JSON.stringify(data.data));
if (data.data.clientId === myClientId) {
showFloorDeniedMessage();
}
});
When a participant is done speaking or presenting, they call finishFloor() to announce
the completion of their floor access and make the floor available for the next request.
- Method:
window.EnxRtc.finishFloor()
| Event | Fired To | Description |
|---|---|---|
onFloorFinished | Participant | Acknowledges the floor has been released by the participant |
onFinishedFloorRequest | All moderators | Notifies moderators that the participant has finished |
window.EnxRtc.finishFloor();
// Participant confirmation
window.EnxRtc.addEventListner("onFloorFinished", function(data) {
console.log("Floor finished (self):", JSON.stringify(data.data));
disablePublishing();
});
// Moderator notification
window.EnxRtc.addEventListner("onFinishedFloorRequest", function(data) {
console.log("Participant finished floor:", JSON.stringify(data.data));
markFloorAvailable();
});
The moderator calls releaseFloor() to forcibly terminate a participant's active floor
access. This unpublishes the participant's stream and makes the floor available for new requests.
- Method:
window.EnxRtc.releaseFloor(clientId) - Parameter:
clientId— String. Client ID of the participant whose floor access is being released
| Event | Fired To | Description |
|---|---|---|
onProcessFloorRequested | Moderator | Acknowledges the release action |
onReleasedFloorRequest | Released participant & other moderators | Notifies of the release with the moderator's ID who triggered it |
window.EnxRtc.releaseFloor(clientId);
window.EnxRtc.addEventListner("onProcessFloorRequested", function(data) {
console.log("Floor release processed:", JSON.stringify(data.data));
});
window.EnxRtc.addEventListner("onReleasedFloorRequest", function(data) {
console.log("Floor released for:", JSON.stringify(data.data));
if (data.data.clientId === myClientId) {
disablePublishing();
}
});
If the moderator's connection drops and later reconnects, the floor request queue is preserved by the server. On reconnection, the moderator can retrieve the current state from the room metadata:
- Pending requests:
room.getRoomMetaData().getJSONArray("raisedHands")— array of clients who requested floor access - Active floor holders:
room.getRoomMetaData().getJSONArray("approvedHands")— array of clients currently holding floor access
Read these arrays inside your onRoomConnected handler after a reconnect to restore the
moderator's UI without losing any pending floor state.