pub struct VoiceSession { /* private fields */ }Expand description
One stay in a voice channel. Dropping it leaves the channel.
Implementations§
Source§impl VoiceSession
impl VoiceSession
Sourcepub const fn voice_session(&self) -> VoiceSessionId
pub const fn voice_session(&self) -> VoiceSessionId
This stay’s voice session, as the host named it.
Sourcepub fn send_audio(&self, frame: &[u8])
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.
Sourcepub fn subscribe(&self, player: &AudioPlayer)
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.
Sourcepub fn unsubscribe(&self, player: &AudioPlayer)
pub fn unsubscribe(&self, player: &AudioPlayer)
Stops sending what player plays.
Sourcepub fn frames_refused(&self) -> u64
pub fn frames_refused(&self) -> u64
How 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.
Sourcepub fn can_send(&self) -> bool
pub fn can_send(&self) -> bool
Whether frames given to send_audio are sent now.
Sourcepub fn next_event(&self, timeout: Duration) -> Option<VoiceEvent>
pub fn next_event(&self, timeout: Duration) -> Option<VoiceEvent>
The next event, or None when none arrives within timeout or the session ended.
Sourcepub fn events(&self) -> impl Iterator<Item = VoiceEvent> + Send + 'static
pub fn events(&self) -> impl Iterator<Item = VoiceEvent> + Send + 'static
The events, blocking; ends with the session.