startAudioMixing abstract method

Future<void> startAudioMixing({
  1. required String filePath,
  2. required bool loopback,
  3. required int cycle,
  4. int startPos = 0,
})

Starts playing the music file.

For the audio file formats supported by this method, see What formats of audio files does the Agora RTC SDK support. If the local music file does not exist, the SDK does not support the file format, or the the SDK cannot access the music file URL, the SDK reports audioMixingReasonCanNotOpen.

  • filePath File path: Android: The file path, which needs to be accurate to the file name and suffix. Agora supports URL addresses, absolute paths, or file paths that start with /assets/. You might encounter permission issues if you use an absolute path to access a local file, so Agora recommends using a URI address instead. For example : content://com.android.providers.media.documents/document/audio%3A14441 Windows: The absolute path or URL address (including the suffixes of the filename) of the audio effect file. For example : C:\music\audio.mp4. iOS or macOS: The absolute path or URL address (including the suffixes of the filename) of the audio effect file. For example: /var/mobile/Containers/Data/audio.mp4.
  • loopback Whether to only play music files on the local client: true : Only play music files on the local client so that only the local user can hear the music. false : Publish music files to remote clients so that both the local user and remote users can hear the music.
  • cycle The number of times the music file plays.

0: The number of times for playback. For example, 1 represents playing 1 time. -1: Play the audio file in an infinite loop.

  • startPos The playback position (ms) of the music file.

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> startAudioMixing(
    {required String filePath,
    required bool loopback,
    required int cycle,
    int startPos = 0});