Live Statistics

The Android SDK provides the following methods for obtaining live statistics of local, remote, canvas streaming, and screen sharing during a session:

Live Media Statistics

The EnxRoom.enableStats() method allows you to receive statistics for all the streams received in a room. The statistics help you analyze the streaming quality of all the streams by providing information about the streams, such as:

  • Publishing resolution
  • Bandwidth at publisher's end
  • Receiving resolution
  • Receiving bandwidth consumed
  • Available bandwidth at the receiver's end

Class: EnxRoom

Method: public void enableStats(isEnabled, EnxStatsObserver)

Parameters Data Type Description
isEnabled Boolean Set it to true to enable statistics. Otherwise, set it to false.
EnxStatsObserver Boolean The EnxStatsObserver instance.

Callbacks

CallbackDescription
onAcknowledgeStatsAcknowledgment to the user when stream statistics are enabled or disabled.
onReceivedStatsNotification to the user when all streams statistics are received.

Sample Code

room.enableStats(true, this);
@Override
public void onAcknowledgeStats(JSONObject jsonObject) {
}
@Override
public void onReceivedStats(JSONObject jsonObject) {
Log.e("onReceivedStats", jsonObject.toString());
}

Receive Stream Statistics for Individual Streams

The EnxPlayerView.enablePlayerStats() method allows you to receive statistics of individual streams being played on the player. To receive individual stream statistics, you must enable the statistics at room level using the EnxRoom.enableStats() method.

Class: EnxPlayerView

Method: public void enablePlayerStats( isEnabled, EnxPlayerStatsObserver)

Parameters Data Type Description
isEnabled Boolean Set it to true to enable statistics.
Set it to false to disable statistics.
EnxPlayerStatsObserver Boolean The EnxPlayerStatsObserver instance.

Callback: onPlayerStats: Notification to the user when player's stream stats is received.

Sample Code

playerview.enablePlayerStats(true, this);
@Override
public void onPlayerStats(JSONObject jsonObject) {
}

Error Codes and Exceptions

CodeDescription
5075Repeated stream stats subscription request as a previous request is in process.
5076Repeated stream stats unsubscription request as a previous request is in process.
5077Repeated stream stats request while stream stats is already subscribed.
5078Unsubscribing stream stats is not permitted without subscribing to it.
5079Unable to unsubscribe to stream stats while subscription request is in process.
5080Stream stats unsubscription request is in process.

Talker and Noise Notification

This functionality is available from Andriod SDK 1.9.5 and later.

The subscribeForTalkerNotification() method allows you to receive notifications for the talkers in the room or the participants acting as a noise source. You can utilize this method for UI display or debugging. Note that the list of talkers received could be longer than the Active Talkers list because the Active Talkers list received with the onActiveTalkersUpdated event is limited to the max_active_talkers setting of the room.

Class: EnxRoom

Observer: public void setEnxTalkerNotificationObserver(Talker-Observer-Instance)

Method: public void subscribeForTalkerNotification(Boolean isEnabled, EnxTalkerNotificationObserver e)

Parameters Data Type Description
isEnabled Boolean A true value means to subscribe to Talker Notification.
A false value means to unsubscribe.
EnxTalkerNotificationObserver Boolean The EnxTalkerNotificationObserver instance

Callbacks

CallbackDescription
onAckSubscribeTalkerNotificationAcknowledgment to the subscriber when the talker notification is successfully subscribed.
onAckUnsubscribeTalkerNotificationAcknowledgment to the subscriber when the talker notification is successfully unsubscribed.
onTalkerNotification
  • speech: An array of clientIds of users who are talking along with their clientId and speechType (intensity) as low, media high
  • noise: An array of clientIds producing noise.

Sample Code

room.subscribeForTalkerNotification(true, this); // To subscribe
room.subscribeForTalkerNotification(false, this); // To unsubscribe
// Acknowledgement on Talker Subscription
public void onAckSubscribeTalkerNotification(JSONObject jsonObject) {
// JSON Object example
/*
{ "result": {
"result": 0,
"msg": "Success"
},
"id": "talker-notification"
}
*/
}
// Acknowledgement on Talker Unsubscription
public void onAckUnsubscribeTalkerNotification(JSONObject jsonObject) {
// JSON Object example
/*
{ "result": {
"result": 0,
"msg": "Success"
},
"id": "talker-notification"
}
*/
}
// Receive Talker Notification on Subscription
public void onTalkerNotification(JSONObject jsonObject) {
// JSON Object example given later in the document
}

onTalkerNotification JSON Payload:

{
"type": "talker-notification",
"data": [
{
"speech": true,
"users": [
{
"speechType": "high"
"clientId": "xxxxx"
},
{
"speechType": "medium"
"clientId": "yyyyy"
},
{
"speechType": "low"
"clientId": "zzz"
}
]
},
{
"noise": true,
"users": [
{
"clientId": "sssss"
},
{
"clientId": "uuuuu"
}
]
}
]
}

Error Codes and Exceptions

CodeDescription
5128Repeated subscription request is called while a previous request is in process.
5129Repeated unsubscription request is called while a previous request is in process.
5130Talker notification is already subscribed.
5131Illegible attempt to unsubscribe talker notification without subscribing first.