PlayerTrait

Trait PlayerTrait 

Source
pub trait PlayerTrait {
Show 20 methods // Required methods fn add_and_play<'life0, 'life1, 'async_trait>( &'life0 mut self, track: &'life1 Track, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn volume(&self) -> Volume; fn set_volume(&mut self, volume: Volume) -> Volume; fn pause(&mut self); fn resume(&mut self); fn is_paused(&self) -> bool; fn seek(&mut self, secs: i64) -> Result<()>; fn seek_to(&mut self, position: Duration); fn get_progress(&self) -> Option<PlayerProgress>; fn set_speed(&mut self, speed: Speed) -> Speed; fn speed(&self) -> Speed; fn stop(&mut self); fn gapless(&self) -> bool; fn set_gapless(&mut self, to: bool); fn skip_one(&mut self); fn enqueue_next(&mut self, track: &Track); fn media_info(&self) -> MediaInfo; // Provided methods fn add_volume(&mut self, volume: VolumeSigned) -> Volume { ... } fn add_speed(&mut self, speed: SpeedSigned) -> Speed { ... } fn position(&self) -> Option<PlayerTimeUnit> { ... }
}

Required Methods§

Source

fn add_and_play<'life0, 'life1, 'async_trait>( &'life0 mut self, track: &'life1 Track, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Add the given track, skip to it (if not already) and start playing

Source

fn volume(&self) -> Volume

Get the currently set volume

Source

fn set_volume(&mut self, volume: Volume) -> Volume

Set the volume to a specific amount.

Returns the new volume

Source

fn pause(&mut self)

Source

fn resume(&mut self)

Source

fn is_paused(&self) -> bool

Source

fn seek(&mut self, secs: i64) -> Result<()>

Seek relatively to the current time

§Errors

Depending on different backend, there could be different errors during seek.

Source

fn seek_to(&mut self, position: Duration)

Seek to a absolute position

Source

fn get_progress(&self) -> Option<PlayerProgress>

Get current track time position

Source

fn set_speed(&mut self, speed: Speed) -> Speed

Set the speed to a specific amount.

Returns the new speed

Source

fn speed(&self) -> Speed

Get the currently set speed

Source

fn stop(&mut self)

Source

fn gapless(&self) -> bool

Source

fn set_gapless(&mut self, to: bool)

Source

fn skip_one(&mut self)

Source

fn enqueue_next(&mut self, track: &Track)

Add the given URI to be played, but do not skip currently playing track

Source

fn media_info(&self) -> MediaInfo

Get info of the current media

Provided Methods§

Source

fn add_volume(&mut self, volume: VolumeSigned) -> Volume

Add a relative amount to the current volume

Returns the new volume

Source

fn add_speed(&mut self, speed: SpeedSigned) -> Speed

Add a relative amount to the current speed

Returns the new speed

Source

fn position(&self) -> Option<PlayerTimeUnit>

Quickly access the position.

This should ALWAYS match up with PlayerTrait::get_progress’s .position!

Implementors§