SoundPlayerUI class


A HTML 5 style audio play bar.

Allows you to play/pause/resume and seek an audio track. The SoundPlayerUI displays:

  • a spinner while loading audio
  • play/resume buttons
  • a slider to indicate and change the current play position.
  • optionally displays the album title and track if the Track contains those details.

Inheritance

Constructors

SoundPlayerUI.fromLoader(OnLoad onLoad, {bool showTitle = false, bool enabled = true, AudioFocus audioFocus = AudioFocus.requestFocusAndKeepOthers, Color? backgroundColor, Color iconColor = Colors.black, Color disabledIconColor = Colors.grey, TextStyle? textStyle, TextStyle? titleStyle, SliderThemeData? sliderThemeData})
SoundPlayerUI.fromLoader allows you to dynamically provide a Track when the user clicks the play button. You can cancel the play action by returning null when _onLoad is called. onLoad is the function that is called when the user clicks the play button. You return either a Track to be played or null if you want to cancel the play action. If showTitle is true (default is false) then the play bar will also display the track name and album (if set). If enabled is true (the default) then the Player will be enabled. If enabled is false then the player will be disabled and the user will not be able to click the play button. The audioFocus allows you to control what happens to other media that is playing when our player starts. By default we use AudioFocus.requestFocusAndDuckOthers which will reduce the volume of any other players.
SoundPlayerUI.fromTrack(Track track, {bool showTitle = false, bool enabled = true, AudioFocus audioFocus = AudioFocus.requestFocusAndKeepOthers, Color? backgroundColor, Color iconColor = Colors.black, Color disabledIconColor = Colors.grey, TextStyle? textStyle, TextStyle? titleStyle, SliderThemeData? sliderThemeData})
SoundPlayerUI.fromTrack Constructs a Playbar with a Track. track is the Track that contains the audio to play.

Properties

hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<StatefulWidget>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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

Constants

standardCodec → const Codec
only codec support by android unless we have a minSdk of 29 then OGG_VORBIS and OPUS are supported.