getNetworkStats()

getNetworkStats()

Compatibility:
Prebuilt
Custom

Returns a Promise that resolves with an object of network stats:

The latest field is a collection of statistics from the most recent time period. These statistics are updated approximately once every two seconds. You can poll the getNetworkStats() method to continually read the current network performance.

worstVideoRecvPacketLoss and worstVideoSendPacketLoss are what the names suggest: the worst packet loss number seen for a two-second period, during the current call.

To those building audio-only apps:

As noted by their property names, any key that includes video only applies to video. recvBitsPerSecond, sendBitsPerSecond, totalSendPacketLoss, and totalRecvPacketLoss, however, do cover both audio and video.

threshold is an assessment of the current network quality, and can have the value good, low, or very-low. The threshold value is calculated from network stats averaged over an approximately 30-second rolling window. By default, we lower the bandwidth used for the call, when the network quality drops to low, and we turn off the local camera when the network quality drops to very-low.

quality is a subjective calculation of the current network quality on a scale of 1-100, suitable for display in a user interface.

getNetworkStats() in action

We display network stats outside of the Daily callframe in our Daily Prebuilt demo: