ChewieAudioController class

The ChewieAudioController is used to configure and drive the Chewie Audio 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.

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

Constructors

ChewieAudioController({required VideoPlayerController videoPlayerController, OptionsTranslation? optionsTranslation, bool autoInitialize = false, bool autoPlay = false, bool draggableProgressBar = true, Duration? startAt, bool looping = false, ChewieProgressColors? cupertinoProgressColors, ChewieProgressColors? materialProgressColors, bool showControlsOnInitialize = true, bool showOptions = true, Future<void> optionsBuilder(BuildContext context, List<OptionItem> chewieOptions)?, List<OptionItem> additionalOptions(BuildContext context)?, bool showControls = true, TransformationController? transformationController, bool zoomAndPan = false, double maxScale = 2.5, Subtitles? subtitle, Widget subtitleBuilder(BuildContext context, dynamic subtitle)?, Widget? customControls, Widget errorBuilder(BuildContext context, String errorMessage)?, bool isLive = false, bool allowMuting = true, bool allowPlaybackSpeedChanging = true, List<double> playbackSpeeds = const [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2], Duration? progressIndicatorDelay, EdgeInsets controlsSafeAreaMinimum = EdgeInsets.zero})

Properties

additionalOptions → (List<OptionItem> Function(BuildContext context)?)
Add your own additional options on top of chewie options
final
allowMuting bool
Defines if the mute control should be shown
final
allowPlaybackSpeedChanging bool
Defines if the playback speed control should be shown
final
autoInitialize bool
Initialize the Audio on Startup. This will prep the audio for playback.
final
autoPlay bool
Play the audio as soon as it's initialized
final
controlsSafeAreaMinimum EdgeInsets
Adds additional padding to the controls' SafeArea as desired. Defaults to EdgeInsets.zero.
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
draggableProgressBar bool
Non-Draggable Progress Bar
final
errorBuilder → (Widget Function(BuildContext context, String errorMessage)?)
When the video playback runs into an error, you can build a custom error message.
final
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isLive bool
Defines if the controls should be for live stream audio
final
isPlaying bool
no setter
looping bool
Whether or not the audio 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
maxScale double
Max scale when zooming
final
optionsBuilder → (Future<void> Function(BuildContext context, List<OptionItem> chewieOptions)?)
Build your own options with default chewieOptions shiped through the builder method. Just add your own options to the Widget you'll build. If you want to hide the chewieOptions, just leave them out from your Widget.
final
optionsTranslation OptionsTranslation?
Pass your translations for the options like:
final
playbackSpeeds List<double>
Defines the set of allowed playback speeds user can change
final
progressIndicatorDelay Duration?
Defines a delay in milliseconds between entering buffering state and displaying the loading spinner. Set null (default) to disable it.
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
Wether or not to show the controls when initializing the widget.
final
showOptions bool
If false, the options button in MaterialUI and MaterialDesktopUI won't be shown.
final
startAt Duration?
Start audio at a certain position
final
subtitle Subtitles?
Add a List of Subtitles here in Subtitles.subtitle
getter/setter pair
subtitleBuilder ↔ (Widget Function(BuildContext context, dynamic subtitle)?)
Define here your own Widget on how your n'th subtitle will look like
getter/setter pair
transformationController TransformationController?
Controller to pass into the InteractiveViewer component
final
videoPlayerController → VideoPlayerController
The controller for the video you want to play
final
zoomAndPan bool
Whether or not to allow zooming and panning
final

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
copyWith({VideoPlayerController? videoPlayerController, OptionsTranslation? optionsTranslation, double? aspectRatio, bool? autoInitialize, bool? autoPlay, bool? draggableProgressBar, Duration? startAt, bool? looping, ChewieProgressColors? cupertinoProgressColors, ChewieProgressColors? materialProgressColors, Widget? placeholder, Widget? overlay, bool? showControlsOnInitialize, bool? showOptions, Future<void> optionsBuilder(BuildContext, List<OptionItem>)?, List<OptionItem> additionalOptions(BuildContext)?, bool? showControls, TransformationController? transformationController, bool? zoomAndPan, double? maxScale, Subtitles? subtitle, Widget subtitleBuilder(BuildContext, dynamic)?, Widget? customControls, Widget errorBuilder(BuildContext, String)?, bool? allowedScreenSleep, bool? isLive, bool? allowFullScreen, bool? allowMuting, bool? allowPlaybackSpeedChanging, bool? useRootNavigator, Duration? hideControlsTimer, EdgeInsets? controlsSafeAreaMinimum, List<double>? playbackSpeeds, List<SystemUiOverlay>? systemOverlaysOnEnterFullScreen, List<DeviceOrientation>? deviceOrientationsOnEnterFullScreen, List<SystemUiOverlay>? systemOverlaysAfterFullScreen, List<DeviceOrientation>? deviceOrientationsAfterFullScreen, Duration? progressIndicatorDelay, Widget routePageBuilder(BuildContext, Animation<double>, Animation<double>, ChewieAudioControllerProvider)?}) ChewieAudioController
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
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>
setSubtitle(List<Subtitle> newSubtitle) → void
setVolume(double volume) Future<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) ChewieAudioController

Constants

defaultHideControlsTimer → const Duration