https://github.com/flowingspdg/vmix-rs
vMix HTTP/TCP API Library for Rust language
https://github.com/flowingspdg/vmix-rs
rust vmix
Last synced: 22 days ago
JSON representation
vMix HTTP/TCP API Library for Rust language
- Host: GitHub
- URL: https://github.com/flowingspdg/vmix-rs
- Owner: FlowingSPDG
- License: mit
- Created: 2023-03-01T18:54:34.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-05T16:25:59.000Z (over 1 year ago)
- Last Synced: 2025-03-10T23:18:23.064Z (over 1 year ago)
- Topics: rust, vmix
- Language: Rust
- Homepage:
- Size: 28.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vmix-rs
A Rust library for interacting with vMix via TCP and HTTP APIs.
[](https://crates.io/crates/vmix-rs)
[](https://docs.rs/vmix-rs)
[](https://opensource.org/licenses/MIT)
## Features
This library is organized into separate crates for different use cases:
- **vmix-core**: Core data structures (XML parsing optional via `xml` feature)
- **vmix-tcp**: TCP API client
- **vmix-http**: HTTP API client (async)
- **vmix-rs**: Convenience wrapper (this crate)
## Installation
### Desktop Applications
```toml
[dependencies]
# Both TCP and HTTP support
vmix-rs = { version = "0.2.0", features = ["full"] }
# TCP only
vmix-rs = { version = "0.2.0", features = ["tcp"] }
# HTTP only
rs = { version = "0.2.0", features = ["http"] }
```
### WebAssembly
```toml
[dependencies]
# With XML parsing support
core = { version = "0.2.0", features = ["xml"] }
```
### Embedded Systems (no_std)
```toml
[dependencies]
# Struct definitions only (lightweight)
core = "0.2.0"
# With XML parsing (if needed)
core = { version = "0.2.0", features = ["xml"] }
```
## Usage
### Desktop Applications
```rust
use vmix_rs::{VmixApi, HttpVmixClient};
use std::time::Duration;
// TCP API
let client = VmixApi::new("127.0.0.1:8099".parse()?, Duration::from_secs(5))?;
// HTTP API
let http_client = HttpVmixClient::new("127.0.0.1:8088".parse()?, Duration::from_secs(5));
```
### WebAssembly
```rust
use vmix_core::{Vmix, from_str};
// Fetch XML from vMix via your HTTP client
// let xml = fetch_xml_from_vmix().await?;
// Parse XML to strongly-typed structures
let vmix_state: Vmix = from_str(&xml)?;
println!("Active input: {}", vmix_state.active);
```
### Embedded Systems (Embassy, etc.)
```rust
#![no_std]
extern crate alloc;
use vmix_core::Vmix;
// Option 1: Use struct definitions only
// Manually populate structs from TCP XMLTEXT commands
// Example: XMLTEXT vmix/active -> "1"
// Option 2: With XML parsing (requires 'xml' feature)
#[cfg(feature = "xml")]
use vmix_core::from_str;
#[cfg(feature = "xml")]
fn parse_vmix_xml(xml: &str) -> Result {
from_str(xml)
}
```
## Examples
```bash
# TCP client
cargo run --example cli --features tcp
# HTTP client
cargo run --example http_example --features http
# TCP/HTTP comparison
cargo run --example tcp_http_comparison --features full
```
## License
MIT
## Author
Shugo Kawamura ([@FlowingSPDG](https://github.com/FlowingSPDG))