PlayerState class

Immutable snapshot of a player's current state.

Used with ValueNotifier to drive UI updates via ValueListenableBuilder. Use copyWith to derive a new state from an existing one.

Annotations

Constructors

PlayerState({PlaybackPhase phase = PlaybackPhase.idle, Duration position = Duration.zero, Duration duration = Duration.zero, double bufferedFraction = 0.0, VideoSource? currentSource, String? errorMessage})
Creates a new PlayerState.
const

Properties

bufferedFraction double
Fraction of media that has been buffered, from 0.0 to 1.0.
final
currentSource VideoSource?
The video source currently loaded in this player, if any.
final
duration Duration
Total duration of the loaded media.
final
errorMessage String?
Human-readable error message when phase is PlaybackPhase.error.
final
hashCode int
The hash code for this object.
no setteroverride
phase PlaybackPhase
The current playback phase.
final
position Duration
Current playback position.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({PlaybackPhase? phase, Duration? position, Duration? duration, double? bufferedFraction, VideoSource? currentSource, bool clearCurrentSource = false, String? errorMessage, bool clearErrorMessage = false}) PlayerState
Creates a copy of this PlayerState with the given fields replaced.
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