Fix voice_simple example

This commit is contained in:
kozabrada123 2024-07-25 11:27:30 +02:00
parent feb2b1b64c
commit 539460a552
2 changed files with 2153 additions and 7 deletions

2148
examples/voice_simple/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -22,11 +22,9 @@ use simplelog::{TermLogger, Config, WriteLogger};
use std::{net::SocketAddrV4, sync::Arc, fs::File, time::Duration}; use std::{net::SocketAddrV4, sync::Arc, fs::File, time::Duration};
use chorus::{ use chorus::{
gateway::{Observer, Gateway}, gateway::{Gateway, GatewayOptions, Observer},
types::{ types::{
GatewayReady, SelectProtocol, SelectProtocolData, SessionDescription, Snowflake, Speaking, GatewayIdentifyPayload, GatewayReady, SelectProtocol, SelectProtocolData, SessionDescription, Snowflake, Speaking, SpeakingBitflags, SsrcDefinition, UpdateVoiceState, VoiceEncryptionMode, VoiceIdentify, VoiceProtocol, VoiceReady, VoiceServerUpdate
SpeakingBitflags, SsrcDefinition, VoiceEncryptionMode, VoiceIdentify, VoiceProtocol,
VoiceReady, VoiceServerUpdate, GatewayIdentifyPayload, UpdateVoiceState,
}, },
voice::{ voice::{
gateway::{VoiceGateway, VoiceGatewayHandle}, gateway::{VoiceGateway, VoiceGatewayHandle},
@ -219,7 +217,7 @@ impl Observer<Speaking> for VoiceHandler {
println!( println!(
"Received Speaking! (SRRC: {}, flags: {:?})", "Received Speaking! (SRRC: {}, flags: {:?})",
data.ssrc, data.ssrc,
SpeakingBitflags::from_bits(data.speaking).unwrap() SpeakingBitflags::from_bits(data.speaking.into()).unwrap()
); );
} }
} }
@ -253,7 +251,7 @@ async fn main() {
]) ])
.unwrap(); .unwrap();
let gateway = Gateway::spawn(GATEWAY_URL.to_string()) let gateway = Gateway::spawn(GATEWAY_URL.to_string(), GatewayOptions::default())
.await .await
.unwrap(); .unwrap();