testPeerToPeerCallQuality()
testPeerToPeerCallQuality({ videoTrack: MediaStreamTrack, duration?: number }): Promise;
The testPeerToPeerCallQuality()
method assesses the quality of a WebRTC connection using a given video track. Connecting to Daily's TURN servers, it captures a number of metrics that are used to indicate the quality of a user's connection. The longer the test runs, the more accurate the results will be. By default, the test runs for 15 seconds. You can customize how long it runs, 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 call quality test results:
result
: A string indicating the call quality. Can be"good"
,"bad"
,"warning"
,"aborted"
or"failed"
.data
: An object containing the data gathered during the trip. This data is used to determine theresult
.secondsElapsed
: A number indicating how long the test has run for.
Also see:
stopTestPeerToPeerCallQuality()
: This method can be used to interrupt the test.test-completed
: This event is emitted when the test completes or is stopped.
Test results in detail
An example test result looks like this:
maxRoundTripTime
(ms) is calculated based oncurrentRoundTripTime
from thecandidate-pair
report.avgRoundTripTime
(ms) is calculated based oncurrentRoundTripTime
from thecandidate-pair
report.avgRecvPacketLoss
(%) is calculated based onpacketsLost
andpacketsReceived
from theinbound-rtp
video report.avgAvailableOutgoingBitrate
(bps) is calculated based onavailableOutgoingBitrate
from thecandidate-pair
report. This value is not available on Firefox.avgSendBitsPerSecond
(bps) is calculated based onbytesSent
from thecandidate-pair
report.avgRecvBitsPerSecond
(bps) is calculated based onbytesReceived
from thecandidate-pair
report.
Meaning of result
:
The result
is returned when any one of these conditions is met:
"good"
:avgRecvPacketLoss
< 5%avgRoundTripTime
< 300msavgRecvBitsPerSecond
>= 1,100kbps
"warning"
:avgRecvPacketLoss
>= 5% and < 10%avgRoundTripTime
>= 300ms and < 600msavgRecvBitsPerSecond
< 1,100kbps and >= 700kbps
"bad"
:avgRecvPacketLoss
>= 10%avgRoundTripTime
>= 600msavgRecvBitsPerSecond
< 700kbps
"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. SeestopTestPeerToPeerCallQuality()
.
Example usage of testPeerToPeerCallQuality()
:
Related methods and events
test-completed
stopTestPeerToPeerCallQuality()
testNetworkConnectivity
testWebsocketConnectivity
abortTestNetworkConnectivity
abortTestWebsocketConnectivity