Pre-call tests
Updated
Run microphone, speaker, camera, and last-mile network checks before users join a Video Calling session.
In video calling implementations that demand high communication quality, pre-call detection helps identify and troubleshoot issues beforehand, ensuring seamless real-time interaction.
This page shows you how to use Video SDK to run pre-call tests to identify and troubleshoot communication quality issues in your app.
Understand the tech
Pre-call testing typically covers two aspects:
-
Equipment quality test
To test whether the local microphone, speaker, and camera are working properly, you run an echo test. The basic process of conducting an echo test is as follows:
-
Network quality analysis
The quality of the last mile network affects the smoothness and clarity of the audio and video that the user sends and receives. Last mile refers to the last leg of communication network between the edge server of the Agora SDRTN® and the end-user devices. Network quality analysis enables you to get feedback on the available bandwidth, packet loss rate, network jitter, and round-trip delay of the upstream and downstream last-mile networks. The following figure shows the basic process of running a last-mile probe test.
information
Best practice is to run the device test first and then perform a network test.
Prerequisites
Ensure that you have implemented the SDK quickstart project and that your app has obtained permissions to use the relevant devices.
Implement pre-call testing
This section shows you how to implement pre-call testing in your project.
Equipment quality test
The SDK provides the startEchoTest method to test the network connection and whether the audio and video devices are working properly. Refer to the following steps to implement the device quality test:
Start the echo test
-
Create the UMG
Create a button control named Btn_StartEchoTest that you click to start the voice call loop test.
-
Bind UI events
Create a Bind Event to On Clicked node that connects the Btn_StartEchoTest control and the
OnStartEchoTestClickedcallback. When you press the button to start the voice call test, theOnStartEchoTestClickedcallback is triggered. This is shown in the following figure: -
Implement the UI event
Create the
OnStartEchoTestClickedcallback function. When this callback is triggered, the Start Echo Test method is called to start the test. When the echo test starts, the user speaks into the microphone. If the recording is played back after the set time interval, it means that the audio device and network connection are working normally. In this example, configure theConfigparameter of Start Echo Test as follows:- Enable Audio is checked by default, which means audio device detection is enabled.
- Uncheck Enable Video to disable video device testing.
- Input Token and Channel Id (channel name).
- Interval In Seconds is set to 2 by default. This is the time interval between when you start the call and when the recording plays back.
Stop voice call detection
-
Create UMG
Create a button control named Btn_StopEchoTest. You click the button to stop the echo test. As shown in the following figure:
-
Bind UI events
Create a Bind Event to On Clicked node that connects the Btn_StopEchoTest control and the
OnStopEchoTestClickedcallback. TheOnStopEchoTestClickedcallback is triggered when you press the button to stop the voice call test. This is shown in the following figure: -
Implement the UI event
Create
OnStoptEchoTestClickedcallback function. After getting the test result, you press the stop button to trigger this callback and call the Stop Echo Test method to stop the test.
Audio recording device detection
To test whether a local audio recording device, such as a microphone, is working properly, refer to the following steps.
-
Call
StartRecordingDeviceTestand set theindicationIntervalparameter to the time interval after which the callback is triggered. -
After starting the test, speak into the microphone. The SDK reports
uid = 0, and the volume information of the device in theFOnAudioVolumeIndicationcallback. -
When you are done testing, call
StopRecordingDeviceTestto stop the test.Information
Best practice is to set the
indicationIntervalparameter to more than200milliseconds and not less than10milliseconds, otherwise theFOnAudioVolumeIndicationcallback may not be received.
Audio playback device test
To test that the local audio playback device is working properly, refer to the following steps:
-
Call
StartPlaybackDeviceTestand set thetestAudioFilePathparameter to the absolute path of the audio file to be played. -
If the user hears the audio, the playback device is working properly. The SDK triggers the
FOnAudioVolumeIndicationcallback to reportuid = 1and the volume information of the playback device. -
When you are done testing, call
StopPlaybackDeviceTestto stop the test.
Audio device loopback test
To test if the local audio device loop is working properly, refer to the following steps:
-
Call
StartAudioDeviceLoopbackTestand set theindicationIntervalparameter to the time interval after which the callback is triggered. -
After starting the test, speak into the microphone. The microphone captures the sound and then plays it on the playback device. The SDK returns two
FOnAudioVolumeIndicationcallbacks to report the volume information of the audio capture device withuid= 0, and the audio playback device withuid= 1, respectively. -
When you are done testing, call
StopAudioDeviceLoopbackTestto stop the recording device test.Information
Best practice is to set the
indicationIntervalparameter to more than200milliseconds and not less than10milliseconds, otherwise theonAudioVolumeIndicationcallback may not be received.
Network quality analysis
The SDK provides the StartLastmileProbeTest method to probe the last-mile network quality before joining a channel. The method returns information about the network quality score and network statistics. Take the following steps to run a last-mile network quality probe test:
-
Before joining a channel or switching user roles, call
StartLastmileProbeTestto start the network test. Set the probe configuration and the expected maximum bitrate inLastmileProbeConfig. -
After you start the test, the SDK triggers the following callbacks:
-
FOnLastmileQuality: This callback is triggered two seconds afterStartLastmileProbeTestis called. It provides feedback on the upstream and downstream network quality through a subjectivequalityscore. -
FOnLastmileProbeResult: This callback is triggered 30 seconds afterStartLastmileProbeTestis called. It returns objective real-time network statistics, includingpacketLossRate, networkjitter, andavailableBandwidth.
-
-
Call
StopLastmileProbeTestto stop last-mile network testing.
Reference
This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.
Troubleshooting device and network issues
If you encounter problems while running pre-call tests, first ensure that you have implemented the API calls properly. To troubleshoot device and network issues, refer to the following table:
| Problem | Solution |
|---|---|
| Can't hear sound when testing audio devices. | - Check that the recording device and the playback device are working properly, and are not occupied by other programs. |
| Cannot see the screen when testing video devices. | - Check that the video device is working properly and not occupied by other programs. |
| Poor uplink network quality detected (packet loss > 5%; network jitter > 100ms) | - Check that the local network is working properly. |
| Poor downlink network quality detected (packet loss > 5%; network jitter > 100ms) |
|
This feature guide is not available yet for JavaScript.
Sample project
Agora provides an open-source JoinChannelAudio sample project for your reference. Download and explore the project for a more detailed example.
