getNetworkStats()
getNetworkStats()
Returns the latest stats representing the current network, calculated from the WebRTC stats. These statistics are updated approximately once every two seconds. You can poll the getNetworkStats()
method to continually read the current network performance.
Return type
Returns a Promise that resolves to an object with a set of the latest
calculated stats, some overall call stats, and some high level assessments of the current overall network health.
latest
: a collection of statistics from the most recent reporting interval, which occurs approximately once every two seconds:timestamp
: a unix timestamp (seconds since the epoch), set to when thelatest
was calculatedrecvBitsPerSecond
: total data received in the reporting interval from video and/or audio in bits per secondsendBitsPerSecond
: total data sent in the reporting interval from video and/or audio in bits per secondaudioRecvBitsPerSecond
: total playload data from audio received in the reporting interval in bits per secondaudioRecvPacketLoss
: estimated percentage of packets lost from incoming audio over the reporting intervalaudioSendBitsPerSecond
: total playload data from audio sent in the reporting interval in bits per secondaudioSendPacketLoss
: estimated percentage of packets lost from the audio being sent over the reporting intervalvideoRecvBitsPerSecond
: total playload data from video received in the reporting interval in bits per secondvideoRecvPacketLoss
: estimated percentage of packets lost from incoming video over the reporting intervalvideoSendBitsPerSecond
: total playload data from video sent in the reporting interval in bits per secondvideoSendPacketLoss
: estimated percentage of packets lost from the video being sent over the reporting intervaltotalSendPacketLoss
: estimated overall percentage of packets lost from the audio and video being sent over the reporting intervaltotalRecvPacketLoss
: estimated overall percentage of packets lost from the received audio and video over the reporting interval
worstAudioRecvPacketLoss
: highestaudioRecvPacketLoss
number seen over a reporting interval during the callworstAudioSendPacketLoss
: highestaudioSendPacketLoss
number seen over a reporting interval during the callworstVideoRecvPacketLoss
: highestvideoRecvPacketLoss
number seen over a reporting interval during the callworstVideoSendPacketLoss
: highestvideoSendPacketLoss
number seen over a reporting interval during the callthreshold
:'good'
|'low'
|'very-low'
, an assessment of the current network quality. The threshold value is calculated from network stats averaged over an approximately 30-second rolling window. In prebuilt, we lower the bandwidth used for the call when the network quality drops tolow
, and we turn off the local camera when the network quality drops tovery-low
.quality
: a subjective calculation of the current network quality on a scale of 1-100, suitable for display in a user interface.
Starting in 0.49.0: If, for a given two second period, a value can not be determined, it will be set to null
. This most commonly occurs for packetLoss
calculations due to the values it relies upon being missing or stale, or media not being transmitted. For instance, if you join a call with audio and video off, your bitrates will be 0 and packetLoss
will be null
because it is unknown.
Also new starting in 0.49.0 is the inclusion of audio send/recv bitrates and packet loss.
Firefox users:
The Firefox browser does not provide adequate information to calculate send-side packet loss for audio and therefore audioSendPacketLoss
will always be null
.
Sample response
getNetworkStats() in action
We display network stats outside of the Daily callframe in our Daily Prebuilt demo:
- Test the live demo
- See sample code in our demo repository