pub struct MediaSessionManager { /* private fields */ }Implementations§
Source§impl MediaSessionManager
impl MediaSessionManager
pub fn new() -> Self
Sourcepub fn set(&mut self, info: NowPlayingInfo)
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.
Sourcepub fn current(&self) -> &NowPlayingInfo
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.
Sourcepub fn take_if_dirty(&mut self) -> Option<NowPlayingInfo>
pub fn take_if_dirty(&mut self) -> Option<NowPlayingInfo>
The session to announce, or None when nothing announceable changed.
Sourcepub fn push_request(&mut self, request: MediaControlRequest)
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.
Sourcepub fn current_request(&self) -> Option<&MediaControlRequest>
pub fn current_request(&self) -> Option<&MediaControlRequest>
The seek being delivered this pass, or the last one delivered - what
a MediaControl callback reads.
Sourcepub fn clear_pending_requests(&mut self)
pub fn clear_pending_requests(&mut self)
The pass is over: the queued seeks were delivered. The newest is kept
as last_request.
pub fn has_pending_requests(&self) -> bool
Sourcepub fn set_system_audio_active(&mut self, active: bool)
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.
pub fn is_system_audio_active(&self) -> bool
Sourcepub fn push_system_audio_change(&mut self, change: SystemAudioChange)
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.
Sourcepub fn current_system_audio_change(&self) -> Option<SystemAudioChange>
pub fn current_system_audio_change(&self) -> Option<SystemAudioChange>
The change being delivered on this pass, or the last one delivered.
Sourcepub fn take_seeked(&mut self) -> Option<i64>
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
impl Clone for MediaSessionManager
Source§fn clone(&self) -> MediaSessionManager
fn clone(&self) -> MediaSessionManager
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MediaSessionManager
impl Debug for MediaSessionManager
Source§impl Default for MediaSessionManager
impl Default for MediaSessionManager
Source§fn default() -> MediaSessionManager
fn default() -> MediaSessionManager
Source§impl EventProvider for MediaSessionManager
impl EventProvider for MediaSessionManager
Source§fn get_pending_events(&self, timestamp: Instant) -> Vec<SyntheticEvent>
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.