Pre-call tests

Updated

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 game.

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:

    Pre-call echo test

  • 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.

    Pre-call last mile test

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 game 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

  1. Create the UMG

    Create a button control named Btn_StartEchoTest that you click to start the voice call loop test.

  2. Bind UI events

    Create a Bind Event to On Clicked node that connects the Btn_StartEchoTest control and the OnStartEchoTestClicked callback. When you press the button to start the voice call test, the OnStartEchoTestClicked callback is triggered. This is shown in the following figure:

  3. Implement the UI event

    Create the OnStartEchoTestClicked callback 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 the Config parameter 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
  1. Create UMG

    Create a button control named Btn_StopEchoTest. You click the button to stop the echo test. As shown in the following figure:

  2. Bind UI events

    Create a Bind Event to On Clicked node that connects the Btn_StopEchoTest control and the OnStopEchoTestClicked callback. The OnStopEchoTestClicked callback is triggered when you press the button to stop the voice call test. This is shown in the following figure:

  3. Implement the UI event

    Create OnStoptEchoTestClicked callback 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.

  1. Call StartRecordingDeviceTest and set the indicationInterval parameter to the time interval after which the callback is triggered.

  2. After starting the test, speak into the microphone. The SDK reports uid = 0, and the volume information of the device in the FOnAudioVolumeIndication callback.

  3. When you are done testing, call StopRecordingDeviceTest to stop the test.

    Best practice is to set the indicationInterval parameter to more than 200 milliseconds and not less than 10 milliseconds, otherwise the FOnAudioVolumeIndication callback may not be received.

Audio playback device test

To test that the local audio playback device is working properly, refer to the following steps:

  1. Call StartPlaybackDeviceTest and set the testAudioFilePath parameter to the absolute path of the audio file to be played.

  2. If the user hears the audio, the playback device is working properly. The SDK triggers the FOnAudioVolumeIndication callback to report uid = 1 and the volume information of the playback device.

  3. When you are done testing, call StopPlaybackDeviceTest to stop the test.

Audio device loopback test

To test if the local audio device loop is working properly, refer to the following steps:

  1. Call StartAudioDeviceLoopbackTest and set the indicationInterval parameter to the time interval after which the callback is triggered.

  2. 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 FOnAudioVolumeIndication callbacks to report the volume information of the audio capture device with uid= 0, and the audio playback device with uid= 1, respectively.

  3. When you are done testing, call StopAudioDeviceLoopbackTest to stop the recording device test.

    Best practice is to set the indicationInterval parameter to more than 200 milliseconds and not less than 10 milliseconds, otherwise the onAudioVolumeIndication callback 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:

  1. Before joining a channel or switching user roles, call StartLastmileProbeTest to start the network test. Set the probe configuration and the expected maximum bitrate in LastmileProbeConfig.

  2. After you start the test, the SDK triggers the following callbacks:

    • FOnLastmileQuality: This callback is triggered two seconds after StartLastmileProbeTest is called. It provides feedback on the upstream and downstream network quality through a subjective quality score.

    • FOnLastmileProbeResult: This callback is triggered 30 seconds after StartLastmileProbeTest is called. It returns objective real-time network statistics, including packetLossRate, network jitter, and availableBandwidth.

  3. Call StopLastmileProbeTest to 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:

ProblemSolution
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.
  • Check that the network connection is normal.
Cannot see the screen when testing video devices.
  • Check that the video device is working properly and not occupied by other programs.
  • Check whether the network connection is normal.
Poor uplink network quality detected (packet loss > 5%; network jitter > 100ms)
  • Check that the local network is working properly.
  • Ensure that the bitrate of the published audio and video streams does not exceed the available uplink bandwidth by reducing the resolution or lowering the frame rate.
Poor downlink network quality detected (packet loss > 5%; network jitter > 100ms)
  • Check that the local network is working properly.
  • Ensure that the total bandwidth of the local subscription does not exceed the available downstream bandwidth by:
    • Reducing the number of subscribed audio and video streams on the receiving end or reducing the bitrate of published audio and video streams on the sending end.
    • Enabling dual-stream mode on the sending side and requesting to receive small streams on the receiving side to reduce bandwidth consumption.
    • Enabling the video stream fallback function or the multiple streams by priority fallback function at the receiving end.

Sample project

Agora provides an open-source JoinChannelAudio sample project for your reference. Download and explore the project for a more detailed example.

API reference