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 Enx.startRecord() method, and to stop may use Enx.stopRecord() method. On successful initiation of recording and stopping of recording the moderator will be notified using startRecordingEvent and stopRecordingEvent callbacks; also, all other participant swill be notified using roomRecordingOn and roomRecordingOff Callbacks respectively.

Methods:

  • Enx.startRecord() – No parameter needed. To start recording
  • Enx.stopRecord() – No parameter needed. To stop recording

Callbacks:

  • startRecordingEvent – To moderator to notify that recording has started
  • stopRecordingEvent – To moderaor to notify that recording has stopped
  • roomRecordingOn – To all participant to notify recording is on
  • roomRecordingOff – To all participant to notify recording is off
Enx.startRecord(); // Start Recording

// To moderator: Recording started
startRecordingEvent : event=>{
	// event = { result: 0, msg: “success”}
}

// To participants: Recording started
roomRecordingOn :event =>{
	// event = { result: 0, msg: "Room recording On"}
}

Enx.stopRecord(); // Stop Recording

// To moderator: Recording stopped
stopRecordingEvent : event=>{
	// event = { result : 0, msg : “success”}
}

// To participants: Recording stopped
roomRecordingOff :event =>{
	// event = { result: 0, msg: "Room recording Off"}
}

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 Enx.hardMute() method; and to disable you may use EnxRoom.hardUnmute() method. Moderator of the room is notified with mutedAllUser and unmutedAllUser callbacks; whereas all Participants are notified with hardMutedAll and hardUnmuteAllUser callbacks respectively.

Methods:

  • Enx.hardMute() – to hard mute room
  • Enx.hardUnmute() – to hard unmute room

Callbacks:

  • hardMutedAll – To all participants on hard-muting Room
  • hardUnmuteAllUser – To all participants on hard-unmuting Room
  • mutedAllUser – To notify Moderator that Room is hard-muted
  • unmutedAllUser – To notify Moderator that Room is hard-unmuted
Enx.hardMute (); // To hard mute room

// To Moderator - Room is hard muted 
mutedAllUser: event=>{
	// event= { result: 0, msg : “room muted” }
}

// To Participants - Room is hard muted 
hardMutedAll :event =>{
	// event= { msg : “Room is muted”, status: true }
}

Enx.hardUnmute (); // To hard un-mute room

// To Moderator - Room is hard unmuted 
unMutedAllUser : event=>{
	// event= { result: 0, msg : “room un-muted” }
}

// To Participants - Room is hard unmuted 
hardUnmuteAllUser :event =>{
	// event= { msg : “Room is un-muted”, status: false }
}

Hard Mute / Unmute Participant

Moderator may enforce hard-mute on any selected participant in the room. The affected participant will not be able to talk or may not be able to publish his video ntil the imposed state is lifted.

React Native Toolkit offers hard muting audio and force dropping the video of selected participant using  Enx.hardMuteAudio() and Enx.hardMuteVideo()  methods respectively. You may lift the enforced muting state of Audio or Video using Enx.hardUnMuteAudio()  and Enx.hardUnMuteVideo)  ) methods respectively. The affected participant is notified using related events, viz. onHardMutedAudioonHardUnMutedAudioonHardMutedVideo and onHardUnMutedVide. All participants are notified about the mute status of the affected participant using related events, viz. onReceivedHardMuteAudioonReceivedHardUnMuteAudioonReceivedHardMuteVideo and onReceivedHardUnMuteVideo.

Class: EnxStream

Methods:

  • Enx.hardMuteAudio(streamId, clientId) – to hard mute audio
  • Enx.hardMuteVideo(streamId,clientId) – to hard mute video
  • Enx.hardUnmuteAudio(streamId,clientId)– to hard unmute audio
  • Enx.hardUnmuteVideo(streamId,clientId) – to hard unmute video

Callbacks:

  • receivedHardMutedAudio – To the affected participant to notify about hard-muted audio
  • receivedHardUnmutedAudio – To the affected participant to notify about hard-unmuted audio
  • receiveHardMuteVideo – To the affected participant to notify about hard-muted video
  • receiveHardUnmuteVideo – To the affected participant to notify about hard-unmuted video
  • hardMuteAudio – To moderator to notify about user’s hard-muted audio
  • hardMuteVideo – To moderator to notify about user’s hard-unmuted audio
  • hardVideoMute – To moderator to notify about user’s hard-muted video
  • hardVideoUnmute – To moderator to notify about user’s hard-unmuted video
