testConnectionQuality({ videoTrack: MediaStreamTrack, duration?: number }): Promise;


This method is deprecated. Please use testPeerToPeerCallQuality() instead.

The testConnectionQuality() method assesses the quality of a WebRTC connection using a given video track. Connecting to Daily's TURN servers, it captures the max round trip time and packet loss to determine the quality of a user's connection. The longer the test runs for, the more accurate the results will be. By default, the test runs for 15 seconds. You can customize how long it runs for, up to a maximum of 30 seconds. This method is particularly useful during precall checks when a room has not yet been joined. For in-depth network stats during a call, refer to getNetworkStats().

It returns a Promise that resolves to an object providing information about the connection quality test results:

  • result: A string indicating the connection quality. Can be "good", "bad", "warning", "aborted" or "failed".
  • data: An object containing the data gathered during the trip: max round trip time (maxRTT) and packet loss percentage (packetLoss). This data is used to determine the result.
  • secondsElapsed: A number indicating how long the test has run for.

Also see: stopTestConnectionQuality(). This method can be used to interrupt the test.

Note that this check is not indicative of whether a user is "allowed" to join a call based on their result. It's up to you as a developer to decide what to do when a user gets a "bad" or "warning" result.

Test results in detail

An example test result looks like this:

maxRTT (ms) is calculated based on an array of currentRoundTripTime values. Every second of the test, we gather a new currentRoundTripTime value, and at the end of the rest, return the highest value in this array.

packetLoss (percentage) is calculated based on RTCReceivedRtpStreamStatspacketsLost and packetsReceived.

Meaning of result:

The result is returned when any one of these conditions is met:

  • "good":
    • packetLoss < 5%
    • maxRTT < 300ms
  • "warning":
    • packetLoss >= 5% and < 10%
    • maxRTT >= 300ms and < 600ms
  • "bad":
    • packetLoss >= 10%
    • maxRTT >= 600ms
  • "failed": a connection to Daily's TURN servers could not be made. Our suggestion is to refer users to our network debugger for a more in-depth test.
  • "aborted": test aborted before data gathering could start. See stopTestConnectionQuality().

Example usage of testConnectionQuality():

Related methods