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();
    }

    _videoPlayerController?.removeListener(_listener);
    await _videoPlayerController?.dispose();
    _videoPlayerController = null;

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