preloadEffect abstract method

Future<void> preloadEffect({
  1. required int soundId,
  2. required String filePath,
  3. int startPos = 0,
})

Preloads a specified audio effect file into the memory.

To ensure smooth communication, It is recommended that you limit the size of the audio effect file. You can call this method to preload the audio effect before calling joinChannel. For the audio file formats supported by this method, see What formats of audio files does the Agora RTC SDK support.

  • soundId The audio effect ID. The ID of each audio effect file is unique.
  • 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.
  • startPos The playback position (ms) of the audio effect 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> preloadEffect(
    {required int soundId, required String filePath, int startPos = 0});