playButtonCallback method

Future<void> playButtonCallback()

Callback for the play button.

Normally it only switches play state for the player. If the video reaches the end, then click the button will make the video replay.

Implementation

Future<void> playButtonCallback() async {
  if (videoController == null) return;
  if (isControllerPlaying) {
    videoController?.pause();
    return;
  }
  if (videoController?.value.duration == videoController?.value.position) {
    videoController
      ?..seekTo(Duration.zero)
      ..play();
    return;
  }
  videoController?.play();
}