Live Statistics
The Android SDK provides the following methods for obtaining live statistics of local, remote, canvas streaming, and screen sharing during a session:
- enableStats(): To subscribe to live media statistics of local, remote, canvas streaming, and screen sharing.
- enablePlayerStats(): To receive statistics of streams individually.
- subscribeForTalkerNotification(): To receive notification about the talkers in a room.
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
Callback | Description |
---|---|
onAcknowledgeStats | Acknowledgment to the user when stream statistics are enabled or disabled. |
onReceivedStats | Notification to the user when all streams statistics are received. |
Sample Code
room.enableStats(true, this);@Overridepublic void onAcknowledgeStats(JSONObject jsonObject) {}@Overridepublic 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);@Overridepublic void onPlayerStats(JSONObject jsonObject) {}
Error Codes and Exceptions
Code | Description |
---|---|
5075 | Repeated stream stats subscription request as a previous request is in process. |
5076 | Repeated stream stats unsubscription request as a previous request is in process. |
5077 | Repeated stream stats request while stream stats is already subscribed. |
5078 | Unsubscribing stream stats is not permitted without subscribing to it. |
5079 | Unable to unsubscribe to stream stats while subscription request is in process. |
5080 | Stream 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
Callback | Description |
---|---|
onAckSubscribeTalkerNotification | Acknowledgment to the subscriber when the talker notification is successfully subscribed. |
onAckUnsubscribeTalkerNotification | Acknowledgment to the subscriber when the talker notification is successfully unsubscribed. |
onTalkerNotification |
|
Sample Code
room.subscribeForTalkerNotification(true, this); // To subscriberoom.subscribeForTalkerNotification(false, this); // To unsubscribe// Acknowledgement on Talker Subscriptionpublic void onAckSubscribeTalkerNotification(JSONObject jsonObject) {// JSON Object example/*{ "result": {"result": 0,"msg": "Success"},"id": "talker-notification"}*/}// Acknowledgement on Talker Unsubscriptionpublic void onAckUnsubscribeTalkerNotification(JSONObject jsonObject) {// JSON Object example/*{ "result": {"result": 0,"msg": "Success"},"id": "talker-notification"}*/}// Receive Talker Notification on Subscriptionpublic 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
Code | Description |
---|---|
5128 | Repeated subscription request is called while a previous request is in process. |
5129 | Repeated unsubscription request is called while a previous request is in process. |
5130 | Talker notification is already subscribed. |
5131 | Illegible attempt to unsubscribe talker notification without subscribing first. |