seekTo method

Future<void> seekTo(
  1. Duration position
)

Sets the video's current timestamp to be at moment. The next time the video is played it will resume from the given moment.

If moment is outside of the video's full range it will be automatically and silently clamped.

Implementation

Future<void> seekTo(Duration position) async {
  if (_isDisposedOrNotInitialized) {
    return;
  }
  if (position > value.duration.end) {
    position = value.duration.end;
  } else if (position < Duration.zero) {
    position = Duration.zero;
  }
  await _videoPlayerPlatform.seekTo(_playerId, position);
  _updatePosition(position);
}