What is this?
A fully async Rust client for the Google Cast protocol (Chromecast, Google TV, Cast-enabled speakers). Connect by IP or discover devices via mDNS, launch apps, load media, control playback, and react to device events โ all through a clean async/await API built on tokio.
let client = connect.await?;
client.launch_app.await?;
client.load_media.await?;
client.pause.await?;
client.seek.await?;
client.play.await?;
๐ Quickstart
1. Install
[]
= "0.0.1"
= { = "1", = ["full"] }
2. Connect and play
use ;
use Duration;
async
Or connect directly by IP โ discovery is optional:
let client = connect.await?;
โจ Features
| Feature | Description |
|---|---|
| ๐ Async-native | Built on tokio โ full async/await, no blocking calls |
| ๐ Auto heartbeat | PING/PONG managed invisibly in the background |
| โก Instant commands | Separate reader/writer tasks โ commands never wait for the read loop |
| ๐ Reactive status | watch channels for always-fresh media and receiver state |
| ๐ Auto-reconnect | Exponential backoff with jitter, serialized with manual reconnect |
| ๐ mDNS discovery | Scan the network or stream devices as they appear |
| ๐ก๏ธ Typed errors | Structured enum for connection, protocol, and media failures |
| ๐งต Thread-safe | Clone + Send + Sync โ share across tasks freely |
| ๐ Local file casting | Built-in HTTP server serves files to Chromecast (opt-in serve feature) |
Feature flags
| Flag | Default | What it adds |
|---|---|---|
discovery |
โ | mDNS device scanning via mdns-sd |
serve |
โ | HTTP file server for casting local files |
# Disable discovery, enable local file serving
= { = "0.0.1", = false, = ["serve"] }
๐ Documentation
| Document | Description |
|---|---|
| Getting Started | Connect, discover, play media, handle events |
| API Overview | Full API surface with code examples |
| Architecture | Split-stream reactor, task lifecycle, reconnect, event delivery |
| Error Handling | Error enum, device errors, timeouts |
| CHANGELOG | Version history |
๐ Examples
| Example | What it does |
|---|---|
discover_and_play |
mDNS scan, connect, load HLS stream, monitor events |
media_control |
Pause, seek, volume, resume |
event_monitor |
Print all events in real-time |
custom_namespace |
Send/receive on custom namespaces |
device_test |
14-step integration test against real hardware |
# Run the device test (auto-discovers or pass IP)
# With protocol-level tracing
RUST_LOG=oxicast=trace
License
Licensed under either of Apache License 2.0 or MIT at your option.
Trademarks
Google Cast and Chromecast are trademarks of Google LLC. This project is not affiliated with or endorsed by Google.