play method

Future<void> play()

Starts playing the video.

Implementation

Future<void> play() async {
  if (_isDisposed) {
    return;
  }

  if (!value.isInitialized) {
    return;
  }

  /// When there is an error in playing the video, it will be adjusted to
  /// the corresponding progress during initialization.
  if (value.position > Duration.zero) {
    await seekTo(value.position);
  }

  await videoPlayerController.play();
  value = value.copyWith(videoPlayerValue: videoPlayerController.value);

  videoPlayerController.addListener(_listener);
}