Trait termusicplayback::PlayerTrait
source · pub trait PlayerTrait {
Show 21 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) -> u16;
fn volume_up(&mut self);
fn volume_down(&mut self);
fn set_volume(&mut self, volume: u16);
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: i32);
fn speed_up(&mut self);
fn speed_down(&mut self);
fn speed(&self) -> i32;
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);
// Provided method
fn position(&self) -> Option<PlayerTimeUnit> { ... }
}Required Methods§
sourcefn 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 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
fn volume(&self) -> u16
fn volume_up(&mut self)
fn volume_down(&mut self)
fn set_volume(&mut self, volume: u16)
fn pause(&mut self)
fn resume(&mut self)
fn is_paused(&self) -> bool
sourcefn seek(&mut self, secs: i64) -> Result<()>
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.
sourcefn get_progress(&self) -> Option<PlayerProgress>
fn get_progress(&self) -> Option<PlayerProgress>
Get current track time position
fn set_speed(&mut self, speed: i32)
fn speed_up(&mut self)
fn speed_down(&mut self)
fn speed(&self) -> i32
fn stop(&mut self)
fn gapless(&self) -> bool
fn set_gapless(&mut self, to: bool)
fn skip_one(&mut self)
sourcefn enqueue_next(&mut self, track: &Track)
fn enqueue_next(&mut self, track: &Track)
Add the given URI to be played, but do not skip currently playing track
Provided Methods§
sourcefn position(&self) -> Option<PlayerTimeUnit>
fn position(&self) -> Option<PlayerTimeUnit>
Quickly access the position.
This should ALWAYS match up with PlayerTrait::get_progress’s .position!