setAudioProfile abstract method

Future<void> setAudioProfile({
  1. required AudioProfileType profile,
  2. AudioScenarioType scenario = AudioScenarioType.audioScenarioDefault,
})

Sets the audio profile and audio scenario.

You can call this method either before or after joining a channel. Due to iOS system restrictions, some audio routes cannot be recognized in call volume mode. Therefore, if you need to use an external sound card, it is recommended to set the audio scenario to audioScenarioGameStreaming (3). In this scenario, the SDK will switch to media volume to avoid this issue. In scenarios requiring high-quality audio, such as online music tutoring, Agora recommends you set profile as audioProfileMusicHighQuality (4) and scenario as audioScenarioGameStreaming (3).

  • profile The audio profile, including the sampling rate, bitrate, encoding mode, and the number of channels. See AudioProfileType.
  • scenario The audio scenarios. Under different audio scenarios, the device uses different volume types. See AudioScenarioType.

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.

Implementation

Future<void> setAudioProfile(
    {required AudioProfileType profile,
    AudioScenarioType scenario = AudioScenarioType.audioScenarioDefault});