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 oncurrentRoundTripTimefrom thecandidate-pairreport.avgRoundTripTime(ms) is calculated based oncurrentRoundTripTimefrom thecandidate-pairreport.avgRecvPacketLoss(%) is calculated based onpacketsLostandpacketsReceivedfrom theinbound-rtpvideo report.avgAvailableOutgoingBitrate(bps) is calculated based onavailableOutgoingBitratefrom thecandidate-pairreport. This value is not available on Firefox.avgSendBitsPerSecond(bps) is calculated based onbytesSentfrom thecandidate-pairreport.avgRecvBitsPerSecond(bps) is calculated based onbytesReceivedfrom thecandidate-pairreport.
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-completedstopTestPeerToPeerCallQuality()testNetworkConnectivitytestWebsocketConnectivityabortTestNetworkConnectivityabortTestWebsocketConnectivity