pub struct Progress { /* private fields */ }Expand description
Struct containing information about current progress of a Player.
It has access to the metadata of the current track, as well as information about the current position of the track.
It is up to you to decide on how outdated information you want to rely on when implementing progress rendering.
Implementations§
Source§impl Progress
impl Progress
Sourcepub fn metadata(&self) -> &Metadata
pub fn metadata(&self) -> &Metadata
The track metadata at the point in time that this Progress was constructed.
Sourcepub fn playback_status(&self) -> PlaybackStatus
pub fn playback_status(&self) -> PlaybackStatus
The playback status at the point in time that this Progress was constructed.
Sourcepub fn shuffle(&self) -> bool
pub fn shuffle(&self) -> bool
The shuffle status at the point in time that this Progress was constructed.
Sourcepub fn loop_status(&self) -> LoopStatus
pub fn loop_status(&self) -> LoopStatus
The loop status at the point in time that this Progress was constructed.
Sourcepub fn playback_rate(&self) -> f64
pub fn playback_rate(&self) -> f64
The playback rate at the point in time that this Progress was constructed.
Sourcepub fn length(&self) -> Option<Duration>
pub fn length(&self) -> Option<Duration>
Returns the length of the current track as a Duration.
Sourcepub fn position(&self) -> Duration
pub fn position(&self) -> Duration
Returns the current position of the current track as a Duration.
This method will calculate the expected position of the track at the instant of the
invocation using the initial_position and knowledge of how long ago that position was
determined.
Note: Some players might not support this and will return a bad position. Spotify is one such example. There is no reliable way of detecting problematic players, so it will be up to your client to check for this.
One way of doing this is to query the initial_position for two measures with the
PlaybackStatus::Playing and if both are 0, then it is likely that this client does not
support positions.
Sourcepub fn initial_position(&self) -> Duration
pub fn initial_position(&self) -> Duration
Sourcepub fn created_at(&self) -> &Instant
pub fn created_at(&self) -> &Instant
Sourcepub fn current_volume(&self) -> f64
pub fn current_volume(&self) -> f64
Returns the player’s volume as it was at the time of refresh.
See: Player::get_volume.