seekTo method
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 (_isDisposed) {
return;
}
if (position! > value.duration!) {
position = value.duration;
} else if (position < const Duration()) {
position = const Duration();
}
if (onSeeking != null) onSeeking!();
await VideoPlayerPlatform.instance.seekTo(_textureId, position);
value = value.copyWith(position: position);
if (onSeeked != null) onSeeked!();
}