setExternalAudioSink abstract method

Future<void> setExternalAudioSink({
  1. required bool enabled,
  2. required int sampleRate,
  3. required int channels,
})

Sets external audio rendering.

After calling this method to enable external audio rendering, you can call pullAudioFrame to pull remote audio data. The app can process the pulled raw audio data before rendering to achieve the desired audio effect. After calling this method to enable external audio rendering, the app can no longer get data from the onPlaybackAudioFrame callback.

  • enabled Whether to enable external audio rendering: true : Enable external audio rendering. false : (Default) Disable external audio rendering.
  • sampleRate The sample rate (Hz) for external audio rendering. You can set it to 16000, 32000, 44100, or 48000.
  • channels The number of channels for external audio rendering: 1: Mono 2: Stereo

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. See Error Codes for details and resolution suggestions.

Implementation

Future<void> setExternalAudioSink(
    {required bool enabled, required int sampleRate, required int channels});