[−][src]Struct mpris::Progress
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.
Methods
impl Progress
[src]
pub fn metadata(&self) -> &Metadata
[src]
The track metadata at the point in time that this Progress was constructed.
pub fn playback_status(&self) -> PlaybackStatus
[src]
The playback status at the point in time that this Progress was constructed.
pub fn shuffle(&self) -> bool
[src]
The shuffle status at the point in time that this Progress was constructed.
pub fn loop_status(&self) -> LoopStatus
[src]
The loop status at the point in time that this Progress was constructed.
pub fn playback_rate(&self) -> f64
[src]
The playback rate at the point in time that this Progress was constructed.
pub fn length(&self) -> Option<Duration>
[src]
Returns the length of the current track as a Duration
.
pub fn position(&self) -> Duration
[src]
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
Playing
PlaybackStatus
and if both are 0
, then it is likely that this client does not
support positions.
pub fn initial_position(&self) -> Duration
[src]
Returns the position that the current track was at when the Progress
was created.
This is the number that was returned for the Position
property in the MPRIS2 interface.
pub fn created_at(&self) -> &Instant
[src]
The instant where this Progress
was recorded.
See: age
.
pub fn age(&self) -> Duration
[src]
Returns the age of the data as a Duration
.
If the Progress
has a high age it is more likely to be out of date.
pub fn current_volume(&self) -> f64
[src]
Returns the player's volume as it was at the time of refresh.
See: Player::get_volume
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Progress
impl Send for Progress
impl Sync for Progress
impl Unpin for Progress
impl UnwindSafe for Progress
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,