ChewieController class
The ChewieController is used to configure and drive the Chewie Player Widgets. It provides methods to control playback, such as pause and play, as well as methods that control the visual appearance of the player, such as enterFullScreen or exitFullScreen.
In addition, you can listen to the ChewieController for presentational
changes, such as entering and exiting full screen mode. To listen for
changes to the playback, such as a change to the seek position of the
player, please use the standard information provided by the
VideoPlayerController
.
- Inheritance
-
- Object
- ChangeNotifier
- ChewieController
Constructors
-
ChewieController({required VideoPlayerController videoPlayerController, double? aspectRatio, bool autoInitialize = false, bool autoPlay = false, Duration? startAt, bool looping = false, bool fullScreenByDefault = false, ChewieProgressColors? cupertinoProgressColors, ChewieProgressColors? materialProgressColors, Widget? placeholder, Widget? overlay, bool showControlsOnInitialize = true, bool showControls = true, Widget? customControls, Widget errorBuilder(BuildContext context, String? errorMessage)?, bool allowedScreenSleep = true, bool isLive = false, bool allowFullScreen = true, bool allowMuting = true, bool allowPlaybackSpeedChanging = true, List<
double> playbackSpeeds = const [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2], List<SystemUiOverlay> ? systemOverlaysOnEnterFullScreen, List<DeviceOrientation> ? deviceOrientationsOnEnterFullScreen, List<SystemUiOverlay> systemOverlaysAfterFullScreen = SystemUiOverlay.values, List<DeviceOrientation> deviceOrientationsAfterFullScreen = DeviceOrientation.values, ChewieRoutePageBuilder? routePageBuilder})
Properties
- allowedScreenSleep → bool
-
Defines if the player will sleep in fullscreen or not
final
- allowFullScreen → bool
-
Defines if the fullscreen control should be shown
final
- allowMuting → bool
-
Defines if the mute control should be shown
final
- allowPlaybackSpeedChanging → bool
-
Defines if the playback speed control should be shown
final
- aspectRatio → double?
-
The Aspect Ratio of the Video. Important to get the correct size of the
video!
final
- autoInitialize → bool
-
Initialize the Video on Startup. This will prep the video for playback.
final
- autoPlay → bool
-
Play the video as soon as it's displayed
final
- cupertinoProgressColors → ChewieProgressColors?
-
The colors to use for controls on iOS. By default, the iOS player uses
colors sampled from the original iOS 11 designs.
final
- customControls → Widget?
-
Defines customised controls. Check MaterialControls or
CupertinoControls for reference.
final
-
deviceOrientationsAfterFullScreen
→ List<
DeviceOrientation> -
Defines the set of allowed device orientations after exiting fullscreen
final
-
deviceOrientationsOnEnterFullScreen
→ 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
- fullScreenByDefault → bool
-
Defines if the player will start in fullscreen when play is pressed
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isFullScreen → bool
-
no setter
- isLive → bool
-
Defines if the controls should be for live stream video
final
- isPlaying → bool
-
no setter
- looping → bool
-
Whether or not the video should loop
final
- materialProgressColors → ChewieProgressColors?
-
The colors to use for the Material Progress Bar. By default, the Material
player uses the colors from your Theme.
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
-
playbackSpeeds
→ List<
double> -
Defines the set of allowed playback speeds user can change
final
- routePageBuilder → ChewieRoutePageBuilder?
-
Defines a custom RoutePageBuilder for the fullscreen
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showControls → bool
-
Whether or not to show the controls at all
final
- showControlsOnInitialize → bool
-
Weather or not to show the controls when initializing the widget.
final
- startAt → Duration?
-
Start video at a certain position
final
-
systemOverlaysAfterFullScreen
→ List<
SystemUiOverlay> -
Defines the system overlays visible after exiting fullscreen
final
-
systemOverlaysOnEnterFullScreen
→ List<
SystemUiOverlay> ? -
Defines the system overlays visible on entering fullscreen
final
- videoPlayerController → VideoPlayerController
-
The controller for the video you want to play
final
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
enterFullScreen(
) → void -
exitFullScreen(
) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
pause(
) → Future< void> -
play(
) → Future< void> -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
seekTo(
Duration moment) → Future< void> -
setLooping(
bool looping) → Future< void> -
setVolume(
double volume) → Future< void> -
toggleFullScreen(
) → void -
togglePause(
) → void -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
of(
BuildContext context) → ChewieController