BetterPlayerConfiguration class

Configuration of Better Player. Allows to setup general behavior of player. Master configuration which contains children that configure specific part of player.

Constructors

BetterPlayerConfiguration({double? aspectRatio, bool autoPlay = false, Duration? startAt, bool looping = false, bool fullScreenByDefault = false, Widget? placeholder, bool showPlaceholderUntilPlay = false, bool placeholderOnTop = true, Widget? overlay, Widget errorBuilder(BuildContext context, String? errorMessage)?, bool allowedScreenSleep = true, double? fullScreenAspectRatio, List<DeviceOrientation> deviceOrientationsOnFullScreen = const [DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight], List<SystemUiOverlay> systemOverlaysAfterFullScreen = SystemUiOverlay.values, List<DeviceOrientation> deviceOrientationsAfterFullScreen = const [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown, DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight], BetterPlayerRoutePageBuilder? routePageBuilder, dynamic eventListener(BetterPlayerEvent)?, BetterPlayerSubtitlesConfiguration subtitlesConfiguration = const BetterPlayerSubtitlesConfiguration(), BetterPlayerControlsConfiguration controlsConfiguration = const BetterPlayerControlsConfiguration(), BoxFit fit = BoxFit.fill, double rotation = 0, dynamic playerVisibilityChangedBehavior(double visibilityFraction)?, List<BetterPlayerTranslations>? translations, bool autoDetectFullscreenDeviceOrientation = false, bool autoDetectFullscreenAspectRatio = false, bool handleLifecycle = true, bool autoDispose = true, bool expandToFill = true, bool useRootNavigator = false})
const

Properties

allowedScreenSleep bool
Defines if the player will sleep in fullscreen or not
final
aspectRatio double?
The Aspect Ratio of the Video. Important to get the correct size of the video!
final
autoDetectFullscreenAspectRatio bool
Defines if player should auto detect full screen aspect ration of the video. If deviceOrientationsOnFullScreen is true this is done automaticaly also.
final
autoDetectFullscreenDeviceOrientation bool
Defines if player should auto detect full screen device orientation based on aspect ratio of the video. If aspect ratio of the video is < 1 then video will played in full screen in portrait mode. If aspect ratio is >= 1 then video will be played horizontally. If this parameter is true, then deviceOrientationsOnFullScreen and fullScreenAspectRatio value will be ignored.
final
autoDispose bool
Defines flag which enabled/disabled auto dispose of BetterPlayerController on BetterPlayer dispose. When it's true and BetterPlayerController instance has been attached to BetterPlayer widget and dispose has been called on BetterPlayer instance, then BetterPlayerController will be disposed. Default value is true.
final
autoPlay bool
Play the video as soon as it's displayed
final
controlsConfiguration BetterPlayerControlsConfiguration
Defines controls configuration
final
deviceOrientationsAfterFullScreen List<DeviceOrientation>
Defines the set of allowed device orientations after exiting fullscreen
final
deviceOrientationsOnFullScreen List<DeviceOrientation>
Defines the set of allowed device orientations on entering fullscreen
final
errorBuilder → (Widget Function(BuildContext context, String? errorMessage)?)
When the video playback runs into an error, you can build a custom error message.
final
eventListener → (dynamic Function(BetterPlayerEvent)?)
Defines a event listener where video player events will be send
final
expandToFill bool
Flag which causes to player expand to fill all remaining space. Set to false to use minimum constraints
final
fit BoxFit
Defines fit of the video, allows to fix video stretching, see possible values here: https://api.flutter.dev/flutter/painting/BoxFit-class.html
final
fullScreenAspectRatio double?
Defines aspect ratio which will be used in fullscreen
final
fullScreenByDefault bool
Defines if the player will start in fullscreen when play is pressed
final
handleLifecycle bool
Defines flag which enables/disables lifecycle handling (pause on app closed, play on app resumed). Default value is true.
final
hashCode int
The hash code for this object.
no setterinherited
looping bool
Whether or not the video should loop
final
overlay Widget?
A widget which is placed between the video and the controls
final
placeholder Widget?
The placeholder is displayed underneath the Video before it is initialized or played.
final
placeholderOnTop bool
Placeholder position of player stack. If false, then placeholder will be displayed on the bottom, so user need to hide it manually. Default is true.
final
playerVisibilityChangedBehavior → (dynamic Function(double visibilityFraction)?)
Defines function which will react on player visibility changed
final
rotation double
Defines rotation of the video in degrees. Default value is 0. Can be 0, 90, 180, 270. Angle will rotate only video box, controls will be in the same place.
final
routePageBuilder BetterPlayerRoutePageBuilder?
Defines a custom RoutePageBuilder for the fullscreen
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showPlaceholderUntilPlay bool
Should the placeholder be shown until play is pressed
final
startAt Duration?
Start video at a certain position
final
subtitlesConfiguration BetterPlayerSubtitlesConfiguration
Defines subtitles configuration
final
systemOverlaysAfterFullScreen List<SystemUiOverlay>
Defines the system overlays visible after exiting fullscreen
final
translations List<BetterPlayerTranslations>?
Defines translations used in player. If null, then default english translations will be used.
final
useRootNavigator bool
Flag which causes to player use the root navigator to open new pages. Default value is false.
final

Methods

copyWith({double? aspectRatio, bool? autoPlay, Duration? startAt, bool? looping, bool? fullScreenByDefault, Widget? placeholder, bool? showPlaceholderUntilPlay, bool? placeholderOnTop, Widget? overlay, bool? showControlsOnInitialize, Widget errorBuilder(BuildContext context, String? errorMessage)?, bool? allowedScreenSleep, double? fullScreenAspectRatio, List<DeviceOrientation>? deviceOrientationsOnFullScreen, List<SystemUiOverlay>? systemOverlaysAfterFullScreen, List<DeviceOrientation>? deviceOrientationsAfterFullScreen, BetterPlayerRoutePageBuilder? routePageBuilder, dynamic eventListener(BetterPlayerEvent)?, BetterPlayerSubtitlesConfiguration? subtitlesConfiguration, BetterPlayerControlsConfiguration? controlsConfiguration, BoxFit? fit, double? rotation, dynamic playerVisibilityChangedBehavior(double visibilityFraction)?, List<BetterPlayerTranslations>? translations, bool? autoDetectFullscreenDeviceOrientation, bool? handleLifecycle, bool? autoDispose, bool? expandToFill, bool? useRootNavigator}) BetterPlayerConfiguration
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited