selectAudioTrack abstract method

Future<void> selectAudioTrack(
  1. int index
)

Specifies the playback audio track of the current music file.

After obtaining the number of audio tracks in the music file, you can call this method to specify any track for playback. For example, if a multi-track file contains songs in different languages on different tracks, you can use this method to set the playback language of the music file. For supported audio file formats, see What audio formats does the RTC SDK support?. You must call this method after calling startAudioMixing and receiving the onAudioMixingStateChanged(audioMixingStatePlaying) callback.

  • index The specified playback audio track. The value must be greater than or equal to 0 and less than the return value of getAudioTrackCount.

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> selectAudioTrack(int index);