A user connected with EnableX session with “Moderator” role has additional privileges over that of a “Participant” for the session. The Moderator exercises his privileges by executing exclusive methods designed to work from his End Point only, are known as Moderator Controls.

Table of Contents

Record a Session

Using EnableX you may get a RTC session recorded as individual streams and later be transcoded through a post-session service to create a single video file which can be retrieved and re-played using any Video Player. Recording can be started in 2 ways, viz.

Auto-Recording

You may define a room to start recording automatically as and when a session starts in the room. You may pass { settings: { auto_recording: true }} in the JSON Payload while creating a room to ensure a session is recorded automatically.

On-Demand Recording

Client API call helps you start and stop recording as and when needed. The available methods are accessible to Moderator only. Therefore, on the Moderator End-Point, you may require to create UI to use the methods to start or stop recording a session.

To start session recording on demand you may use startRecord() method, and to stop may use stopRecord() method. On successful initiation of recording and stopping of recording the moderator will be notified using onStartRecordingEvent and onStopRecordingEvent event listeners; also, all other participant swill be notified using onRoomRecordingOn and onRoomRecordingOff event listener respectively.

Methods:

  • static Future<void> startRecord() – No parameter needed. To start recording
  • static Future<void> stopRecord() – No parameter needed. To stop recording

Event Listeners:

  • onStartRecordingEvent – To moderator to notify that recording has started
  • onStopRecordingEvent – To moderaor to notify that recording has stopped
  • onRoomRecordingOn – To all participant to notify recording is on
  • onRoomRecordingOff – To all participant to notify recording is off
EnxRtc.startRecord(); // To start recording
EnxRtc.stopRecord(); // To stop recording

EnxRtc.onRoomRecordingOn= (Map<dynamic, dynamic> map) {
	// To all participant to notify recording is on
	// map is {"msg":"Room Recording On","result":"0”}
};

EnxRtc.onRoomRecordingOff= (Map<dynamic, dynamic> map) {
	// To all participant to notify recording is off
	// map is {"msg":"Room Recording Off","result":"0”}
};

EnxRtc.onStartRecordingEvent= (Map<dynamic, dynamic> map) {
	// To moderator to notify that recording has started
	// map is {"result":0”,"msg":"Success"}
};

EnxRtc.onStopRecordingEvent= (Map<dynamic, dynamic> map) {
	// To moderator to notify that recording has stopped
	// map is {"result":0”,"msg":"Success"}
};

EnxRtc. onRoomRecordingOff= (Map<dynamic, dynamic> map) {
  // To all participant to notify recording is 
   //where map is
  //{"msg":"Room Recording Off","result":"0”}

};

Note:

  • Moderator can start/stop recording any number of time during a session as he wishes.
  • Moderator can stop recording in a room defined with auto-recording feature.

Refer: How to fetch Recordings?

Hard Mute / Unmute Room

Moderator may put the room in a hard-mute state when he wishes no-one else to be audible in the Room. Any new user who joins the room when the room is in hard-mute state will also be inaudible

To put room into hard mute state, you may use hardMute() method; and to disable you may use hardUnMute() method. All participant of the room are notified with   onReceivedHardMute and onReceivedHardUnMuteevent listeners; whereas the Moderator is notified with onHardMuted and onHardUnMutedevent listeners respectively.

Methods:

  • static Future<void> hardMute() – to hard mute room
  • static Future<void> hardUnMute() – to hard unmute room

Callbacks:

  • onReceivedMuteRoom  – To all participants on hard-muting Room
  • onReceivedUnMuteRoom  – To all participants on hard-unmuting Room
  • onMutedRoom  – To notify Moderator that Room is hard-muted
  • onUnMutedRoom – To notify Moderator that Room is hard-unmuted
EnxRtc.hardMute(); // To hard-mute Room
EnxRtc.hardUnMute(); // To hard-unmute Room

EnxRtc.onHardMuted= (Map<dynamic, dynamic> map) {
    // Moderators are notified that Room is hard-muted  
};

EnxRtc.onReceivedHardMute= (Map<dynamic, dynamic> map) {
    // Participants are notified that Room is hard-muted   
};

