videoPlayerClosed method

Future<void> videoPlayerClosed()

Implementation

Future<void> videoPlayerClosed() async {
  customDebugPrint("Video player closed");
  await onFullscreenClose();

  _timer?.cancel();
  _timerForVolume?.cancel();
  _timerForGettingVolume?.cancel();
  timerForTrackingMouse?.cancel();
  _timerForSeek?.cancel();
  _timerForCheckingSeek?.cancel();
  videoFitChangedTimer?.cancel();
  WidgetsBinding.instance.addPostFrameCallback((_) async {
    _position.value = Duration.zero;
    _timer?.cancel();
    pause();
    if (manageWakeLock) {
      WakelockPlus.disable();
    }

    removeListeners();
    await _videoPlayerController?.dispose();
    _videoPlayerController = null;

    //disposePlayer();
    if (onVideoPlayerClosed != null) {
      customDebugPrint("Called");
      onVideoPlayerClosed!();
    } else {
      customDebugPrint("Didnt get Called");
    }
  });
}