1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//! # oxicast
//!
//! Async Google Cast (Chromecast) client for Rust, built on [tokio](https://tokio.rs).
//!
//! Discover, connect to, and control Cast devices. Handles TLS, heartbeats,
//! reconnection, and request-response correlation automatically.
//!
//! ## Quick Start
//!
//! ```no_run
//! use oxicast::{CastClient, CastApp, MediaInfo};
//! use std::time::Duration;
//!
//! # async fn example() -> oxicast::Result<()> {
//! // Connect by IP (discovery is optional)
//! let client = CastClient::connect("192.168.1.100", 8009).await?;
//!
//! // Launch an app and play media
//! client.launch_app(&CastApp::DefaultMediaReceiver).await?;
//! client.load_media(
//! &MediaInfo::new("https://example.com/video.mp4", "video/mp4"),
//! true,
//! 0.0,
//! None, // custom_data for Custom Web Receiver
//! ).await?;
//!
//! // Control playback
//! client.pause().await?;
//! client.seek(60.0).await?;
//! client.play().await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Architecture
//!
//! Three background tokio tasks handle the Cast protocol:
//! - A **reader task** decodes inbound messages and dispatches them
//! - A **writer task** serializes outbound commands without blocking reads
//! - A **heartbeat task** sends PING and detects connection loss
//!
//! Commands respond instantly — they never wait for the next heartbeat cycle.
//!
//! ## Consuming status updates
//!
//! Two options — use whichever fits your architecture:
//!
//! - [`CastClient::next_event()`] — event stream in a `tokio::select!` loop.
//! Bounded channel; events are dropped (not blocked) if the buffer fills.
//! - [`CastClient::watch_media_status()`] / [`CastClient::watch_receiver_status()`]
//! — always-fresh latest state via `tokio::sync::watch`. No draining needed.
//!
//! ## Feature flags
//!
//! - **`discovery`** (default) — mDNS device scanning via [`discovery`] module
//! - **`serve`** — HTTP file server for casting local files via the `serve` module
pub
pub
pub
// Re-export test utilities for integration tests
pub use CastClient;
pub use ;
pub use CastEvent;
pub use ;