EnxRtc.onHardUnMuted = (Map<dynamic, dynamic> map) {
    // Moderators are notified that Room is hard-unmuted        
};

EnxRtc.onReceivedHardUnMute = (Map<dynamic, dynamic> map) {
     // Participants are notified that Room is hard-unmuted   
};

Lock / Unlock Room

Moderator may lock the Room forbidding any new person from joining the Session. To allow subsequent users to join session, Moderator need to unlock the Room.

To put room into Lock State, you use lockRoom() method; and to unlock the Room you use unLockRoom() method.

Methods:

  • static Future<void> lockRoom() – To lock Room
  • static Future<void> unLockRoom()  – To unlock Room

Event Listeners:

  • onAckLockRoom:  To acknowledge moderator that the Room has been locked
  • onLockedRoom: To notify all participants that the room has been locked
  • onAckUnLockRoom: To acknowledge moderator that the Room has been unlocked
  • onUnLockedRoom: To notify all participants that the room has been unlocked
EnxRtc.lockRoom();	// To lock room
EnxRtc.unLockRoom();	// To unlock room

EnxRtc.onAckUnLockRoom = (Map<dynamic, dynamic> map) {
	// Moderator is acknowledged that room has been locked 
};

EnxRtc.onLockedRoom = (Map<dynamic, dynamic> map) {
	// Participants are notified that room has been locked
};
 
EnxRtc.onAckUnLockRoom = (Map<dynamic, dynamic> map) {
      // Moderator is acknowledged that room has been unlocked 
};

EnxRtc.onUnLockedRoom = (Map<dynamic, dynamic> map) {
	// Participants are notified that room has been unlocked
};

Disconnect User

Moderation may wish to disconnect or force-drop one or more participant(s) from the Session by using dropUser() method.

Method: static Future<void>dropUser(List<dynamic>clientIds)

Parameter:

  • {List} clientsIds-  Pass list of clientIds: Required. List of CientId to be disconnected.

Event Listeners:

  • onAckDropUser: To acknowledge that the user has been disconnected
EnxRtc.dropUser([clientIds]); // To drop clientIds from Session

EnxRtc.onAckDropUser=(Map<dynamic,dynamic> map) {
	// Moderators are notified with clientIds dropped
};

Destroy Session

Moderation may wish to conclude an ongoing session by using using destroy() method.

Method: static Future<void> destroy()

Event Listeners:

  • onAckDestroy To acknowledge that the session has been destroyed
EnxRtc.destroy(); // Destroy Session

EnxRtc.onAckDestroy= (Map<dynamic, dynamic> map) {
	// Notification to all that Session is destroyed.
};

Floor Access Control in Lecture Mode

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 to ask during the session, the Moderator can grant the floor to the participant to publish his stream.

The following steps to deploy Control Floor Access by moderator:

Request Floor Access

A participant requests for Floor access is forwarded to the Moderator using a notification event.

Method: static Future<void> requestFloor() – No parameter needed. Participant requests floor access

Event Listners:

  • onFloorRequestReceived– The Moderator receives requests from Participant
EnxRtc.requestFloor(); // Request Floor Access

EnxRtc.onFloorRequestReceived= (Map<dynamic, dynamic> map) {
	 // Moderator receives floor access request 
	// map is { "clientId": "XXXX", "name": "iOS" }
};

Cancel Requested Floor Access

A participant may cancel his request for Floor access which is pending at Moderator Side.

Method: static Future<void> cancelFloor() - Participant cancels request floor access

Event Listeners

  • onCancelledFloorRequest: Moderator receives cancellation notification for already posted Floor Access Request from Participant
  • onFloorCancelled: Participant receives acknowledgement that his request for Floor Request has been cancelled.
EnxRtc.cancelFloor(); // Request Floor Cancellation

EnxRtc.onCancelledFloorRequest= (Map<dynamic, dynamic> map) {
	// Moderators are notified about Request Cancellation
};

EnxRtc.onFloorCancelled= (Map<dynamic, dynamic> map) {
	// Participant is notified about cancelled request
};

