Struct mpris_server::Player

source ·
pub struct Player { /* private fields */ }
Expand description

Ready-to-use mutable service-side object that internally implements LocalRootInterface and LocalPlayerInterface.

This has its own internal state, automatically emits properties changed signals, and allows you to connect to method and property setter calls.

If you need more control to the implementation, you can use LocalServer or Server directly instead.

Implementations§

source§

impl Player

source

pub fn builder(bus_name_suffix: &str) -> PlayerBuilder

source

pub fn run(&self) -> LocalServerRunTask

Returns a task that runs the player’s server until the player and the task is dropped.

The task must be awaited as soon as possible after creating the player.

The returned task is no-op if the player’s server has been ran before.

source

pub fn connect_raise(&self, cb: impl Fn(&Self) + 'static)

source

pub fn connect_quit(&self, cb: impl Fn(&Self) + 'static)

source

pub fn connect_set_fullscreen(&self, cb: impl Fn(&Self, bool) + 'static)

source

pub fn can_quit(&self) -> bool

source

pub async fn set_can_quit(&self, can_quit: bool) -> Result<()>

source

pub fn fullscreen(&self) -> bool

source

pub async fn set_fullscreen(&self, fullscreen: bool) -> Result<()>

source

pub fn can_set_fullscreen(&self) -> bool

source

pub async fn set_can_set_fullscreen( &self, can_set_fullscreen: bool, ) -> Result<()>

source

pub fn can_raise(&self) -> bool

source

pub async fn set_can_raise(&self, can_raise: bool) -> Result<()>

source

pub fn has_track_list(&self) -> bool

source

pub async fn set_has_track_list(&self, has_track_list: bool) -> Result<()>

source

pub fn identity(&self) -> Ref<'_, String>

source

pub async fn set_identity(&self, identity: impl Into<String>) -> Result<()>

source

pub fn desktop_entry(&self) -> Ref<'_, String>

source

pub async fn set_desktop_entry( &self, desktop_entry: impl Into<String>, ) -> Result<()>

source

pub fn supported_uri_schemes(&self) -> Ref<'_, Vec<String>>

source

pub async fn set_supported_uri_schemes( &self, supported_uri_schemes: impl IntoIterator<Item = impl Into<String>>, ) -> Result<()>

source

pub fn supported_mime_types(&self) -> Ref<'_, Vec<String>>

source

pub async fn set_supported_mime_types( &self, supported_mime_types: impl IntoIterator<Item = impl Into<String>>, ) -> Result<()>

source

pub fn connect_next(&self, cb: impl Fn(&Self) + 'static)

source

pub fn connect_previous(&self, cb: impl Fn(&Self) + 'static)

source

pub fn connect_pause(&self, cb: impl Fn(&Self) + 'static)

source

pub fn connect_play_pause(&self, cb: impl Fn(&Self) + 'static)

source

pub fn connect_stop(&self, cb: impl Fn(&Self) + 'static)

source

pub fn connect_play(&self, cb: impl Fn(&Self) + 'static)

source

pub fn connect_seek(&self, cb: impl Fn(&Self, Time) + 'static)

source

pub fn connect_set_position(&self, cb: impl Fn(&Self, &TrackId, Time) + 'static)

source

pub fn connect_open_uri(&self, cb: impl Fn(&Self, &str) + 'static)

source

pub fn connect_set_loop_status(&self, cb: impl Fn(&Self, LoopStatus) + 'static)

source

pub fn connect_set_rate(&self, cb: impl Fn(&Self, PlaybackRate) + 'static)

source

pub fn connect_set_shuffle(&self, cb: impl Fn(&Self, bool) + 'static)

source

pub fn connect_set_volume(&self, cb: impl Fn(&Self, Volume) + 'static)

source

pub async fn seeked(&self, position: Time) -> Result<()>

source

pub fn playback_status(&self) -> PlaybackStatus

source

pub async fn set_playback_status( &self, playback_status: PlaybackStatus, ) -> Result<()>

source

pub fn loop_status(&self) -> LoopStatus

source

pub async fn set_loop_status(&self, loop_status: LoopStatus) -> Result<()>

source

pub fn rate(&self) -> PlaybackRate

source

pub async fn set_rate(&self, rate: PlaybackRate) -> Result<()>

source

pub fn shuffle(&self) -> bool

source

pub async fn set_shuffle(&self, shuffle: bool) -> Result<()>

source

pub fn metadata(&self) -> Ref<'_, Metadata>

source

pub async fn set_metadata(&self, metadata: Metadata) -> Result<()>

source

pub fn volume(&self) -> Volume

source

pub async fn set_volume(&self, volume: Volume) -> Result<()>

source

pub fn position(&self) -> Time

source

pub fn set_position(&self, position: Time)

This does not emit PropertiesChanged signal.

source

pub fn minimum_rate(&self) -> PlaybackRate

source

pub async fn set_minimum_rate(&self, minimum_rate: PlaybackRate) -> Result<()>

source

pub fn maximum_rate(&self) -> PlaybackRate

source

pub async fn set_maximum_rate(&self, maximum_rate: PlaybackRate) -> Result<()>

source

pub fn can_go_next(&self) -> bool

source

pub async fn set_can_go_next(&self, can_go_next: bool) -> Result<()>

source

pub fn can_go_previous(&self) -> bool

source

pub async fn set_can_go_previous(&self, can_go_previous: bool) -> Result<()>

source

pub fn can_play(&self) -> bool

source

pub async fn set_can_play(&self, can_play: bool) -> Result<()>

source

pub fn can_pause(&self) -> bool

source

pub async fn set_can_pause(&self, can_pause: bool) -> Result<()>

source

pub fn can_seek(&self) -> bool

source

pub async fn set_can_seek(&self, can_seek: bool) -> Result<()>

source

pub fn can_control(&self) -> bool

This can only be set on construct.

Trait Implementations§

source§

impl Debug for Player

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Player

§

impl !RefUnwindSafe for Player

§

impl !Send for Player

§

impl !Sync for Player

§

impl Unpin for Player

§

impl !UnwindSafe for Player

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more