Live Statistics

The Web 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.subscribeMediaStats() method allows you to subscribe to live media statistics of local, remote, canvas streaming, and screen sharing for debugging purposes or for UI display at an endpoint. For each stream, the following information is displayed using an overlay over the respective player:

  • For Local Streams

    • Transmission Bandwidth
    • Video Resolution
  • For Subscribed Streams

    • Receiving Bandwidth
    • Video Resolution
    • Available Bandwidth for Remote Users
    • Packet Loss
  • Method: EnxRoom.subscribeMediaStats(reqType, Callback)

  • Parameters:

    • reqType : Type of request on media statistics to configure how the media stats are delivered and stopped. Configurable enumerated values are: display, notify, notify-display, disable.
      • display : Media Statistics are shown as overlay on each video player.
      • notify : Media Statistics are dispatched in JSON format along with an event media-stats to be handled in the code.
      • notify-display : Media Statistics are shown as overlay on each Video Player as well as data is dispatched in JSON format along with an event media-stats.
      • disable : This disables Media Statistics subscription. Subsequently overlays are removed from Video Player and media-stats event dispatch is stopped.
    • Callback : Callback Function. TO receive status of the request.

Sample Code

room.subscribeMediaStats('notify', function(resp) {
// response is a JSON, for example,
/*
{  "result": 0, 
"msg": "Success" 
}
*/
});
room.addEventListener("media-stats", function(evt) {
// evn JSON: Carries Media Stats. Explained Later
/*
{ type: 'media-stats',
talkers: [{ }],
publisher: {},
share: {},
canvas: {}
}
*/
});

JSON Response: Media Statistics

  • talkers : An array of objects containing media statistics of each user's stream available on the Active Talker List. For Each talker's endpoint, it shows both subscription and publishing connection's statistics.
  • publisher : Object containing media statistics of the published stream connection.
  • share : Object containing media statistics of the screen sharing connection.
  • canvas : Object containing media statistics of the canvas streaming connection.

Sample Code

{
"type": "media-stats",
"talkers": [
null,
null,
{
"id": 2,
"subscriber": {
"video": [
{
"displayString": "<div> <strong style=\"color:black;\" > 640X480p10@188Kbps</strong>:</div><div> <strong style=\"color:black;\" > AvailBw:500Kbps, loss:1</strong>:</div>",
"resHeight": 480,
"resWidth": 640,
"packetsLost": 1,
"bandwidth": 500,
"frameRate": 10,
"bitrate": 188
}
],
"total-bitrate-kbps": 238
},
"publisher": {
"video": [
{
"displayString": "<div> <strong style=\"color:black;\" > 640X480p10@186Kbps</strong>:</div>",
"resHeight": 480,
"resWidth": 640,
"packetsLost": 0,
"bandwidth": 0,
"frameRate": 10,
"bitrate": 186
}
],
"total-bitrate-kbps": 227
}
}
],
"publisher": {
"total-bitrate-kbps": 354,
"video": [
{
"displayString": "<div> <strong style=\"color:black;\" > 640X480p9@312Kbps</strong>:</div>",
"resHeight": 480,
"resWidth": 640,
"packetsLost": 0,
"bandwidth": 0,
"frameRate": 9,
"bitrate": 312
}
]
},
"share": {},
"canvas": {}
}

Talker and Noise Notification

This functionality is available from Web SDK version 1.9.4 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 active-talkers-updated event is limited to the max_active_talkers setting of the room.

The subscribed client endpoint keeps receiving notifications with an event until unsubscribed.

  • Method: EnxRoom.subscribeForTalkerNotification(enabled, callback)
  • Parameters:
    • enabled : Boolean. A true value means to subscribe to Talker Notification
      A false value means to unsubscribe.
    • callback : Callback Function. To get status of the request.
  • Event Listeners:
    • talker-notification: Notification to the subscriber with the JSON object with the details of users from whom speech or sound is detected.

Sample Code

room.subscribeForTalkerNotification(true, function(resp) {
// resp JSON
/*
{  "result": 0, 
"msg": "Success" 
}
*/
});
// Notification: To subscriber.
room.addEventListener("talker-notification", function(evt) {
// evt. JSON. Explained later
});

Sample JSON Response: Event talker-notification

{
"type": "talker-notification",
"message": [
{
"speech": true,
"users": [
{
"clientId": "xxxxx"
},
{
"clientId": "yyyyy"
}
]
},
{
"noise": true,
"users": [
{
"clientId": "sssss"
},
{
"clientId": "uuuuu"
}
]
}
]
}

JSON Response Explaination: Event talker-notification

  • message : Array. An array of two types of objects. The object type is distinguished as speech and noise depending on the sound produced at the talker's endpoint.
    • speech : Array. An array of clientIds of particicpants who are are talking.
    • noise : Array. An array of clientIds of particicpants producing noise.