Deny Floor Access

The Moderator may also deny a request for floor access to a participant.

ClassEnxRoom

Method: static Future<void> denyFloor(String clientId) – Moderator denies floor access to a Participant

Parameters

  • @param String clientId – Client id to deny floor.

Event Listeners:

  • onDeniedFloorRequest – Participant is notified that he has been denied floor access
EnxRtc. denyFloor(‘clientId’); // To deny floor request to CLientId

EnxRtc.onDeniedFloorRequest= (Map<dynamic, dynamic> map) {
	// Notification to the User that he floor access request is denied
	// map = { "result":4117,"msg":"Floor Request Denied","clientId":"XXX" }
};

Grant Floor Access

Moderator might grant floor access to one or many users one by one. Note that at any given point of time, only one person may be granted floor access. To grant access to others, moderator must release floor access from the participant who is currently granted floor access. Once granted floor access, the designated participant will be notified using an event and he can publish his stream.

Method: static Future<void> grantFloor(String clientId) – moderator grants floor access to participant

Parameters:

  • @param String clientId – Client ID of the User whom Floor Access is being granted.

Event Listeners:

  • onGrantFloorRequest – Participant receives floor access
EnxRtc.grantFloor(‘clientId’); // To grant floor access to ClientId

EnxRtc.onGrantedFloorRequest= (Map<dynamic, dynamic> map) {
   // Participant is notified that Floor Access is granted
   // map =  { "result":1708,"msg":"Floor Granted","clientId":"XXX" }
};

Finish Granted Floor Access

The Participant can finish floor access granted to him by Moderator.

ClassEnxRoom

Method: static Future<void> finishFloor() – Participant finishes his granted Floor Access

Event Listeners:

  • onFinishedFloorRequest: Moderator receives notification that participant has finish granted Floor Access himself.
  • onFloorFinished: Participant receives acknowledgement that he finished granted Floor Access.
EnxRtc.finishFloor(); // To finish floor request

EnxRtc.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

Moderator may terminate floor access granted to some participant. Upon termination, the user’s stream(s) is unpublished. It is necessary to terminate floor access of a participant before giving out floor access to another participant.

Method: static Future<void> releaseFloor(String clientId) – Moderator asks participant to release floor

Parameters:

  • @param String clientId – Client id white floor access is being released.

Event Listners:

  • onReleasedFloorRequest – Participant i notified that floor access has been revoked. His stream is automatically unpublished.
EnxRtc.releaseFloor(‘clientId’); // Floor is released from clientId

EnxRtc.onReleasedFloorRequest = (Map<dynamic, dynamic> map) {
	// To notify participant that Floor Access is released
	// map = { "result":1712,"msg":"Floor released","clientId":"XXX" }
};

Restore Moderator Session

In case the Moderator is disconnected during a session, the list of received floor requests and participant currently with floor access can be retrieved when 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 floor-access
  • room.getRoomMetaData().getJSONArray("approvedHands") An Array of Client-Information who currently has floor access

Change Participant’s Role

A Moderator can designate a connected Participant to act as a Moderator during the session. Doing so, the promoted Participant would get access to all the rights of the Moderator, i.e. accesses all features listed under Moderator Controls; and the old Moderator becomes a Participant. Similarly, the new Moderator can further grant Moderator Role to other participant if needed.

Method: static Future<void> switchUserRole(String clientId)

Parameter:

  • @param Sting clientId – Client ID of the participant who is being designated as Moderator

Event Listeners:

  • onSwitchedUserRole – Moderator is acknowledged that he has requested for Switch User Role
  • onUserRoleChanged – All participants are notified with a message that a new user has been appointed as moderator. Also, the newly appointed moderator is notified with extra information
EnxRtc.switchUserRole(‘clientId’); // To assign Moderator Role to clientId

EnxRtc.onSwitchedUserRole = (Map<dynamic,dynamic> map) {
	/ /Moderator is notified that request to role-switch is received 
};

EnxRtc.onUserRoleChanged = (Map<dynamic,dynamic> map) {
	// Everyone is notified about the new Moderator
};

Explore Flutter SDK