PlaybackState class
Represents the current state of media playback.
This information is synchronized with the system media session to show progress, speed, status, and repeat mode in the system controls.
Constructors
- PlaybackState({required PlaybackStatus status, Duration position = Duration.zero, double speed = 1.0, Duration bufferedPosition = Duration.zero, MediaRepeatMode repeatMode = MediaRepeatMode.none, bool shuffleModeEnabled = false})
-
Creates a new PlaybackState instance.
const
-
PlaybackState.fromJson(Map<
String, dynamic> json) -
Creates a PlaybackState instance from a JSON map.
factory
Properties
- bufferedPosition → Duration
-
The currently buffered position in the media.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- position → Duration
-
The current playback position.
final
- repeatMode → MediaRepeatMode
-
The active MediaRepeatMode.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shuffleModeEnabled → bool
-
Whether shuffle mode is enabled on the player.
final
- speed → double
-
The current playback speed/rate (e.g., 1.0 for normal speed).
final
- status → PlaybackStatus
-
The current PlaybackStatus of the player.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts the playback state to a JSON map for platform channel communication.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited