getAudioMixingDuration method Null safety

Future<int?> getAudioMixingDuration(
  1. [String? filePath]

Gets the total duration (ms) of the music file.


  • Call this method after joining a channel.

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://".
  • 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.


  • The total duration (ms) of the specified music file, if this method call succeeds.
  • Error code, if this method call fails.


Future<int?> getAudioMixingDuration([String? filePath]) {
  return _invokeMethod('getAudioMixingDuration', {
    'filePath': filePath,