Floor Access Control
In Lecture mode, only the moderator publishes a stream to the room, whereas all other participants subscribe to see and listen to the moderator. If participants have questions during the session, the moderator can grant the floor to the participant to publish his stream.
The Flutter SDK provides the following methods:
- requestFloor(): To request for floor access.
- cancelFloor(): To cancel a floor invitation sent to a participant.
- denyFloor(): To deny a floor access request.
- 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 EnxRtc.requestFloor()
method allows a participant to request the moderator for floor access.
Class: EnxRtc
Method: static Future<void> requestFloor()
Event Listener: onFloorRequestReceived
: Notification to the moderator when a participant's access request is received.
Sample Code
EnxRtc.requestFloor(); // Request Floor AccessEnxRtc.onFloorRequestReceived= (Map<dynamic, dynamic> map) {// Moderator receives floor access request// map is { "clientId": "XXXX", "name": "iOS" }};
Cancel a Requested Floor Access
The EnxRtc.cancelFloor()
method allows participants to cancel their request for pending floor access for moderator's approval.
Class: EnxRtc
Method: static Future<void> cancelFloor()
Event Listeners:
Event Listener | Description |
---|---|
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. |
Sample Code
EnxRtc.cancelFloor(); // Request Floor CancelationEnxRtc.onCancelledFloorRequest= (Map<dynamic, dynamic> map) {// Moderators are notified about Request Cancelation};EnxRtc.onFloorCancelled= (Map<dynamic, dynamic> map) {// Participant is notified about canceled request};
Deny Floor Access
The EnxRtc.denyFloor()
method allows moderators to deny a participant's request for floor access.
Class: EnxRtc
Method: static Future<void> denyFloor(String clientId)
Parameters: clientId
: Client ID of the user whose floor access request is denied.
Event Listener: onDeniedFloorRequest
: JSON Object. Notification to the participant that floor access has been denied.
Sample Code
EnxRtc. denyFloor('clientId'); // To deny floor request to CLientIdEnxRtc.onDeniedFloorRequest= (Map<dynamic, dynamic> map) {// Notification to the User that the floor access request is denied// map = { "result":4117,"msg":"Floor Request Denied","clientId":"XXX" }};
Grant Floor Access
The EnxRtc.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.
Class: EnxRtc
Method: static Future<void> grantFloor(String clientId)
Parameters: clientId
: Client ID of the user to whom Floor Access is being granted.
Event Listener: onGrantFloorRequest
: JSON Object. Notification to the participant when floor access is received.
Sample Code
EnxRtc.grantFloor('clientId'); // To grant floor access to ClientIdEnxRtc.onGrantedFloorRequest= (Map<dynamic, dynamic> map) {// Participant is notified that Floor Access is granted// map = { "result":1708,"msg":"Floor Granted","clientId":"XXX" }};
Complete a Granted Floor Access
The EnxRtc.finishFloor()
method allows participants to announce the completion and release of floor access.
Class: EnxRtc
Method: static Future<void> finishFloor()
Event Listeners:
Event Listener | Description |
---|---|
onFinishedFloorRequest | Notification to all the moderators when the participant finishes the floor access. |
onFloorFinished | Acknowledgment to the participant when floor access is finished. |
Sample Code
EnxRtc.finishFloor(); // To finish floor requestEnxRtc.onFinishedFloorRequest= (Map<dynamic, dynamic> map) {// Moderator is notified that participant has// finished Floor Access himself/* map is {msg = Success;request = {id = processFloorRequest;params = {action = finishFloor;clientId = "ClentID";};};result = 0;}*/};EnxRtc. onFloorFinished= (Map<dynamic, dynamic> map) {// Participant is notified that floor access is finished};
Release Floor Access
The EnxRtc.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.
Class: EnxRtc
Method: static Future<void> releaseFloor(String clientId)
Parameters: clientId
: Client ID of the user from whom floor access is being released.
Event Listener: onReleasedFloorRequest
: JSON Object. Notification to the participant that floor access has been revoked.
Sample Code
EnxRtc.releaseFloor('clientId'); // Floor is released from clientIdEnxRtc.onReleasedFloorRequest = (Map<dynamic, dynamic> map) {// To notify participant that Floor Access is released// map = { "result":1712,"msg":"Floor released","clientId":"XXX" }};
Restore a Moderator's 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 metadata for the room.
Structured Data JSON
room.getRoomMetaData().getJSONArray("raisedHands")
: An array of client information on the user who requested floor access.room.getRoomMetaData().getJSONArray("approvedHands")
: n array of client information on the user who has floor access.