MeeduPlayerController constructor
MeeduPlayerController({
- ScreenManager screenManager = const ScreenManager(),
- Color colorTheme = Colors.redAccent,
- Widget? loadingWidget,
- bool controlsEnabled = true,
- String? errorText,
- ControlsStyle controlsStyle = ControlsStyle.primary,
- Widget? header,
- Widget? bottomRight,
- CustomIcons customIcons = const CustomIcons(),
- EnabledButtons enabledButtons = const EnabledButtons(),
- 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;
//}
}