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
startEchoTestWithInterval 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.
startEchoTestWithIntercalbefore joining a channel. You need to set the
intervalparameter 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
stopEchoTestto stop the current test before joining a channel using joinChannel.
// Swift // Start the echo test. agoraKit.startEchoTestWithInterval(10) // Wait and check if the user can hear the recorded audio. // Stop the echo test. agoraKit.stopEchoTest
// Objective-C // Start the echo test. [agoraKit startEchoTestWithInterval: 10]; // Wait and check if the user can hear the recorded audio. // Stop the echo test. [agoraKit stopEchoTest];
- Once the echo test ends, you must call
stopEchoTestto stop it. Otherwise, you cannot take another echo test, or enter a call using
- In a Live-broadcast channel, only a broadcaster can call