To ensure smooth communications, we recommend conducting a media device test before joining a channel to check whether the microphone or camera works properly. This function applies to scenarios that have high-quality requirements, such as online education.
Before joining a channel, you can use the startEchoTest
method to test if the audio devices, such as the microphone and the speaker, are working properly. This article explains how to use this method in your project.
Before proceeding, ensure that you have implemented basic real-time functions in your project. See Start a Call or Start Live Interactive Streaming for details.
Call startEchoTest
before joining a channel. You need to set the intervalInSeconds
parameter in this method to notify the SDK when to report the result of this test. The value range is [2, 10], and the default value is 10 (in seconds).
When the echo test starts, let the user speak for a while. If the recording plays back within the set time interval, the audio devices and the network connection are working properly.
Once you get the test result, call stopEchoTest
to stop the current test before joining a channel using joinChannel.
// Start the echo test.
rtcEngine.startEchoTest(10);
// Wait and check if the user can hear the recorded audio.
// Stop the echo test.
rtcEngine.stopEchoTest();
stopEchoTest
to stop it. Otherwise, you cannot take another echo test, or enter a call using joinChannel
.startEchoTest
.