setExternalAudioSource abstract method

Future<void> setExternalAudioSource({
  1. required bool enabled,
  2. required int sampleRate,
  3. required int channels,
  4. bool localPlayback = false,
  5. bool publish = true,
})

Sets the external audio source parameters.

Deprecated: This method is deprecated, use createCustomAudioTrack instead. Call this method before joining a channel.

  • enabled Whether to enable the external audio source: true : Enable the external audio source. false : (Default) Disable the external audio source.
  • sampleRate The sample rate (Hz) of the external audio source which can be set as 8000, 16000, 32000, 44100, or 48000.
  • channels The number of channels of the external audio source, which can be set as 1 (Mono) or 2 (Stereo).
  • localPlayback Whether to play the external audio source: true : Play the external audio source. false : (Default) Do not play the external source.
  • publish Whether to publish audio to the remote users: true : (Default) Publish audio to the remote users. false : Do not publish audio to the remote users.

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> setExternalAudioSource(
    {required bool enabled,
    required int sampleRate,
    required int channels,
    bool localPlayback = false,
    bool publish = true});