Skip to main content
testCallQuality() Prebuilt Custom
Prebuilt runs this test automatically as part of its prejoin UI.
Assesses a user’s network performance before joining a Daily call. The method connects to a Daily room and streams video to Daily’s infrastructure for up to 30 seconds, collecting outbound WebRTC stats. Results represent the average values over the test period. Must be called after preAuth() or startCamera() and before join(). If Adaptive Bitrate is enabled (default for 1:1 calls), results are stored on the call instance and used at join time to initialize the highest simulcast layer appropriately.

Return value

Returns Promise<DailyCallQualityTestResults>.
result
'good' | 'warning' | 'bad' | 'aborted' | 'failed'
Overall connection quality verdict:
  • 'good'avgSendPacketLoss < 5%, maxRoundTripTime < 300ms, avgSendBitsPerSecond ≥ 1,100,000
  • 'warning'avgSendPacketLoss 5–10%, maxRoundTripTime 300–600ms, avgSendBitsPerSecond 700,000–1,100,000
  • 'bad'avgSendPacketLoss ≥ 10%, maxRoundTripTime ≥ 600ms, avgSendBitsPerSecond < 700,000
  • 'failed' — test meeting ended in error; error details are included in the result
  • 'aborted' — test stopped before data gathering started (e.g. join() or stopTestCallQuality() called too quickly)
secondsElapsed
number
Seconds over which data was collected (up to 30). Timer starts after the test has joined a call and begun sending data.
data
object
Underlying stats used to determine the result. All averages use an exponential moving average biased toward the most recent data.
  • maxRoundTripTime (seconds) — maximum currentRoundTripTime sampled
  • avgRoundTripTime (seconds) — average currentRoundTripTime
  • avgSendPacketLoss (percentage) — average outbound packet loss. Depending on the browser, this is based off either fractionLost or packetsLost/ packetsSent.
  • avgAvailableOutgoingBitrate (bps) — average availableOutgoingBitrate (not available on Firefox)
  • avgSendBitsPerSecond (bps) — average outbound bitrate (delta bytesSent / delta time)
id
string
Session ID of the test call. Test calls use a private domain and do not appear in your account dashboard.
errorMsg
string
Human-readable error message. Only present when result === 'failed'.
error
DailyFatalErrorObject
Structured error object with type, msg, and details. Only present when result === 'failed' and error details are available.

Example

call.testCallQuality().then((results) => {
  switch (results.result) {
    case 'aborted':
      return console.log('Test aborted before any data was gathered.');
    case 'failed':
      return console.warn('Test ended in error.');
    case 'bad':
      return console.warn('Internet connection is bad. Try a different network.');
    case 'warning':
      return console.warn('Video and audio might be choppy.');
    case 'good':
    default:
      return console.log('Internet connection is good.');
  }
});
If the test returns 'bad' and adaptive bitrate is disabled or the client is on Firefox, consider calling updateSendSettings() with 'bandwidth-optimized' before joining.

Example failure result

{
  "result": "failed",
  "secondsElapsed": 29,
  "errorMsg": "signaling connection failed",
  "error": {
    "type": "connection-error",
    "msg": "signaling connection failed",
    "details": {
      "uri": "wss://ip-10-82-1-65-us-west-2.wss.daily.co:443",
      "sourceError": {
        "message": "WebSocket connection error",
        "name": "WEBSOCKET_ERROR",
        "code": 1006,
        "reason": ""
      }
    }
  },
  "id": "1e30b5fe-b566-46e3-a48d-b8ab762a6673"
}

See also