EnableX API provides different methods to access Room Information.

Table of Contents

Get Room ID

Every Room is assigned with a Unique Room ID while creating the Room. The Room ID of the room to which you are connected may be known by using getRoomId() method.

Method: static Future<String> getRoomId() – No parameter needed

String room_id = EnxRtc.getRoomId();

Get connected User ID or Client ID

Each connected user to the Room is assigned with a Unique Client ID for the session. To know the Client ID of the connected user from the enc-point, use getClientId() method.

Method: static Future<String> getClientId() – No parameter needed

String ClientId = EnxRtc.getClientId(); 

Get connected User Name

To know the name of connected user from the end-point, use getClientName() method.

Method: static Future<String> getClientName() – No parameter needed

String ClientName = EnxRtc.getClientName(); 

Get connected User Role

A User connected to a Room with either role of moderator or participant. Use getRole() to know role of the user

Method: static Future<String> getRole() – No parameter needed

Returns: Enumerated Values: moderator, participant

String role = EnxRtc.getRole();

Get connected User Information at an End-Point

To get connected user information at an End-Point, use whoami() method. It returns complete user-meta for the connected user in a JSON Object.

Method: static Future<Map<String, dynamic>> whoAmI() – No parameter needed

JSONObject myinfo = EnxRtc.whoami(); 

Note: Refer JSON Object structure for User Meta – i.e. for myinfo in above example.

Get connected User List

To get a list of connected users to the Room to which the end-point is also connected to, use getUserList() method. It returns a JSON with list of connected user’s information.

Method: static Future<List<dynamic>> getUserList() – No parameter needed

List users= EnxRtc.getUserList();

// Return List Users
/*
[
      {
          "clientId": "",             // Unique Client ID assigned by EnableX
          "name": "",                 // User's name
          "user_ref": "",             // User's Reference
          "role": "participant",      // Enum: moderator, participant
          "permissions": {            // In-Session Permission of User
          "publish": Boolean,         // Whether user can pubish local stream
          "subscribe": Boolean,       // Whether user can subscribe remote streams
          "record": Boolean,          // Whether user can initiate recording
          "stats": Boolean,           // Whether user can view stream status
          "controlhandlers": Boolean  
          }
      }
  ] 
*/

Get list of Remote Streams

To get all the Remote Streams available in the Room, use getRemoteStreams() method.

Method: public Map < String, EnxStream > getRemoteStreams() – No parameter needed

Map <String, EnxStream> remoteStreams = room.getRemoteStreams();

Know if Room has Active Talker

To check if the Room has Active Talker use isRoomActiveTalker() method.

Method: static Future<bool> isRoomActiveTalker()

await EnxRtc.isRoomActiveTalker();