getEffectDuration method

  1. @override
Future<int?> getEffectDuration(
  1. String filePath
)

Gets the duration of the audio effect file.

Since v3.4.2

Note Call this method after RtcEngine.playEffect.

Parameter filePath The file path, including the filename extensions.

  • Android: Agora supports using a URI address, an absolute path, or a path that starts with /assets/. Supported audio formats: mp3, mp4, m4a, aac, 3gp, mkv and wav. For details, see Supported Media Formats. Note: 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".
  • iOS: Agora supports using an absolute path. For example: /var/mobile/Containers/Data/audio.mp4. Supported audio formats include MP3, AAC, M4A, MP4, WAV, and 3GP. For details, see Best Practices for iOS Audio.

Returns

  • The total duration (ms) of the specified audio file, if this method call succeeds.
  • Error code, if this method call fails.
    • -22(ERR_RESOURCE_LIMITED): Cannot find the audio effect file. Please set a valid filePath.

Implementation

@override
Future<int?> getEffectDuration(String filePath) {
  return _invokeMethod('getEffectDuration', {'filePath': filePath});
}