MeeduPlayerController constructor

MeeduPlayerController({
  1. ScreenManager screenManager = const ScreenManager(),
  2. Color colorTheme = Colors.redAccent,
  3. Widget? loadingWidget,
  4. bool controlsEnabled = true,
  5. String? errorText,
  6. ControlsStyle controlsStyle = ControlsStyle.primary,
  7. Widget? header,
  8. Widget? bottomRight,
  9. CustomIcons customIcons = const CustomIcons(),
  10. EnabledButtons enabledButtons = const EnabledButtons(),
  11. void onVideoPlayerClosed()?,
})

creates an instance of MeeduPlayerControlle

screenManager the device orientations and overlays placeholder widget to show when the player is loading a video controlsEnabled if the player must show the player controls errorText message to show when the load process failed

Implementation

MeeduPlayerController({
  this.screenManager = const ScreenManager(),
  this.colorTheme = Colors.redAccent,
  Widget? loadingWidget,
  this.controlsEnabled = true,
  String? errorText,
  this.controlsStyle = ControlsStyle.primary,
  this.header,
  this.bottomRight,
  //this.pipEnabled = false,
  //this.showPipButton = false,
  this.customIcons = const CustomIcons(),
  this.enabledButtons = const EnabledButtons(),
  this.onVideoPlayerClosed,
}) {
  getUserPreferenceForFit();

  _errorText = errorText;
  this.tag = DateTime.now().microsecondsSinceEpoch.toString();
  this.loadingWidget = loadingWidget ??
      SpinKitWave(
        size: 30,
        color: this.colorTheme,
      );
  if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {
    windows = true;
  }
  //check each
  if (!windows) {
    VolumeController().listener((newVolume) {
      volume.value = newVolume;
    });
  }

  _playerEventSubs = onPlayerStatusChanged.listen(
    (PlayerStatus status) {
      if (status == PlayerStatus.playing) {
        Wakelock.enable();
      } else {
        Wakelock.disable();
      }
    },
  );

  //if (pipEnabled) {
  // get the OS version and check if pip is available
  //this._pipManager.checkPipAvailable().then(
  //(value) => _pipAvailable.value = value,
  //);
  // listen the pip mode changes
  //_pipModeWorker = _pipManager.isInPipMode.ever(this._onPipModeChanged);
  //} else {
  //_pipAvailable.value = false;
  //}
}