handleShowPlayerControls method

dynamic handleShowPlayerControls({
  1. bool showWithTimeout = true,
})

Show the player controls.

if showWithTimeout is false showPlayerControls will be set to true without a timeout to change it to false.

if showWithTimeout is true showPlayerControls will be set to true with a timeout to auto-hide the controls.

Implementation

handleShowPlayerControls({bool showWithTimeout = true}) {
  _showPlayerControls = true;
  _notify();

  // Cancel any previously running timer.
  _showPlayerControlsTimer?.cancel();
  if (showWithTimeout) {
    // Timer duration fetched through channel, passing the current player information.

    _showPlayerControlsTimer = Timer(
        _flickManager!.getPlayerControlsTimeout(
          errorInVideo: _flickManager!.flickVideoManager!.errorInVideo,
          isVideoInitialized:
              _flickManager!.flickVideoManager!.isVideoInitialized,
          isPlaying: _flickManager!.flickVideoManager!.isPlaying,
          isVideoEnded: _flickManager!.flickVideoManager!.isVideoEnded,
        ), () {
      _showPlayerControls = false;
      _notify();
    });
  }
}