mirror of https://github.com/dnaka91/obws
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
Rust
36 lines
1.1 KiB
Rust
use super::Client;
|
|
use crate::requests::RequestType;
|
|
use crate::responses;
|
|
use crate::Result;
|
|
|
|
/// API functions related to the virtual cam.
|
|
pub struct VirtualCam<'a> {
|
|
pub(super) client: &'a Client,
|
|
}
|
|
|
|
impl<'a> VirtualCam<'a> {
|
|
/// Get current virtual cam status.
|
|
pub async fn get_virtual_cam_status(&self) -> Result<responses::VirtualCamStatus> {
|
|
self.client
|
|
.send_message(RequestType::GetVirtualCamStatus)
|
|
.await
|
|
}
|
|
|
|
/// Toggle virtual cam on or off (depending on the current virtual cam state).
|
|
pub async fn start_stop_virtual_cam(&self) -> Result<()> {
|
|
self.client
|
|
.send_message(RequestType::StartStopVirtualCam)
|
|
.await
|
|
}
|
|
|
|
/// Start virtual cam. Will return an `error` if virtual cam is already active.
|
|
pub async fn start_virtual_cam(&self) -> Result<()> {
|
|
self.client.send_message(RequestType::StartVirtualCam).await
|
|
}
|
|
|
|
/// Stop virtual cam. Will return an error if virtual cam is not active.
|
|
pub async fn stop_virtual_cam(&self) -> Result<()> {
|
|
self.client.send_message(RequestType::StopVirtualCam).await
|
|
}
|
|
}
|