diff --git a/Cargo.toml b/Cargo.toml index ce87394..ae57d07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ default = ["client", "rt-multi-thread"] backend = ["dep:poem", "dep:sqlx"] rt-multi-thread = ["tokio/rt-multi-thread"] rt = ["tokio/rt"] -client = ["voice"] +client = [] voice = ["dep:discortp", "dep:crypto_secretbox"] [dependencies] diff --git a/src/lib.rs b/src/lib.rs index 0bddc3a..1fd125c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -128,7 +128,7 @@ pub mod instance; #[cfg(feature = "client")] pub mod ratelimiter; pub mod types; -#[cfg(feature = "client")] +#[cfg(all(feature = "client", feature = "voice"))] pub mod voice; #[derive(Clone, Default, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] diff --git a/src/voice/udp/backends/mod.rs b/src/voice/udp/backends/mod.rs index 521d085..bbf8d9a 100644 --- a/src/voice/udp/backends/mod.rs +++ b/src/voice/udp/backends/mod.rs @@ -1,19 +1,12 @@ -#[cfg(all(not(target_arch = "wasm32"), feature = "client"))] +#[cfg(all(not(target_arch = "wasm32"), feature = "voice"))] pub mod tokio; -#[cfg(all(not(target_arch = "wasm32"), feature = "client"))] +#[cfg(all(not(target_arch = "wasm32"), feature = "voice"))] pub use tokio::*; -#[cfg(all(target_arch = "wasm32", feature = "client"))] -pub mod wasm; -#[cfg(all(target_arch = "wasm32", feature = "client"))] -pub use wasm::*; - -#[cfg(all(not(target_arch = "wasm32"), feature = "client"))] +#[cfg(all(not(target_arch = "wasm32"), feature = "voice"))] pub type UdpSocket = tokio::TokioSocket; -#[cfg(all(not(target_arch = "wasm32"), feature = "client"))] +#[cfg(all(not(target_arch = "wasm32"), feature = "voice"))] pub type UdpBackend = tokio::TokioBackend; -#[cfg(all(target_arch = "wasm32", feature = "client"))] -pub type UdpSocket = wasm::WasmSocket; -#[cfg(all(target_arch = "wasm32", feature = "client"))] -pub type UdpBackend = wasm::WasmBackend; +#[cfg(target_arch = "wasm32")] +compile_error!("UDP Voice support is not (and will likely never be) supported for WASM. This is because UDP cannot be used in the browser. We are however looking into Webrtc for WASM voice support."); diff --git a/src/voice/udp/backends/wasm.rs b/src/voice/udp/backends/wasm.rs deleted file mode 100644 index 502987b..0000000 --- a/src/voice/udp/backends/wasm.rs +++ /dev/null @@ -1,13 +0,0 @@ -use std::net::SocketAddr; - -// TODO: Add wasm websockets -compile_error!("Udp voice support is not implemented yet for wasm."); - -#[derive(Debug, Clone)] -pub struct WasmBackend; - -pub type WasmSocket; - -impl WasmBackend { - pub async fn connect(url: SocketAddr) -> Result {} -}