Skip to content

Commit

Permalink
Update dependencies. Move rust_caster from a dedicated crate to an …
Browse files Browse the repository at this point in the history
…example. Bump version to 0.17.0.
  • Loading branch information
azasypkin committed Mar 20, 2022
1 parent 3c9bb50 commit 7e007ba
Show file tree
Hide file tree
Showing 12 changed files with 735 additions and 64 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ cache:

script:
- cargo build
- cargo build --examples
- cargo test
- cargo build --features thread_safe
- cargo build --features thread_safe --examples
- cargo test --features thread_safe

os:
Expand Down
25 changes: 15 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,27 @@ repository = "https://github.com/azasypkin/rust-cast"
readme = "README.md"
license = "MIT"
keywords = ["cast", "chromecast", "google"]
version = "0.16.0"
version = "0.17.0"
authors = ["Aleh Zasypkin <[email protected]>"]
categories = ["api-bindings", "hardware-support", "multimedia"]
edition = "2018"
edition = "2021"

[dependencies]
byteorder = "1.4.2"
log = "0.4.11"
openssl = "0.10.32"
protobuf = "=2.20.0"
serde = "1.0.118"
serde_derive = "1.0.118"
serde_json = "1.0.61"
byteorder = "1.4.3"
log = "0.4.14"
openssl = "0.10.38"
protobuf = "=2.27.1"
serde = "1.0.136"
serde_derive = "1.0.136"
serde_json = "1.0.79"

[dev-dependencies]
ansi_term = "0.12.1"
docopt = "1.1.1"
env_logger = "0.9.0"

[build-dependencies]
protoc-rust = "=2.20.0"
protoc-rust = "=2.27.1"

[features]
thread_safe = []
66 changes: 64 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

# Usage
* [Documentation](https://azasypkin.github.io/rust-cast/)
* Try out [Rust Caster](https://github.com/azasypkin/rust-caster) to see this crate in action!
* Try out [Rust Caster](./examples/rust_caster.rs) example to see this crate in action!

# Build

Proto files are taken from [Chromium GitHub mirror](https://github.com/chromium/chromium/tree/97ce436ecedbcd95f1375ab76d10682bef3171b0/components/cast_channel/proto).
Proto files are taken from [Chromium Open Screen GitHub mirror](https://chromium.googlesource.com/openscreen/+/8cce349b0a595ddf7178d5730e980ace3a1d1a53/cast/common/channel/proto).

By default `cargo build` won't try to generate Rust code from the files located at `protobuf/*`, if you want to do that
use `GENERATE_PROTO` environment variable during build and make sure you have `protoc` binary in `$PATH`:
Expand All @@ -15,6 +15,68 @@ use `GENERATE_PROTO` environment variable during build and make sure you have `p
$ GENERATE_PROTO=true cargo build
```

# Run example

## Generic features

First, you need to figure out the address of the device to connect to. For example, you can use `avahi` with the following command:
```bash
$ avahi-browse -a --resolve
```

```bash
// Get some info about the Google Cast enabled device (e.g. Chromecast).
$ cargo run --example rust_caster -- -a 192.168.0.100 -i

Number of apps run: 1
App#0: Default Media Receiver (CC1AD845)
Volume level: 1
Muted: false

// Run specific app on the Chromecast.
$ cargo run --example rust_caster -- -a 192.168.0.100 -r youtube

// Stop specific active app.
$ cargo run --example rust_caster -- -a 192.168.0.100 -s youtube

// Stop currently active app.
$ cargo run --example rust_caster -- -a 192.168.0.100 --stop-current

The following app has been stopped: Default Media Receiver (CC1AD845)
```

## Media features
```bash
// Stream a video.
$ cargo run --example rust_caster -- -a 192.168.0.100 -m http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4

// Stream a video of specific format with buffering.
$ cargo run --example rust_caster -- -a 192.168.0.100 -m http://xxx.webm --media-type video/webm --media-stream-type buffered

// Stream video from YouTube (doesn't work with the latest YouTube app, fix is welcome).
$ cargo run --example rust_caster -- -a 192.168.0.100 -m 7LcUOEP7Brc --media-app youtube
// Display an image.
$ cargo run --example rust_caster -- -a 192.168.0.100 -m https://azasypkin.github.io/style-my-image/images/mozilla.jpg
// Change volume level.
$ cargo run --example rust_caster -- -a 192.168.0.100 --media-volume 0.5
// Mute/unmute media.
$ cargo run --example rust_caster -- -a 192.168.0.100 --media-mute [--media-unmute]
// Pause media.
$ cargo run --example rust_caster -- -a 192.168.0.100 --media-app youtube --media-pause
// Resume/play media.
$ cargo run --example rust_caster -- -a 192.168.0.100 --media-app youtube --media-play
// Seek media.
$ cargo run --example rust_caster -- -a 192.168.0.100 --media-app youtube --media-seek 100
```
For all possible values of `--media-type` see [Supported Media for Google Cast](https://developers.google.com/cast/docs/media).
# DNS TXT Record description
* `md` - Model Name (e.g. "Chromecast");
Expand Down
3 changes: 3 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Examples

This folder contains numerous example showing how to use `rust-cast`.
Loading

0 comments on commit 7e007ba

Please sign in to comment.