Struct AudioPlayer
zaun_client::AudioPlayer · Struct
pub struct AudioPlayer { … }Plays AudioResources, one at a time, into every subscribed voice session.
Methods
Section titled “Methods”pub fn new() -> Result<Self>A player, idle, with its own thread.
Errors
Section titled “Errors”Error::Audio when the thread cannot start.
pub fn play(&self, resource: AudioResource)Plays resource now, ending the current one; the queue stays.
enqueue
Section titled “enqueue”pub fn enqueue(&self, resource: AudioResource)Plays resource after the current one and those queued before it.
pub fn skip(&self)Ends the current resource; the next queued one plays.
pub fn stop(&self)Ends the current resource and empties the queue: the player goes idle.
pub fn pause(&self) -> boolPauses; false when there was nothing playing.
unpause
Section titled “unpause”pub fn unpause(&self) -> boolResumes after pause; false when it was not paused.
status
Section titled “status”pub fn status(&self) -> AudioPlayerStatusWhat the player is doing.
queue_len
Section titled “queue_len”pub fn queue_len(&self) -> usizeResources waiting after the current one.
next_event
Section titled “next_event”pub fn next_event(&self, timeout: Duration) -> Option<AudioPlayerEvent>The next event, or None when none arrives within timeout.
events
Section titled “events”pub fn events(&self) -> impl Iterator<Item = AudioPlayerEvent> + Send + 'staticThe events, blocking; ends when the player is dropped.
Trait implementations
Section titled “Trait implementations”Debug, Drop