getTotalDuration method

Future<int?> getTotalDuration()

@detail api @brief Gets the duration of the media file. @return - >0: Success, the duration of the media file in milliseconds. - < 0: Failed. @note - Call this API only when audio is mixing. - The API is valid for audio file, not PCM data.

Implementation

Future<int?> getTotalDuration() async {
  $a() => ($instance as $p_a.IMediaPlayer).getTotalDuration();
  $i() => ($instance as $p_i.ByteRTCMediaPlayer).getTotalDuration();

  if (Platform.isAndroid) {
    return $a();
  } else if (Platform.isIOS) {
    return $i();
  } else {
    throw UnsupportedError(
        'Not Support Platform ${Platform.operatingSystem}');
  }
}