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) -> Volume;
fn volume_up(&mut self) -> Volume;
fn volume_down(&mut 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_up(&mut self) -> Speed;
fn speed_down(&mut self) -> 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);
// 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
sourcefn volume_up(&mut self) -> Volume
fn volume_up(&mut self) -> Volume
Step the volume up by a backend-set step amount
Returns the new volume
sourcefn volume_down(&mut self) -> Volume
fn volume_down(&mut self) -> Volume
Step the volume down by a backend-set step amount
Returns the new volume
sourcefn set_volume(&mut self, volume: Volume) -> Volume
fn set_volume(&mut self, volume: Volume) -> Volume
Set the volume to a specific amount.
Returns the new volume
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
sourcefn set_speed(&mut self, speed: Speed) -> Speed
fn set_speed(&mut self, speed: Speed) -> Speed
Set the speed to a specific amount.
Returns the new speed
sourcefn speed_up(&mut self) -> Speed
fn speed_up(&mut self) -> Speed
Step the speed up by a backend-set step amount
Returns the new speed
sourcefn speed_down(&mut self) -> Speed
fn speed_down(&mut self) -> Speed
Step the speed down by a backend-set step amount
Returns the new speed
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
!