Quality events
Understanding Network and CPU utilization is crucial for optimizing video call settings and ensuring that participants remain connected and communicating through the call.
Though, modern web browsers don't provide access to CPU information for security reasons. Using call metrics, we have derived a CPU load event that can indicate when either video encoding or decoding are resulting in a high CPU load.
Additionally, detecting and responding to changes in network performance are equally important when it comes to call quality. We expose simple network events that help your application adapt to variable network conditions.
network-quality-change
Fires when the networkState, networkStateReasons, threshold, or quality values of the network has changed. This event includes the same payload as what is returned from the getNetworkStats() method. See getNetworkStats() for detailed type information.
As of daily-js 0.77.0, threshold and quality are deprecated in favor of the preferred API of networkState and networkStateReasons. 0.77.0 also introduces including the latest stats bundle as part of the event payload.
network-connection
There are (currently) three possible network connection types: signaling, peer-to-peer, and sfu.
Call setup and call management information flow through the signaling network connection.
Audio and video flow through the peer-to-peer and sfu network connections.
Generally, if a participant's signaling connection is interrupted, the participant is temporarily offline. If we aren't able to reconnect within approximately 20 seconds, the participant will be ejected from the call.
When peer-to-peer and sfu network connections are interrupted, remote audio and video tracks stop, for the participant. We will attempt to reconnect peer-to-peer and sfu connections (and restore audio and video) as long as there is a live signaling connection.
The event object specifies which type of connection was affected ('signaling', 'peer-to-peer', or 'sfu'), the kind of connection event ('connected' or 'interrupted'), and any other available information, like a participant's session_id or the sfu_id.
The most common cause of peer-to-peer and sfu connection interruptions is high packet loss on the participant's local wifi network.
Dive into network connection types
cpu-load-change
The cpu-load-change event applies to video calls only.
Fires when the cpuLoadState has changed.
cpuLoadStateis an assessment of the current CPU state, which can be eitherhighorlow.cpuLoadStateReasoncan have values of:nonewhen thecpuLoadStateislow.encodewhen thecpuLoadStateishighand video encoding is the primary cause for the high CPU load.decodewhen thecpuLoadStateishighand video decoding is the primary cause for the high CPU load.scheduleDurationwhen thecpuLoadStateishighand specific functions in the Daily code are not completing within a specified interval.
When a high CPU load occurs, this means that the video call running on your website or in your app might experience a lower resolution and/or framerate. To reduce the load on the CPU, we recommend:
- lowering the outgoing video by calling
updateSendSettings(). - requesting a lower simulcast layer by calling
updateReceiveSettings(). - decreasing the amount of video subscriptions in large calls. More details on this article.
Taking these actions will result in decreased video quality, but it will help call participants remain connected and will help them to communicate without lost or delayed audio.