playPause method

void playPause()

Plays or pauses the currently displayed video, if any.

Implementation

void playPause() {
  Log.debug('playPause()', '$runtimeType');

  interface.value = true;

  final ReactivePlayerController? video = item?.video.value;
  if (video != null) {
    final bool isFinished = video.isCompleted.value;

    if (video.isPlaying.value) {
      video.pause();
    } else {
      if (isFinished) {
        video.seekTo(const Duration());
      }

      video.play();
    }
  }
}