The EnxRoom.switchUserRole()
method allows the Moderator to promote a Participant to act as a Moderator in the ongoing Session. This newly appointed Moderator gets access to Moderator Controls and the former Moderator becomes a Participant in the Session. The new Moderator can further grant the Moderator role to another participant if so desired.
Class: EnxRoom
Method: public void switchUserRole(String ClientId)
Parameter: ClientId
– Client ID of the participant who is being designated as Moderator
Callbacks:
onSwitchedUserRoleChange
– Acknowledgment to the Moderator when a Switch User Role is requested.onUserRoleChanged
– Notification to all participants in the Room when a participant is newly appointed as the Moderator. The appointed moderator is notified with extra information required to moderate the Session.
room.switchUserRole(clientId); // Role Change Request from Moderator public void onSwitchedUserRole(JSONObject jsonObject){ // Moderator is acknowledged } public void onUserRoleChanged(JSONObject jsonObject){ // All Participants are notified - 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 requesting Floor Access "approvedHands":[] // List of Client IDs with Floor Access } */ }
Error Codes & Exceptions
Code | Description |
---|---|
5085 | Unauthorized Access. When a user with participant role invokes switchUserRole() |