startHardwareEchoDetection method
@detail api
@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 #ByteRTCEngine#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 ByteRTCRoomProfile{@link #ByteRTCRoomProfile} is set to ByteRTCRoomProfileMeeting or ByteRTCRoomProfileMeetingRoom.
- 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 rtcEngine:onHardwareEchoDetectionResult:{@link #ByteRTCEngineDelegate#rtcEngine:onHardwareEchoDetectionResult}.
- During the detection, the SDK is not able to response to the other testing APIs, such as startEchoTest:playDelay:{@link #ByteRTCEngine#startEchoTest:playDelay}, startAudioDeviceRecordTest:{@link #ByteRTCAudioDeviceManager#startAudioDeviceRecordTest} or startAudioPlaybackDeviceTest:interval:{@link #ByteRTCAudioDeviceManager#startAudioPlaybackDeviceTest:interval}.
- Call stopHardwareEchoDetection{@link #ByteRTCEngine#stopHardwareEchoDetection} to stop the detection and release the audio devices.
Implementation
FutureOr<int> startHardwareEchoDetection(NSString testAudioFilePath) async {
return await nativeCall('startHardwareEchoDetection:', [testAudioFilePath]);
}