setEarMonitoringAudioFrameParameters abstract method

Future<void> setEarMonitoringAudioFrameParameters({
  1. required int sampleRate,
  2. required int channel,
  3. required RawAudioFrameOpModeType mode,
  4. required int samplesPerCall,
})

Sets the format of the in-ear monitoring raw audio data.

This method is used to set the in-ear monitoring audio data format reported by the onEarMonitoringAudioFrame callback. Before calling this method, you need to call enableInEarMonitoring, and set includeAudioFilters to earMonitoringFilterBuiltInAudioFilters or earMonitoringFilterNoiseSuppression. The SDK calculates the sampling interval based on the samplesPerCall, sampleRate and channel parameters set in this method. Sample interval (sec) = samplePerCall /(sampleRate × channel). Ensure that the sample interval ≥ 0.01 (s). The SDK triggers the onEarMonitoringAudioFrame callback according to the sampling interval.

  • sampleRate The sample rate of the audio data reported in the onEarMonitoringAudioFrame callback, which can be set as 8,000, 16,000, 32,000, 44,100, or 48,000 Hz.
  • channel The number of audio channels reported in the onEarMonitoringAudioFrame callback. 1: Mono. 2: Stereo.
  • mode The use mode of the audio frame. See RawAudioFrameOpModeType.
  • samplesPerCall The number of data samples reported in the onEarMonitoringAudioFrame callback, such as 1,024 for the Media Push.

Returns When the method call succeeds, there is no return value; when fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly. < 0: Failure.

Implementation

Future<void> setEarMonitoringAudioFrameParameters(
    {required int sampleRate,
    required int channel,
    required RawAudioFrameOpModeType mode,
    required int samplesPerCall});