getPosition method

Future<int?> getPosition()

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

Implementation

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

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