Get Room Information

The Cordova SDK provides the following methods:

Get a Room ID

Every room is assigned a unique room ID while creating the room. The window.EnxRtc.getRoomId() method is used to get the room ID of the room to which the user is connected.

  • Method: getRoomId(successCallback, errorCallback)
  • Parameters:
    • successCallback: Callable Function. Success Notification.
    • errorCallback: Callable Function. Error Notification.

Sample Code

window.EnxRtc.getRoomId(function(data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function(err) {
console.log('Uh oh… error' + JSON.stringify(err));
}
);

Get a Room Meta Information

Room Meta contains complete room definition and many runtime parameters with their current values and room stats of connected users and streams. All endpoints receive this notification after connecting to the room with the onRoomConnected event listener. Some of the runtime parameters are updated internally by the toolkit on various events.

The window.EnxRtc.getRoomMetaData() method is used to get the room meta information to which the user is connected.

  • Method: getRoomMetaData( successCallback, errorCallback )
  • Parameters:
    • successCallback: Callable Function. Success Notification.
    • errorCallback: Callable Function. Error Notification.

Sample Code

window.EnxRtc.getRoomMetadata(function(data) {
console.log('Excelsior succuss! ' + JSON.stringify(data.data));
}, function(err) {
console.log('Uh oh… error' + JSON.stringify(err));
}
);

Know if the Room is Connected

The window.EnxRtc.isConnected() method is used to know the room's status whether it is connected or not.

  • Method: isConnected( successCallback, errorCallback )
  • Parameters:
    • successCallback: Callable Function. Success Notification.
    • errorCallback: Callable Function. Error Notification.

Sample Code

window.EnxRtc.isConnected(function(data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function(err) {
console.log('Uh oh… error' + JSON.stringify(err));
}
);

Get a Room Mode

A Room is defined with a Mode, i.e. Group or Lecture. Even at run-time, Room Mode may be changed. The window.EnxRtc.getMode() method is used to obtain the defined/run-time mode of the connected Room.

  • Method: getMode( successCallback, errorCallback )
  • Parameters:
    • successCallback: Callable Function. Success Notification.
    • errorCallback: Callable Function. Error Notification.

Sample Code

window.EnxRtc.getMode(function(data) {
console.log('Excelsior succuss! ' + JSON.stringify(data.data));
}, function(err) {
console.log('Uh oh… error' + JSON.stringify(err));
}
);

Get Connected User ID or Client ID

Each user connected to the room is assigned with a unique client ID for the session. The window.EnxRtc.getClientId() method is sued to get the client ID of the user connected from the endpoint.

  • Method: getClientId( successCallback, errorCallback )
  • Parameters:
    • successCallback: Callable Function. Success Notification.
    • errorCallback: Callable Function. Error Notification.

Sample Code

window.EnxRtc.getClientId (function(data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function(err) {
console.log('Uh oh… error' + JSON.stringify(err));
}
);

Get Connected User Name

The window.EnxRtc.getClientName() method is sued to get the name of the connected user from the endpoint.

  • Method: getClientName( successCallback, errorCallback )
  • Parameters:
    • successCallback: Callable Function. Success Notification.
    • errorCallback: Callable Function. Error Notification.

Sample Code

window.EnxRtc.getClientName(function(data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function(err) {
console.log('Uh oh… error' + JSON.stringify(err));
}
);

Get Connected User Role

A user gets connected to a Room with a Role, i.e. moderator, participant, viewer, audience. The window.EnxRtc.getRole() method is sued to get the role of connected user from the endpoint.

  • Method: getRole( successCallback, errorCallback )
  • Parameters:
    • successCallback: Callable Function. Success Notification.
    • errorCallback: Callable Function. Error Notification.
  • Returns: Enumerated Values: moderator, participant, viewer, audience.

Sample Code

window.EnxRtc.getRole(function(data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function(err) {
console.log('Uh oh… error' + JSON.stringify(err));
}
);

Get Connected User Information

The window.EnxRtc.whoami() method is used to get connected user information at an endpoint. It returns the complete user meta information for the connected user in a JSON Object.

  • Method: whoami( successCallback, errorCallback )
  • Parameters:
    • successCallback: Callable Function. Success Notification.
    • errorCallback: Callable Function. Error Notification.

Sample Code

window.EnxRtc.whoAmI(function(data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function(err) {
console.log('Uh oh… error' + JSON.stringify(err));
}
);

Note: Refer JSON Object structure for User Meta

Get Connected User List

The window.EnxRtc.getUserList() method is used to get a list of connected users to the room. It returns a JSON with a list of connected users information.

  • Method: getUserList( successCallback, errorCallback )
  • Parameters:
    • successCallback: Callable Function. Success Notification.
    • errorCallback: Callable Function. Error Notification.

Sample Code

window.EnxRtc.getUserList(function(data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function(err) {
console.log('Uh oh… error' + JSON.stringify(err));
}
);

Get Local Stream ID

A stream is identified by its Stream ID, Streams can be local, remote, canvas, or screen share. The window.EnxRtc.getLocalStreamID() method is used to get the ID of the local stream.

  • Method: getLocalStreamID( successCallback, errorCallback )
  • Parameters:
    • successCallback: Callable Function. Success Notification.
    • errorCallback: Callable Function. Error Notification.

Sample Code

window.EnxRtc.getLocalStreamID(function(data) {
console.log('Excelsior success! ' + JSON.stringify(data.data));
}, function(err) {
console.log('Uh oh… error' + JSON.stringify(err));
}
);

Advance Stream Options

Set Advanced Options

The window.EnxRtc.setAdvancedOptions() method is used to set the advanced options.

  • Method: setAdvancedOptions( advanceOptions )
  • Parameter:
    • advanceOptions Array. To set a list of advanced options. Each options are given as string constants. e.g. ["battery_updates", "notify-video-resolution-change"]
  • Event Listeners:
    • onAdvancedOptionsUpdate: Received when any advance options such as video quality or battery settings updated.

Sample Code

window.EnxRtc.setAdvancedOptions(Array);
// Add Event Listeners
window.EnxRtc.addEventListner("onAdvancedOptionsUpdate", function(data){
console.log(JSON.stringify(data.data));
});

Get Advanced Options

The window.EnxRtc.getAdvancedOptions() method is used to get the advanced options currently in effect.

  • Method: getAdvancedOptions()
  • Event Listener:
    • onGetAdvancedOptions: Received when getAdvancedOptions() is called.

Sample Code

window.EnxRtc.getAdvancedOptions();
// Add Event Listeners
window.EnxRtc.addEventListner("onGetAdvancedOptions", function(data) {
console.log(JSON.stringify(data.data));
});