Enum mpris::Event

source ·
pub enum Event {
Show 14 variants PlayerShutDown, Paused, Playing, Stopped, LoopingChanged(LoopStatus), ShuffleToggled(bool), VolumeChanged(f64), PlaybackRateChanged(f64), TrackChanged(Metadata), Seeked { position_in_us: u64, }, TrackAdded(TrackID), TrackRemoved(TrackID), TrackMetadataChanged { old_id: TrackID, new_id: TrackID, }, TrackListReplaced,
}
Expand description

Represents a change in Player state.

Note that this does not include position changes (seeking in a track or normal progress of time for playing media).

Variants§

§

PlayerShutDown

Player was shut down / quit.

§

Paused

Player was paused.

§

Playing

Player started playing media.

§

Stopped

Player was stopped.

§

LoopingChanged(LoopStatus)

Loop status of Player was changed. New LoopStatus is provided.

§

ShuffleToggled(bool)

Shuffle status of Player was changed. New shuffle status is provided.

§

VolumeChanged(f64)

Player’s volume was changed. The new volume is provided.

§

PlaybackRateChanged(f64)

Player’s playback rate was changed. New playback rate is provided.

§

TrackChanged(Metadata)

Player’s track changed. Metadata of the new track is provided.

§

Seeked

Fields

§position_in_us: u64

The new position, in microseconds.

Player seeked (changed position in the current track).

This will only be emitted when the player in question emits this signal. Some players do not support this signal. If you want to accurately detect seeking, you’ll have to query the player’s position yourself at some intervals.

§

TrackAdded(TrackID)

A new track was added to the TrackList.

§

TrackRemoved(TrackID)

A track was removed from the TrackList.

§

TrackMetadataChanged

Fields

§old_id: TrackID

The id of the track before the change.

Only use this ID if you are keeping track of track IDs somewhere. The ID might no longer be valid for the player, so loading metadata for it might fail.

Note: This can be the same as the new_id.

§new_id: TrackID

The id of the track after the change.

Use this ID if you intend to read metadata or anything else as the old_id may no longer be valid.

Note: This can be the same as the old_id.

A track on the TrackList had its metadata changed.

This could also mean that a entry on the playlist completely changed; including the ID.

§

TrackListReplaced

The track list was replaced.

Trait Implementations§

source§

impl Debug for Event

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnwindSafe for Event

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.