Interface BufferSourceAudioTrackInitConfig

Configurations for the audio track from an audio file or AudioBuffer object. Set these configurations when calling [AgoraRTC.createBufferSourceAudioTrack]IAgoraRTC.createBufferSourceAudioTrack.

interface BufferSourceAudioTrackInitConfig {
    cacheOnlineFile?: boolean;
    encoderConfig?: AudioEncoderConfiguration | "speech_low_quality" | "speech_standard" | "music_standard" | "standard_stereo" | "high_quality" | "high_quality_stereo";
    source: string | File | AudioBuffer;
}

Properties

cacheOnlineFile?: boolean

Whether to cache the online file:

  • true: Cache the online file.
  • false: (default) Do not cache the online file.
encoderConfig?: AudioEncoderConfiguration | "speech_low_quality" | "speech_standard" | "music_standard" | "standard_stereo" | "high_quality" | "high_quality_stereo"

The audio encoder configurations.

You can set the audio encoder configurations in either of the following ways:

  • Pass the preset audio encoder configurations by using [[AudioEncoderConfigurationPreset]].
  • Pass your customized audio encoder configurations by using [[AudioEncoderConfiguration]].

Firefox does not support setting the audio encoding rate.

source: string | File | AudioBuffer

The type of the audio source:

  • File: An File object, representing a local audio file.
  • string: The online audio file retrieved from an HTTPS address. Ensure the address supports HTTPS and CORS.
  • AudioBuffer: An AudioBuffer object, representing the raw data in PCM format.