Enx.hardMuteAudio(streamId,clientId);	// To hard mute user's audio

// To Moderator: User's audio is hard muted
hardMuteAudio : event=>{
	// event = {result: 0 }
}

// To affected Participant: Your audio is hard muted
receivedHardMutedAudio :event =>{
	// { result: 0, clientId: "XXX", msg: "user audio hard muted" }
}

Enx.hardUnmuteAudio(streamId,clientId);	// To hard unmute user's audio

// To Moderator: User's audio is hard unmuted
hardUnmuteAudio : event=>{
	// event = {result: 0 }
}

// To affected Participant: Your audio is hard unmuted
receivedHardUnmutedAudio :event =>{
	// { result: 0, clientId: "XXX", msg: "user audio hard unmuted" }
}

// Similar coding for User's video mute/unmute

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: Enx.requestFloor() – No parameter needed. Participant requests floor access

Callbacks:

  • floorRequested   – Requesting Participant received acknowledgement that his request has been received by Moderator
  • floorRequestReceived  – The Moderator receives requests from Participant
Enx.requestFloor(); // Participant requests floor access

// Participant is acknowledged
floorRequested : event =>{
	// event { result:1701, msg:'Floor Request Received' }
}

// Moderator receive Floor Access Request
floorRequestReceived : event =>{
	// event { clientId : 1234, name : 'android' }
}

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: Enx.grantFloor(clientID) – Moderator grants floor access to participant

Callbacks:

  • processFloorRequested – Moderator is acknowledged that Participant is granted floor access
  • grantedFloorRequest – Participant receives floor access
Enx.grantFloor(ClientId); // To grant floor access to ClientId

// To participant: Floor Access granted
grantedFloorRequest : event =>{
	// event = { result:1708, msg:'Floor Granted', clientId: "XXX" }
} 

//To moderator: Acknowledgement 
processFloorRequested : event =>{
	// event = { result:1708, msg:'Floor Granted' }
}

Deny Floor Access

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

Method: Enx.denyFloor(ClientIDk) – Moderator denies floor access to a Participant

Callbacks:

  • processFloorRequested – Moderator is acknowledged that he denied floor access to a Participant
  • deniedFloorRequest – Participant is notified that he has been denied floor access
Enx.denyFloor(ClientId); // To deny floor access to ClientId

// To participant: Floor Access request denied
deniedFloorRequest : event =>{
 // event = { result:4117, msg:'Floor request denied', clientId: "XXX" }
} 

//To moderator: Acknowledgement 
processFloorRequested : event =>{
 // event = { result:1709, msg:'Floor Denied' }
}

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: Enx.releaseFloor(clientId) – Moderator released floor request from a Client

Callbacks:

  • processFloorRequested – Moderator is acknowledged that floor is released
  • floorReleased– Participant i notified that floor access has been revoked. His stream is automatically unpublished.
Enx.releaseFloor(ClientId); // To release floor access floor ClientId

// To participant: Floor Access released
floorReleased : event =>{
	// event = { result:1712, msg:'Floor released', clientId: "XXX" }
} 

//To moderator: Acknowledgement 
processFloorRequested : event =>{
	// event = { result:1712, msg:'Floor Released' }
}

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

Structured Data JSON

  • room.raisedHands– An Array of Client-IDs who requested floor-access
  • room.approvedHandsAn Array of Client-IDs 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.

MethodEnx.switchUserRole(clientId)

ParameterclientId – Client ID of the participant who is being designated as Moderator

Callbacks:

  • acknowledgeSwitchUserRole– Moderator is acknowledged that he has requested for Switch User Role
  • userRoleChanged– 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
Enx.switchUserRole(clientId); // Role Change Request from Moderator

acknowledgeSwitchUserRole: event => {
	// Moderator is acknowledged
}

userRoleChanged: event => {
	// All Participants are notified - event jsonObject
	/*
	{	"moderator": false, // You are not a moderator
		"clientId": "XXX"   // New Moderator's Client ID
	}
	*/
    
	// New Moderator is notified  - jsonObject
	/*
	{   "moderator": true,  // You are a moderator
		"clientId": "XXX",  // New Moderator's Client ID i.e. You
		"raisedHands":[],   // List of Client IDs requested Floor Access
		"approvedHands":[]  // List of Client IDs with Floor Access
	}
	*/
}

Explore Android Toolkit