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 Cordova 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 the floor access granted to a participant.

Request Floor Access

The requestFloor() method allows a participant to request the moderator for floor access.

  • Method: requestFloor()
  • Event Listeners:
    • onFloorRequested : Acknowledgement to the requesting participant that her request has been received by the moderator.
    • onFloorRequestReceived : The moderator receives requests from the participant.

Sample Code

// To request floor access
window.EnxRtc.requestFloor();
// Add Event Listener: Acknowledges request received,
// to be forwarded to Moderator
window.EnxRtc.addEventListner("onFloorRequested", function(data) {
console.log(JSON.stringify(data.data));
});
// Add Event Listener: Request received by Moderator
window.EnxRtc.addEventListner("onFloorRequestReceived", function(data) {
console.log(JSON.stringify(data.data));
});

Cancel a Requested Floor Access

The cancelFloor() method allows participants to cancel their request for pending floor access for moderator's approval.

  • Method: cancelFloor()
  • Event Listeners:
    • onCancelledFloorRequest : Notification to the moderator when a participant cancels a floor access request.
    • onFloorCancelled : Acknowlegement to the participant in the room that her request for floor access has been canceled.

Sample Code

// To cancel floor request
window.EnxRtc.cancelFloor();
// Add Event Listener: Acknowledges cancel request received
window.EnxRtc.addEventListner("onFloorCancelled", function(data) {
console.log(JSON.stringify(data.data));
});
// Add Event Listener: Floor request is cancelled
window.EnxRtc.addEventListner("onCancelledFloorRequest", function(data) {
console.log(JSON.stringify(data.data));
});

Deny Floor Access

The denyFloor() method allows moderators to deny a participant's request for floor access.

  • Method: denyFloor( clientID )
  • Parameters:
    • clientID: String. Client ID of the participant who has been denied the floor access.
  • Event Listeners:
    • onProcessFloorRequested : Acknowledges the Moderator who denied floor request.
    • onDeniedFloorRequest : Notification to the denied participant and other moderators that floor request is denied. The notification contains Moderator's ID who denied the request.

Sample Code

// To deny floor access to a client id
window.EnxRtc.denyFloor(clientID);
// Add Event Listener: Acknowledges moderator
window.EnxRtc.addEventListner("onProcessFloorRequested", function(data) {
console.log(JSON.stringify(data.data));
});
// Add Event Listener: Notifies other moderators and denied participant
window.EnxRtc.addEventListner("onDeniedFloorRequest", function(data) {
console.log(JSON.stringify(data.data));
});

Grant Floor Access

The 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: grantFloor( clientID )
  • Parameterd:
    • clientID: String. Client ID of the participant who is granted floor access.
  • Event Listeners:
    • onProcessFloorRequested : Acknowlegement to the moderator that the participant has been granted floor access.
    • onGrantedFloorRequest : Notification to the granted participant and other moderators that floor request is granted. The notification contains Moderator's ID who granted the floor access.

Sample Code

// To grant floor access to a client id
window.EnxRtc.grantFloor(clientID);
// Add Event Listener: Acknowledges moderator
window.EnxRtc.addEventListner("onProcessFloorRequested", function(data) {
console.log(JSON.stringify(data.data));
});
// Add Event Listener: Notifies other moderators and granted participant
window.EnxRtc.addEventListner("onGrantedFloorRequest", function(data) {
console.log(JSON.stringify(data.data));
});

Complete a Granted Floor Access

The finishFloor() allows participants to announce the completion and release of floor access.

  • Method: finishFloor()
  • **Event Listeners: **
    • onFinishedFloorRequest : Notification to the moderator that the participant has ended floor access.
    • onFloorFinished : Notification to all the moderators when a participant finishes the floor access.

Sample Code

// To grant floor access to a client id
window.EnxRtc.finishFloor();
// Add Event Listener: Acknowledges the participant
window.EnxRtc.addEventListner("onFloorFinished", function(data) {
console.log(JSON.stringify(data.data));
});
// Add Event Listener: Notifies all moderators
window.EnxRtc.addEventListner("onFinishedFloorRequest", function(data) {
console.log(JSON.stringify(data.data));
});

Release Floor Access

The 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: releaseFloor( clientId )
  • Parameters:
    • clientID: String. Client ID of the participant whose floor access will be released.
  • Event Listeners:
    • onProcessFloorRequested : Acknowlegement to the moderator that the floor is released.
    • onReleasedFloorRequest : Notification to the released participant and other moderators that floor is released. The notification contains Moderator's ID who released the floor access.

Sample Code

// To release floor access to a client id
window.EnxRtc.releaseFloor(clientID);
// Add Event Listener: Acknowledges moderator
window.EnxRtc.addEventListner("onProcessFloorRequested", function(data) {
console.log(JSON.stringify(data.data));
});
// Add Event Listener: Notifies other moderators and released participant
window.EnxRtc.addEventListner("onReleasedFloorRequest", function(data) {
console.log(JSON.stringify(data.data));
});

Restore Moderator Session

In case the Moderator is disconnected during a session, the list of received floor requests and participants currently with floor access can be retrieved when the connection is restored to the room in the Room-Meta-Data viz.

Structured Data JSON:

  • room.getRoomMetaData().getJSONArray("raisedHands"): An array of client information who requested the floor access.
  • room.getRoomMetaData().getJSONArray("approvedHands"): An array of client information who currently has floor access.