pause method

Future<void> pause()

暂停

Implementation

Future<void> pause() async {
  if (_dispose) {
    return;
  }

  if (videoPlayerValue?.isInitialized == true) {
    // 暂停播放
    await value.videoPlayerController?.pause();

    _playerEventStreamController.sink.add(BetterVideoPlayerEvent(value.playerKey, BetterVideoPlayerEventType.onPause));
  } else {
    // 如果在初始化中, 需要关闭自动播放
    value = value.copyWith(configuration: value.configuration.copyWith(autoPlay: false));
  }
}