MeeduPlayerController constructor

MeeduPlayerController({
  1. ScreenManager screenManager = const ScreenManager(),
  2. Color colorTheme = Colors.redAccent,
  3. Widget? loadingWidget,
  4. bool controlsEnabled = true,
  5. bool manageWakeLock = true,
  6. String? errorText,
  7. ControlsStyle controlsStyle = ControlsStyle.primary,
  8. Widget? header,
  9. Widget? bottomRight,
  10. List<BoxFit> fits = const [BoxFit.contain, BoxFit.cover, BoxFit.fill, BoxFit.fitHeight, BoxFit.fitWidth, BoxFit.scaleDown],
  11. CustomIcons customIcons = const CustomIcons(),
  12. EnabledButtons enabledButtons = const EnabledButtons(),
  13. 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 manageWakeLock if the player should use wakelock errorText message to show when the load process failed

Implementation

MeeduPlayerController({
  this.screenManager = const ScreenManager(),
  this.colorTheme = Colors.redAccent,
  Widget? loadingWidget,
  this.controlsEnabled = true,
  this.manageWakeLock = true,
  String? errorText,
  this.controlsStyle = ControlsStyle.primary,
  this.header,
  this.bottomRight,
  this.fits = const [
    BoxFit.contain,
    BoxFit.cover,
    BoxFit.fill,
    BoxFit.fitHeight,
    BoxFit.fitWidth,
    BoxFit.scaleDown
  ],
  //this.pipEnabled = false,
  //this.showPipButton = false,
  this.customIcons = const CustomIcons(),
  this.enabledButtons = const EnabledButtons(),
  this.onVideoPlayerClosed,
}) {
  getUserPreferenceForFit();

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

  _playerEventSubs = onPlayerStatusChanged.listen(
    (PlayerStatus status) {
      if (status == PlayerStatus.playing) {
        if (manageWakeLock && !UniversalPlatform.isLinux) {
          Wakelock.enable();
        }
      } else {
        if (manageWakeLock && !UniversalPlatform.isLinux) {
          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;
  //}
}