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.
654bba1009 | 3 years ago | |
---|---|---|
.config | 3 years ago | |
.github | 3 years ago | |
examples | 3 years ago | |
src | 3 years ago | |
tests | 3 years ago | |
.editorconfig | 4 years ago | |
.gitignore | 3 years ago | |
CHANGELOG.md | 3 years ago | |
Cargo.toml | 3 years ago | |
Justfile | 3 years ago | |
LICENSE | 4 years ago | |
README.md | 3 years ago | |
deny.toml | 3 years ago | |
release.toml | 4 years ago | |
rustfmt.toml | 3 years ago |
README.md
OBWS - The obws (obvious) remote control library for OBS
Remote control OBS with the obs-websocket plugin from Rust 🦀.
Usage
Add obws
to your project with cargo add obws
(needs cargo-edit) or add it manually to your
Cargo.toml
:
[dependencies]
obws = { git = "https://github.com/dnaka91/obws.git", branch = "v5-api" }
In addition, you will need to use the latest tokio runtime to use this library as it makes heavy use of async/await and is bound to this runtime.
Example
Here we connect to a OBS instance, get some version information and log in to access the whole API and lastly print out a list of available scenes.
For more usage instructions see the docs or check out the examples.
use anyhow::Result;
use obws::Client;
#[tokio::main]
async fn main() -> Result<()> {
/// Connect to the OBS instance through obs-websocket.
let client = Client::connect("localhost", 4444, Some("password")).await?;
/// Get and print out version information of OBS and obs-websocket.
let version = client.general().get_version().await?;
println!("{:#?}", version);
/// Get a list of available scenes and print them out.
let scene_list = client.scenes().get_scene_list().await?;
println!("{:#?}", scene_list);
Ok(())
}
License
This project is licensed under MIT License (or http://opensource.org/licenses/MIT).