pause method

bool pause()

Pause the current media file.

If the the player is opening a media file, calling this method will set autoplay to false.

Implementation

bool pause() {
  if (!disposed) {
    if (id.value != null && playbackState.value == PlaybackState.playing) {
      _methodChannel.invokeMethod('pause', id.value);
      playbackState.value = PlaybackState.paused;
      if (!_seeking) {
        loading.value = false;
      }
      return true;
    } else if (autoPlay.value &&
        playbackState.value == PlaybackState.closed &&
        _source != null) {
      setAutoPlay(false);
      return true;
    }
  }
  return false;
}