startHardwareEchoDetection method
@detail api
@author zhangcaining
@brief Start echo detection before joining a room.
@param testAudioFilePath Absolute path of the music file for the detection. It is expected to encode with UTF-8. The following files are supported: mp3, aac, m4a, 3gp, wav.
We recommend to assign a music file whose duration is between 10 to 20 seconds.
Do not pass a Silent file.
@return Method call result:
- 0: Success.
- -1: Failure due to the onging process of the previous detection. Call stopHardwareEchoDetection{@link #RTCEngine#stopHardwareEchoDetection} to stop it before calling this API again.
- -2: Failure due to an invalid file path or file format.
@note
- You can use this feature only when ChannelProfile{@link #ChannelProfile} is set to CHANNEL_PROFIEL_MEETING or CHANNEL_PROFILE_MEETING_ROOM.
- Before calling this API, ask the user for the permissions to access the local audio devices.
- Before calling this api, make sure the audio devices are activate and keep the capture volume and the playback volume within a reasonable range.
- The detection result is passed as the argument of onHardwareEchoDetectionResult.
- During the detection, the SDK is not able to response to the other testing APIs, such as startEchoTest{@link #RTCEngine#startEchoTest}, startAudioDeviceRecordTest{@link #IRTCAudioDeviceManager#startAudioDeviceRecordTest} or startAudioPlaybackDeviceTest{@link #IRTCAudioDeviceManager#startAudioPlaybackDeviceTest}.
- Call stopHardwareEchoDetection{@link #RTCEngine#stopHardwareEchoDetection} to stop the detection and release the audio devices.
Implementation
Future<int?> startHardwareEchoDetection(string testAudioFilePath) async {
$a() => ($instance as $p_a.RTCEngine)
.startHardwareEchoDetection(testAudioFilePath);
$i() => ($instance as $p_i.ByteRTCEngine)
.startHardwareEchoDetection(testAudioFilePath);
if (Platform.isAndroid) {
return $a();
} else if (Platform.isIOS) {
return $i();
} else {
throw UnsupportedError(
'Not Support Platform ${Platform.operatingSystem}');
}
}