gcast 0.1.5

A library for using Google Cast devices
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
extern crate gcast;

use std::time::Duration;

/// Finds all Cast devices on the network and launches the YouTube app.
fn main() {
    let poll_duration = Duration::from_secs(10);

    let mut io = gcast::back::net::Io::new().unwrap();

    gcast::discovery::run(poll_duration, |device_info| {
        println!("found cast device on: {:#?} with UUID {}, launching YouTube",
                 device_info.ip_addr, device_info.uuid);

        let mut device = gcast::Device::connect(device_info, &mut io).unwrap();
        device.launch(gcast::apps::youtube()).unwrap();
    }).unwrap();
}