seekTo method

void seekTo(
  1. Duration time
)

Moves the playhead and shows that frame in the preview.

Implementation

void seekTo(Duration time) {
  pausePlayback();
  setGlobalTime(time);
  final vpc = _videoPlayerController;

  // Composed preview: player timeline matches the project timeline.
  if (_previewIsComposed && vpc != null && vpc.value.isInitialized) {
    var target = _currentGlobalTime.value;
    final duration = vpc.value.duration;
    if (duration > Duration.zero && target > duration) target = duration;
    if (target.isNegative) target = Duration.zero;
    vpc.seekTo(target);
    return;
  }
  if (_previewIsComposed) return;

  _showRawClipAtPlayhead();
}