diff --git a/jarust_plugins/Cargo.toml b/jarust_plugins/Cargo.toml index c29fe53..100deea 100644 --- a/jarust_plugins/Cargo.toml +++ b/jarust_plugins/Cargo.toml @@ -28,6 +28,7 @@ default = ["echo_test", "audio_bridge", "video_room"] echo_test = [] audio_bridge = [] video_room = [] +__experimental = [] [dev-dependencies] anyhow = "1.0.79" diff --git a/jarust_plugins/examples/video_room.rs b/jarust_plugins/examples/video_room.rs index 2802b26..d2099ac 100644 --- a/jarust_plugins/examples/video_room.rs +++ b/jarust_plugins/examples/video_room.rs @@ -1,11 +1,14 @@ use jarust::jaconfig::JaConfig; use jarust::jaconfig::TransportType; -use jarust_transport::japrotocol::{EstablishmentProtocol, Jsep, JsepType}; use jarust::jaconnection::CreateConnectionParams; use jarust::TransactionGenerationStrategy; use jarust_plugins::video_room::jahandle_ext::VideoRoom; use jarust_plugins::video_room::msg_options::*; -use jarust_plugins::{AttachPluginParams, Identifier}; +use jarust_plugins::AttachPluginParams; +use jarust_plugins::Identifier; +use jarust_transport::japrotocol::EstablishmentProtocol; +use jarust_transport::japrotocol::Jsep; +use jarust_transport::japrotocol::JsepType; use std::path::Path; use tracing_subscriber::EnvFilter; @@ -39,7 +42,7 @@ async fn main() -> anyhow::Result<()> { .attach_video_room(AttachPluginParams { capacity, timeout }) .await?; - let event_logger = tokio::spawn(async move { + tokio::spawn(async move { while let Some(e) = events.recv().await { tracing::info!("{e:#?}"); } @@ -62,18 +65,8 @@ async fn main() -> anyhow::Result<()> { .edit_room( room_id.clone(), VideoRoomEditOptions { - secret: None, new_description: Some("A brand new description!".to_string()), - new_secret: None, - new_pin: None, - new_is_private: None, - new_require_pvtid: None, - new_bitrate: None, - new_fir_freq: None, - new_publishers: None, - new_lock_record: None, - new_rec_dir: None, - permanent: None, + ..Default::default() }, timeout, ) @@ -152,14 +145,11 @@ async fn main() -> anyhow::Result<()> { videocodec: Some("h264".to_string()), bitrate: Some(3500), record: Some(false), - filename: None, - display: None, - audio_level_average: None, - audio_active_packets: None, descriptions: vec![VideoRoomPublishDescription { mid: "stream-0".to_string(), description: "The ultimate stream!!".to_string(), }], + ..Default::default() }, timeout, ) diff --git a/jarust_plugins/src/audio_bridge/msg_opitons.rs b/jarust_plugins/src/audio_bridge/msg_opitons.rs index 493d698..320b67d 100644 --- a/jarust_plugins/src/audio_bridge/msg_opitons.rs +++ b/jarust_plugins/src/audio_bridge/msg_opitons.rs @@ -2,9 +2,9 @@ use crate::Identifier; use serde::Serialize; tryfrom_serde_value!( - ChangeRoomOptions EditRoomOptions DestroyRoomMsg JoinRoomOptions + CreateRoomOptions EditRoomOptions DestroyRoomMsg JoinRoomOptions AllowedOptions AllowAction ConfigureOptions MuteOptions MuteRoomOptions - KickOptions KickAllOptions CreateRoomOptions + KickOptions KickAllOptions ChangeRoomOptions ); #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Default, Serialize)] diff --git a/jarust_plugins/src/video_room/events.rs b/jarust_plugins/src/video_room/events.rs index 204c46c..55f2be8 100644 --- a/jarust_plugins/src/video_room/events.rs +++ b/jarust_plugins/src/video_room/events.rs @@ -1,11 +1,15 @@ -use crate::video_room::responses::{AttachedStream, Attendee, ConfiguredStream, Publisher}; +use crate::video_room::responses::AttachedStream; +use crate::video_room::responses::Attendee; +use crate::video_room::responses::ConfiguredStream; +use crate::video_room::responses::Publisher; use crate::Identifier; use jarust::error::JaError; use jarust::prelude::JaResponse; use jarust_transport::error::JaTransportError; -use jarust_transport::japrotocol::{ - EstablishmentProtocol, GenericEvent, JaHandleEvent, ResponseType, -}; +use jarust_transport::japrotocol::EstablishmentProtocol; +use jarust_transport::japrotocol::GenericEvent; +use jarust_transport::japrotocol::JaHandleEvent; +use jarust_transport::japrotocol::ResponseType; use serde::Deserialize; use serde_json::from_value; diff --git a/jarust_plugins/src/video_room/handle.rs b/jarust_plugins/src/video_room/handle.rs index 669b598..22b1765 100644 --- a/jarust_plugins/src/video_room/handle.rs +++ b/jarust_plugins/src/video_room/handle.rs @@ -1,15 +1,12 @@ -use std::ops::Deref; -use std::time::Duration; - -use serde_json::json; - -use jarust::prelude::*; -use jarust_rt::JaTask; -use jarust_transport::japrotocol::EstablishmentProtocol; - use crate::video_room::msg_options::*; use crate::video_room::responses::*; use crate::Identifier; +use jarust::prelude::*; +use jarust_rt::JaTask; +use jarust_transport::japrotocol::EstablishmentProtocol; +use serde_json::json; +use std::ops::Deref; +use std::time::Duration; pub struct VideoRoomHandle { handle: JaHandle, @@ -148,6 +145,7 @@ impl VideoRoomHandle { self.handle.send_waiton_rsp::<()>(message, timeout).await } + #[cfg(feature = "__experimental")] pub async fn moderate( &self, room: Identifier, @@ -194,6 +192,7 @@ impl VideoRoomHandle { .await } + #[cfg(feature = "__experimental")] pub async fn list_forwarders( &self, room: Identifier, @@ -209,6 +208,7 @@ impl VideoRoomHandle { .await } + #[cfg(feature = "__experimental")] pub async fn rtp_forward( &self, room: Identifier, @@ -224,6 +224,7 @@ impl VideoRoomHandle { .await } + #[cfg(feature = "__experimental")] pub async fn stop_rtp_forward( &self, room: Identifier, @@ -352,7 +353,7 @@ impl VideoRoomHandle { Ok(()) } - /// A combination of [join_as_publisher()] and [configure_publisher()] + /// A combination of [VideoRoomHandle::join_as_publisher()] and [VideoRoomHandle::configure_publisher()] pub async fn join_and_configure( &self, join_options: VideoRoomPublisherJoinOptions, @@ -447,6 +448,7 @@ impl VideoRoomHandle { Ok(()) } + #[cfg(feature = "__experimental")] pub async fn update( &self, subscribe: Vec, @@ -464,6 +466,7 @@ impl VideoRoomHandle { Ok(()) } + #[cfg(feature = "__experimental")] pub async fn pause(&self, timeout: Duration) -> JaResult<()> { self.handle .send_waiton_ack(json!({"request": "pause"}), timeout) @@ -471,6 +474,7 @@ impl VideoRoomHandle { Ok(()) } + #[cfg(feature = "__experimental")] pub async fn switch( &self, streams: Vec, diff --git a/jarust_plugins/src/video_room/jahandle_ext.rs b/jarust_plugins/src/video_room/jahandle_ext.rs index 6ee128c..f2ea4bf 100644 --- a/jarust_plugins/src/video_room/jahandle_ext.rs +++ b/jarust_plugins/src/video_room/jahandle_ext.rs @@ -1,14 +1,10 @@ -use std::ops::Deref; - -use jarust::japlugin::AttachHandleParams; -use tokio::sync::mpsc; - -use jarust::prelude::*; - -use crate::AttachPluginParams; - use super::events::PluginEvent; use super::handle::VideoRoomHandle; +use crate::AttachPluginParams; +use jarust::japlugin::AttachHandleParams; +use jarust::prelude::*; +use std::ops::Deref; +use tokio::sync::mpsc; #[async_trait::async_trait] pub trait VideoRoom: Attach { diff --git a/jarust_plugins/src/video_room/msg_options.rs b/jarust_plugins/src/video_room/msg_options.rs index 23b11ce..3af4467 100644 --- a/jarust_plugins/src/video_room/msg_options.rs +++ b/jarust_plugins/src/video_room/msg_options.rs @@ -1,6 +1,5 @@ -use serde::Serialize; - use crate::Identifier; +use serde::Serialize; // // Create Message diff --git a/jarust_plugins/src/video_room/responses.rs b/jarust_plugins/src/video_room/responses.rs index b537cdc..351023c 100644 --- a/jarust_plugins/src/video_room/responses.rs +++ b/jarust_plugins/src/video_room/responses.rs @@ -1,6 +1,5 @@ -use serde::Deserialize; - use crate::Identifier; +use serde::Deserialize; #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Deserialize)] pub struct Room {