Skip to main content

MediaSessionManager

Struct MediaSessionManager 

Source
pub struct MediaSessionManager { /* private fields */ }

Implementations§

Source§

impl MediaSessionManager

Source

pub fn new() -> Self

Source

pub fn set(&mut self, info: NowPlayingInfo)

Record what the app is playing.

§Why a position-only change does not mark this dirty

A player calls this once per frame with an advancing position. If that marked the session dirty, every frame would put a PropertiesChanged signal on the session bus - 60 D-Bus broadcasts a second, woken up in every listening process on the desktop.

It would also be WRONG rather than merely wasteful: the MPRIS spec says Position must not appear in PropertiesChanged at all, precisely because it changes continuously. Clients extrapolate it from PlaybackStatus and Rate and read the property when they need a precise value, so the stored position is served on demand instead.

Source

pub fn current(&self) -> &NowPlayingInfo

What the app last published, whether or not the platform has been told.

This is what a property GETTER answers with, which is why it is unconditional: a desktop reading Position must get the current value even though no announcement was made for it.

Source

pub fn take_if_dirty(&mut self) -> Option<NowPlayingInfo>

The session to announce, or None when nothing announceable changed.

Source

pub fn push_request(&mut self, request: MediaControlRequest)

An inbound seek from the platform (9h-i-a-i-a). Queued; the next pass delivers it as a MediaControl event at the root.

Source

pub fn current_request(&self) -> Option<&MediaControlRequest>

The seek being delivered this pass, or the last one delivered - what a MediaControl callback reads.

Source

pub fn clear_pending_requests(&mut self)

The pass is over: the queued seeks were delivered. The newest is kept as last_request.

Source

pub fn has_pending_requests(&self) -> bool

Source

pub fn set_system_audio_active(&mut self, active: bool)

Record what the app asked for (9h-i-a-i-d-i): true while it wants to own the system audio.

Source

pub fn is_system_audio_active(&self) -> bool

Source

pub fn push_system_audio_change(&mut self, change: SystemAudioChange)

Queue what the system did with the audio; delivered as a SystemAudioChange event at the root on the next pass. Lost also ends the app’s claim, so is_system_audio_active reads false after it without the app having to clean up.

Source

pub fn current_system_audio_change(&self) -> Option<SystemAudioChange>

The change being delivered on this pass, or the last one delivered.

Source

pub fn take_seeked(&mut self) -> Option<i64>

The position jump to announce (MPRIS Seeked), if any; cleared by the take.

Trait Implementations§

Source§

impl Clone for MediaSessionManager

Source§

fn clone(&self) -> MediaSessionManager

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MediaSessionManager

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for MediaSessionManager

Source§

fn default() -> MediaSessionManager

Returns the “default value” for a type. Read more
Source§

impl EventProvider for MediaSessionManager

Source§

fn get_pending_events(&self, timestamp: Instant) -> Vec<SyntheticEvent>

One MediaControl event per queued request, at the root: a seek is a window-level command like a media key, not a node’s.

Source§

impl PartialEq for MediaSessionManager

Source§

fn eq(&self, other: &MediaSessionManager) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MediaSessionManager

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.