Fork of obws that supports a slightly older obs-websocket
Go to file
2021-02-15 20:39:26 +09:00
.github Rename to the "Check" job to "Feature check" 2021-01-10 02:11:17 +09:00
examples Upgrade to obs-websocket 4.9.0 API 2021-02-15 20:39:26 +09:00
src Upgrade to obs-websocket 4.9.0 API 2021-02-15 20:39:26 +09:00
tests Upgrade to obs-websocket 4.9.0 API 2021-02-15 20:39:26 +09:00
.editorconfig Check all feature combinations in the CI 2021-01-10 02:04:25 +09:00
.gitignore Ignore code coverage files 2020-12-31 15:33:52 +09:00
Cargo.toml Upgrade to obs-websocket 4.9.0 API 2021-02-15 20:39:26 +09:00
CHANGELOG.md Bump up version number to 0.4.0 2021-01-22 13:14:35 +09:00
Justfile Use just for easy running of integration tests 2020-12-31 15:34:31 +09:00
LICENSE Initial commit 2020-12-27 22:52:56 +09:00
README.md Bump up version number to 0.4.0 2021-01-22 13:14:35 +09:00
release.toml Add a changelog 2021-01-11 17:42:17 +09:00

OBWS - The obws (obvious) remote control library for OBS

Build Status Repository Documentation Code Coverage

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 = "0.4.0"

In addition, you will need to use the tokio runtime (currently v0.3.x), 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).await?;

    /// Get and print out version information of OBS and obs-websocket.
    let version = client.general().get_version().await?;
    println!("{:#?}", version);

    /// Optionally log-in (if enabled in obs-websocket) to allow other APIs and receive events.
    client.login(Some("password")).await?;

    /// 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).