PlaybackState class

The playback state which includes a playing boolean state, a processing state such as AudioProcessingState.buffering, the playback position and the currently enabled actions to be shown in the Android notification or the iOS control center.

Constructors

PlaybackState({AudioProcessingState processingState = AudioProcessingState.idle, bool playing = false, List<MediaControl> controls = const [], List<int>? androidCompactActionIndices, Set<MediaAction> systemActions = const {}, Duration updatePosition = Duration.zero, Duration bufferedPosition = Duration.zero, double speed = 1.0, DateTime? updateTime, int? errorCode, String? errorMessage, AudioServiceRepeatMode repeatMode = AudioServiceRepeatMode.none, AudioServiceShuffleMode shuffleMode = AudioServiceShuffleMode.none, bool captioningEnabled = false, int? queueIndex})
Creates a PlaybackState with given field values, and with updateTime defaulting to DateTime.now.

Properties

androidCompactActionIndices List<int>?
Up to 3 indices of the controls that should appear in Android's compact media notification view. When the notification is expanded, all controls will be shown.
final
bufferedPosition Duration
The buffered position.
final
captioningEnabled bool
Whether captioning is enabled.
final
controls List<MediaControl>
The list of currently enabled controls which should be shown in the media notification. Each control represents a clickable button with a MediaAction that must be one of:
final
copyWith PlaybackStateCopyWith
Creates a copy of this state with given fields replaced by new values, with updateTime set to DateTime.now, and unless otherwise replaced, with updatePosition set to position.
no setter
errorCode int?
The error code when processingState is AudioProcessingState.error.
final
errorMessage String?
The error message when processingState is AudioProcessingState.error.
final
hashCode int
The hash code for this object.
no setteroverride
playing bool
Whether audio is either playing, or will play as soon as processingState is AudioProcessingState.ready. A true value should be broadcast whenever it would be appropriate for UIs to display a pause or stop button.
final
position Duration
The current playback position.
no setter
processingState AudioProcessingState
The audio processing state e.g. AudioProcessingState.buffering.
final
queueIndex int?
The index of the current item in the queue, if any.
final
repeatMode AudioServiceRepeatMode
The current repeat mode.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shuffleMode AudioServiceShuffleMode
The current shuffle mode.
final
speed double
The current playback speed where 1.0 means normal speed.
final
systemActions Set<MediaAction>
The set of system actions currently enabled. This is for specifying any other MediaActions that are not supported by controls, because they do not represent clickable buttons. For example:
final
updatePosition Duration
The playback position at updateTime.
final
updateTime DateTime
The time at which the playback position was last updated.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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