videoPlayerClosed method

Future<void> videoPlayerClosed()

Implementation

Future<void> videoPlayerClosed() async {
  print("Video player closed");
  fullscreen.value = false;
  resetBrightness();
  if (windows) {
    screenManager.setWindowsFullScreen(false, this);
    HotKeyManager.instance.unregisterAll();
  } else {
    screenManager.setDefaultOverlaysAndOrientations();
  }
  _timer?.cancel();
  _timerForVolume?.cancel();
  _timerForGettingVolume?.cancel();
  timerForTrackingMouse?.cancel();
  _timerForSeek?.cancel();
  videoFitChangedTimer?.cancel();
  WidgetsBinding.instance.addPostFrameCallback((_) async {
    _position.value = Duration.zero;
    _timer?.cancel();
    pause();
    Wakelock.disable();
    if (windows) {
      removeWindowsListener();
      _videoPlayerControllerWindows?.dispose();
      _videoPlayerControllerWindows = null;
    } else {
      _videoPlayerController?.removeListener(this._listener);
      await _videoPlayerController?.dispose();
      _videoPlayerController = null;
    }
    //disposeVideoPlayerController();
    if (onVideoPlayerClosed != null) {
      print("Called");
      onVideoPlayerClosed!();
    } else {
      print("Didnt get Called");
    }
  });
}