Rate this page:

How to use SDK's stats

Learn how to receive basic and advanced stats from our SDKs.

Basic

The SDKs provide developers with the dedicated events on call quality. You can subscribe to them in order to handle codec mismatch, latency, and so on:

  • Codec Mismatch (Web, Android, iOS) – the event is triggered when the local audio, video or shared stream is encoded by a codec different from the one specified in initialization config or call settings.

  • High Media Latency (Web, Android, iOS) – the event is triggered when network-based media latency is detected in the call.

  • ICE Disconnected (Web, Android, iOS) – the event is triggered when the ICE connection is switched to the "disconnected" state during the call.

  • Local Video Degradation (Web, Android, iOS) – the event is triggered when the video resolution sent to the endpoint is lower than a captured video resolution.

  • Packet Loss (Web, Android, iOS) – the event is triggered every 2.5 seconds and indicates packet loss for the last period.

  • Low Bandwidth (Android, iOS) – the event is triggered when the current bitrate is insufficient for sending video with the current resolution.

  • No Audio Signal (Android, iOS) – the event is triggered when no audio is captured by the microphone.

You can measure how critical an issue is by looking at its code name returned in the event, see the nearby article about it.

Advanced

We recommend the following approaches for gathering connection stats and/or developing custom tools for tracking issues.

The stats is received all the time while a call is active. There are two stats interfaces: CallStats (the general stats of a call) and EndpointStats (the stats of each participant of a call/conference).

Web SDK: CallStats === EndpointStats

If you dealing with a simple call with two participants, CallStats would be equal EndpointStats.

The stats can be retrieved in the CallStatsReceived event which object comprises a special field for an endpoint (endpointStats), whereas other fields are to contain details on general stats.

Retrieving stats

Retrieving stats

Advanced Nuances

By default, the stats comes every 10 (Web, iOS) or 5 seconds (Android); if you want to react quickly on changes, you can change this value. To do so, specify the rtcStatsCollectionInterval while initiating a Client instance:

Client initialization

Client initialization

RAM utilization

Stats is accumulated in RAM during the interval specified in rtcStatsCollectionInterval. Thus, the bigger the interval is, the higher RAM utilization will be.

Another point worth mentioning is the timestamp value in the received stats. Bear in mind that it should differ from the previous received value; if not, you're probably experiencing some troubles with gathering stats.