Get Room Information
The Android SDK provides the following methods to access the Room-related Information:
- getRoomId(): Provides the room ID of the connected user.
- getRoomMetaData(): Provides the room meta information of the connected user.
- getMode(): Provides the information about the room mode: Group mode or the Lecture mode.
- getClientId(): Provides the client ID of the connected endpoint.
- getClientName(): Provides the name of the user connected through the client endpoint.
- getRole(): Provides the user role connected to the room.
- whoami(): Provides the complete user meta information.
- getUserList(): Provides the list of users in the room.
- getLocalStreamID(): Provides the local stream ID.
- getStreamByStreamId: Provides the stream information.
- getRemoteStreams(): Provides the list of remote streams.
- isPublishing(): Checks if the local stream is being published.
Get a Room ID
The EnxRoom.getRoomId()
method provides the ID of a room you are connected to. The Room ID is assigned to each room during Room Creation.
Class: EnxRoom
Method: public String getRoomId()
Return: String Room ID
Sample Code
String roomID = room.getRoomId();
Get Room Meta Information
The EnxRoom.getRoomMetaData()
method provides the meta information of a room to which you are connected. The Room Meta Information JSON payload contains the complete room definition and many runtime parameters with their current values and room stats of connected users and streams. All the endpoints receive this information through the onRoomConnected
observer after getting connected to a room. Some of the runtime parameters are updated internally by the SDK on various events.
Class: EnxRoom
Method: public JSONObject getRoomMetaData()
Return: Room Meta Information JSON object
Sample Code
JSONObject roomMeta = getRoomMetaData();
Get Room Mode
The EnxRoom.getMode()
method provides the mode in which the room operates which is group mode or lecture mode.
Class: EnxRoom
Method: public String getMode()
Returns: Enumerated Values: group
, lecture
.
Sample Code
String mode = room.getMode();
Get Client ID of the Connected User
The EnxRoom.getClientId()
method provides the client ID of the connected endpoint. The client ID is unique for each user connected to a room for the session.
Class: EnxRoom
Method: public String getClientId()
Sample Code
String clientId = room.getClientId();
Get the Name of the Connected User
The EnxRoom.getClientName()
method provides the name of the user connected through the client endpoint.
Class: EnxRoom
Method: public String getClientName()
Sample Code
String clientName = room.getClientName();
Get the Role of the Connected User
The EnxRoom.getRole()
method provides the user's role connected to the Room for the session, either Moderator or Participant.
Class: EnxRoom
Method: public String getRole()
Sample Code
String role = room.getRole();
Get Information of the Connected User
The EnxRoom.whoami()
method provides the complete User Meta Information of the connected user.
Class: EnxRoom
Method: public JSONObject whoami()
Sample Code
JSONObject myinfo = room.whoami();
Get the List of Connected Users
The EnxRoom.getUserList()
method provides a list of the connected users to a room.
Class: EnxRoom
Method: public JSONObject getUserList()
Sample Code
JSONObject Users = room.getUserList()// Return JSON 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 a local stream"subscribe": Boolean, // Whether user can subscribe to remote streams"record": Boolean, // Whether user can initiate recording"stats": Boolean, // Whether user can view stream status"controlhandlers": Boolean}}]*/
Get a Local Stream ID
The EnxRoom.getLocalStreamID()
method provides the ID of your Local Stream published in a room.
Class: EnxRoom
Method: public String getLocalStreamID()
Sample Code
String localStreamID = room.getLocalStreamId();
Get a Stream by Stream ID
The EnxRoom.getStreamByStreamId()
method provides the stream information for the given Stream ID.
Class: EnxRoom
Method: public EnxStream getStreamByStreamId( String StreamId )
Sample Code
EnxStream stream = room.getStreamByStreamId( StreamID );
Get a List of Remote Streams
The EnxRoom.getRemoteStreams()
method provides the list of remote streams available in a room.
Class: EnxRoom
Method: public Map <String, EnxStream> getRemoteStreams()
Sample Code
Map <String, EnxStream> remoteStreams = room.getRemoteStreams();
Get Publish Status of a Local Stream
The EnxRoom.isPublishing()
method is used to check if the local stream is currently being published into a room.
Class: EnxRoom
Method: public boolean isPublishing()
Sample Code
if (room.isPublishing()) {// Local Stream is being published.}else {// Local Stream is not being published.}