Struct VoiceSession
zaun_client::VoiceSession · Struct
pub struct VoiceSession { … }One stay in a voice channel. Dropping it leaves the channel.
Methods
Section titled “Methods”community
Section titled “community”pub const fn community(&self) -> CommunityIdThe community.
channel
Section titled “channel”pub const fn channel(&self) -> ChannelIdThe voice channel.
voice_session
Section titled “voice_session”pub const fn voice_session(&self) -> VoiceSessionIdThis stay’s voice session, as the host named it.
send_audio
Section titled “send_audio”pub fn send_audio(&self, frame: &[u8])Sends one Opus packet to every connected participant, sealed, now: the caller keeps
the time (one packet per 20 ms for 20 ms packets). Its duration comes from its TOC
byte. Frames are dropped while this member is muted (by itself or a moderator) or may
not speak. To play files or streams in real time, subscribe to an
AudioPlayer instead.
subscribe
Section titled “subscribe”pub fn subscribe(&self, player: &AudioPlayer)Sends what player plays (discord.js’s connection.subscribe(player)), instead of
any player subscribed before. The player does not keep this session alive.
unsubscribe
Section titled “unsubscribe”pub fn unsubscribe(&self, player: &AudioPlayer)Stops sending what player plays.
frames_refused
Section titled “frames_refused”pub fn frames_refused(&self) -> u64How many frames arrived from participants and did not open (a wrong key, a damaged frame, one that was never sealed, or one sealed under an epoch this stay never had or no longer keeps, around joins and leaves); none are played.
can_send
Section titled “can_send”pub fn can_send(&self) -> boolWhether frames given to send_audio are sent now.
next_event
Section titled “next_event”pub fn next_event(&self, timeout: Duration) -> Option<VoiceEvent>The next event, or None when none arrives within timeout or the session ended.
events
Section titled “events”pub fn events(&self) -> impl Iterator<Item = VoiceEvent> + Send + 'staticThe events, blocking; ends with the session.
set_self
Section titled “set_self”pub fn set_self(&self, mute: Option<bool>, deaf: Option<bool>) -> Result<()>Mutes or deafens this member (voice.update); deafened, incoming audio is dropped.
Errors
Section titled “Errors”The host refused or did not answer.
pub fn leave(self) -> Result<()>Leaves the channel (voice.leave) and closes every media connection.
Errors
Section titled “Errors”The host refused or did not answer; the media is closed either way.
Trait implementations
Section titled “Trait implementations”Drop