pub struct PlayerState {
pub status: PlayerStatus,
pub activity: PlayerActivity,
pub seeking: Option<Duration>,
pub rate: f64,
pub volume: f64,
pub muted: bool,
pub duration: Option<Duration>,
pub loaded: Vec<TimeRange>,
pub seekable: Vec<TimeRange>,
pub size: Option<Size>,
pub tracks: Vec<MediaTrack>,
}Expand description
What a player’s media is, and what the system’s player does with it.
Fields§
§status: PlayerStatus§activity: PlayerActivityWhether it is paused, waiting or playing, as the system reports it.
seeking: Option<Duration>Where a seek is taking it, until it lands; None while no seek is under way. A later
seek replaces the target.
rate: f64The rate it plays at while it plays, 1.0 the media’s own speed, kept while paused for
the next play; as the system reports it, which can differ from the rate asked for.
volume: f64How loud it plays, from 0.0, silent, to 1.0, the media’s own volume.
muted: boolWhether its sound is off, apart from its volume.
duration: Option<Duration>How long the media is; None until it is known, and for a live stream.
loaded: Vec<TimeRange>The parts of the media loaded now, in order.
seekable: Vec<TimeRange>The parts it can seek into, in order: the whole media for a file, a moving window for a live stream, none where it cannot seek.
size: Option<Size>The picture’s size, in its own pixels, as it is presented: its aspect corrected; None
until it is known, and for media without a picture.
tracks: Vec<MediaTrack>The media’s tracks; empty until it is ready.
Implementations§
Source§impl PlayerState
impl PlayerState
Sourcepub fn loading() -> PlayerState
pub fn loading() -> PlayerState
A player that is loading, paused as the app has not played it: nothing known yet.
Sourcepub fn failed(error: PlayerError) -> PlayerState
pub fn failed(error: PlayerError) -> PlayerState
A player that failed with error, and does nothing more.