pub struct QueuePlayer { /* private fields */ }Implementations§
Source§impl QueuePlayer
impl QueuePlayer
pub fn new() -> Self
pub fn add_queue_track(&mut self, track: QueueTrack)
pub fn add_format( &mut self, format: Arc<Mutex<Box<dyn FormatReader>>>, name: String, )
pub fn add_track(&mut self, track: MusicTrack)
pub fn add<P>(&mut self, path: P) -> Result<(), Box<dyn Error>>
pub fn remove(&mut self, index: usize)
pub fn clear(&mut self)
pub fn shuffle(&mut self)
pub fn current_track_name(&self) -> &str
pub fn play(&mut self, index: usize)
pub fn play_next(&mut self)
pub fn play_previous(&mut self)
pub fn get_index_from_track_name(&self, name: &str) -> Result<usize, NError>
pub fn get_duration_for_track(&self, index: usize) -> TrackTime
Methods from Deref<Target = Player>§
Sourcepub fn pause(&mut self) -> Result<(), SendError<Message>>
pub fn pause(&mut self) -> Result<(), SendError<Message>>
Pauses the current playing track, if any It only errors if it can’t send the message (so something serious may have happened)
Sourcepub fn unpause(&mut self) -> Result<(), SendError<Message>>
pub fn unpause(&mut self) -> Result<(), SendError<Message>>
Unpauses the current playing track, if any It only errors if it can’t send the message (so something serious may have happened)
Sourcepub fn is_paused(&self) -> bool
pub fn is_paused(&self) -> bool
Returns whether the current track is paused
It’ll always return false if there isn’t any track playing
Sourcepub fn set_volume(&mut self, volume: f32) -> Result<(), SendError<Message>>
pub fn set_volume(&mut self, volume: f32) -> Result<(), SendError<Message>>
Sets the output volume It only errors if it can’t send the message (so something serious may have happened)
Sourcepub fn set_playback_speed(
&mut self,
playback_speed: f32,
) -> Result<(), SendError<Message>>
pub fn set_playback_speed( &mut self, playback_speed: f32, ) -> Result<(), SendError<Message>>
Sets the output volume It only errors if it can’t send the message (so something serious may have happened)
Sourcepub fn seek_to(&self, secs: u64, frac: f64) -> Result<(), SendError<Message>>
pub fn seek_to(&self, secs: u64, frac: f64) -> Result<(), SendError<Message>>
Seeks to the set timestamp Be aware that if the timestamp isn’t valid the track thread will panic It only errors if it can’t send the message (so something serious may have happened)
Sourcepub fn get_time(&mut self) -> Option<TrackTime>
pub fn get_time(&mut self) -> Option<TrackTime>
Returns the timestamp that was lastly sent by the track thread
Sourcepub fn has_ended(&self) -> bool
pub fn has_ended(&self) -> bool
Returns whether the track thread has sent Message::End, thus stopping the execution by itself
This will return false if you called Player::end_current beforehand
Sourcepub fn is_playing(&self) -> bool
pub fn is_playing(&self) -> bool
Returns whether if any track is playing Note that this function doesn’t check if the track is paused or not
Sourcepub fn end_current(&self) -> Result<(), SendError<Message>>
pub fn end_current(&self) -> Result<(), SendError<Message>>
Ends the current track playing, if any It only errors if it can’t send the message (so something serious may have happened)
Sourcepub fn play_from_path<P>(&mut self, path: P) -> Result<(), Box<dyn Error>>
pub fn play_from_path<P>(&mut self, path: P) -> Result<(), Box<dyn Error>>
Plays a certain track given its file path
Sourcepub fn play_from_track(&mut self, track: &MusicTrack)
pub fn play_from_track(&mut self, track: &MusicTrack)
Plays a certain track