setPosition method

Future<int?> setPosition(
  1. int position
)

@detail api @brief Sets the starting playback position of the media file. @param position The starting position of the media file in milliseconds.
You can get the total duration of the media file through getTotalDuration{@link #IMediaPlayer#getTotalDuration}. The value of position should be less than the total duration of the media file. @return - 0: Success. - < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details. @note - The API is valid for audio file, not PCM data. - When playing online files, calling this API may cause playback delay. - After calling this API, you will receive onMediaPlayerEvent{@link #IMediaPlayerEventHandler#onMediaPlayerEvent} callback.

Implementation

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

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