• Stars
    star
    1,071
  • Rank 43,174 (Top 0.9 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 13 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Airplay bindings to Ruby

Airplay

Code Climate Build Status

Airplay

Airplay attempts to be compatible with the latest AppleTV firmware but I'd like to add compatibility to other servers.

Contribute

You can contribute with code, bugs or feature requests.

The development of the gem takes time and there's a lot of research and hardware tests to make all of this. If you want to contribute please consider donating as much as you want in: Paypal or Gumroad

Table of Contents

Installation

Library

gem install airplay

CLI

gem install airplay-cli

Usage

CLI

View devices

air list

air list

* Apple TV (AppleTV2,1 running 11A502)
  ip: 192.168.1.12
  resolution: 1280x720

Play a video

air play [url to video or local file]

air play

Playing http://movietrailers.apple.com/movies/universal/rush/rush-tlr3_480p.mov?width=848&height=352
Time: 00:00:13 [=====                                              ] 7% Apple TV

Show images

air view [url to image or image folder]

Library

Configuration

Airplay.configure do |config|
  config.log_level      # Log4r levels (Default: Log4r::ERROR)
  config.autodiscover   # Allows to search for nodes (Default: true)
  config.host           # In which host to bind the server (Default: 0.0.0.0)
  config.port           # In which port to bind the server (Default: will find one)
  config.output         # Where to log (Default: Log4r::Outputter.stdout)
end

Devices

require "airplay"

Airplay.devices.each do |device|
  puts device.name
end

Accessing and Grouping

# You can access a known device easily
device = Airplay["Apple TV"]

# And add the password of the device if needed
device.password = "my super secret password"

# Or you can group known devices to have them do a given action together
Airplay.group["Backyard"] << Airplay["Apple TV"]
Airplay.group["Backyard"] << Airplay["Room TV"]

# The groups can later do some actions like:
Airplay.group["Backyard"].play("video")

Images

require "airplay"

apple_tv = Airplay["Apple TV"]

# You can send local files
apple_tv.view("my_image.png")

# Or use remote files
apple_tv.view("https://github.com/elcuervo/airplay/raw/master/doc/img/logo.png")

# And define a transition
apple_tv.view("url_to_the_image", transition: "Dissolve")

# View all transitions
apple_tv.transitions

Video

require "airplay"

apple_tv = Airplay["Apple TV"]
trailer = "http://movietrailers.apple.com/movies/dreamworks/needforspeed/needforspeed-tlr1xxzzs2_480p.mov"

player = apple_tv.play(trailer)
Playlist
# You can also add videos to a playlist and let the library handle them
player.playlist << "video_url"
player.playlist << "video_path"
player.play

# Or control it yourself
player.next
player.previous

# Or if you prefer you can have several playlists
player = apple_tv.player
player.playlists["Star Wars Classic"] << "Star Wars Episode IV: A New Hope"
player.playlists["Star Wars Classic"] << "Star Wars Episode V: The Empire Strikes Back"
player.playlists["Star Wars Classic"] << "Star Wars Episode VI: Return of the Jedi"

player.playlists["Star Wars"] << "Star Wars Episode I: The Phantom Menace"
player.playlists["Star Wars"] << "Star Wars Episode II: Attack of the Clones"
player.playlists["Star Wars"] << "Star Wars Episode III: Revenge of the Sith"

player.use("Star Wars Classic")
player.play
player.wait
Player
# Wait until the video is finished
player.wait

# Actions
player.pause
player.resume
player.stop
player.scrub
player.info
player.seek

# Access the playback time per second
player.progress -> progress {
  puts "I'm viewing #{progress.position} of #{progress.duration}"
}

Testing

Now there are two types of tests: Regular unit tests and integration tests. Thanks to the magic of the internet and a raspberry pi there are integration tests with a real Apple TV that is currently accessible.

Block TV

The Apple TV is password protected to avoid issues with the tests but is configured in Travis CI. For that reason you won't be able to run those tests if you don't have an Apple TV.

Run unit tests with: rake test:unit and integration ones with: rake test:integration You can run all of them together with: rake test:all

Documentation

All the documentation of the README can be found in the doc folder. To generate an updated README based on the contents of doc please use rake doc:generate

Contributors

Last but not least a special thanks to all the contributors

More Repositories

1

minuteman

Fast analytics using Redis
Ruby
629
star
2

tangalanga

Tangalanga: the Zoom conference scanner hacking tool
Go
285
star
3

vcr.js

VCR for javascript
JavaScript
152
star
4

lodis

LOcal Dictionary Server
CoffeeScript
115
star
5

minuteman-rails

Use Minuteman easily in your Rails app
Ruby
64
star
6

gerbil

Gerbil: Inquisitive, friendly animals that rarely bite, TDD for the rest of us
JavaScript
59
star
7

minimalweather

Minimal Weather
JavaScript
30
star
8

cuba-sugar

Give cuba some sugar!
Ruby
20
star
9

shibe

The microframework for Doges
Ruby
15
star
10

dashcat

DashCat - The GitHub viewer
Objective-C
12
star
11

random-octocat

Get a random octocat app
Ruby
12
star
12

picomachine

PicoMachine: minimal finite state machine
JavaScript
11
star
13

flag

Simple feature flags
Ruby
11
star
14

smoking

Simple Mocking and Stubbing for javascript
JavaScript
10
star
15

net-http-pool

Persistent HTTP connection pool
Ruby
9
star
16

shoden

The elephant god
Ruby
8
star
17

minimail

The minimal desktop mail client
JavaScript
7
star
18

nginx_http_redis

Mirror from wiki.nginx.org
C
7
star
19

pythomnic3k

Mirror from sourceforge
Python
7
star
20

net-ptth

Reverse HTTP ruby client
Ruby
7
star
21

phonetap

PhoneTap: give all the PhoneTap js methods to do some testing or develop outside the simulator
CoffeeScript
6
star
22

whereisfoca.com

HTML
6
star
23

backbone-atlas

Backbone compatible json to models converter
JavaScript
5
star
24

coworking-law

5
star
25

limelight_video

Limelight video platform ruby client
Ruby
5
star
26

firma

Adds a secure signature to pdf
Ruby
5
star
27

rpm

Shell
4
star
28

GenUy

Proyecto de búsqueda de personas uruguayas
4
star
29

hugware.org

Less hate, more hugs
JavaScript
3
star
30

proof_of_work

A Hashcash algorithm implementation
Ruby
3
star
31

timelapsy

JavaScript
3
star
32

elcuervo.co

Home Page
CSS
3
star
33

cachoo

Ruby
2
star
34

AMD-Backbone-Gerbil-JSDom

Full integration example
JavaScript
2
star
35

hubot-consul-brain

JavaScript
2
star
36

net-http-auth-hmac

Signs Net::HTTP requests
Ruby
2
star
37

macos

Nix
2
star
38

spikefish

Go
2
star
39

twitcher

Twitcher. The ticker with update
Go
2
star
40

wire

HTML5 workers without a separate file
JavaScript
2
star
41

dry-types-json-schema

Ruby
2
star
42

gadget

DNS Docker inspector
Go
2
star
43

geocoder

Go
1
star
44

internationalrubyband.com

1
star
45

pydayuy2011

slides del python day uy 2011
1
star
46

dotfiles-old

Vim Script
1
star
47

spirit

Ruby
1
star
48

cisco_decrypt

Decrypt cisco encrypted passwords
C
1
star
49

dash.cat

The DashCat website
Ruby
1
star
50

dockerfiles

Makefile
1
star
51

machina

Ruby
1
star
52

rubyconfar-2011

JavaScript
1
star
53

phreak

PhoneGap wrapper
JavaScript
1
star
54

ph

Ruby
1
star
55

nixos

Nix
1
star
56

dashcat-test-repo

1
star
57

bankrupt

Ruby
1
star
58

gpm-link

gpm link plugin
Shell
1
star
59

ohm-find_by

find_by to Ohm::Model
Ruby
1
star
60

mobility_bug

Ruby
1
star
61

rest_ejabberd

Ruby interface for ejabberd's mod_restful
Ruby
1
star
62

pythomnic3k-sample-webserver

Python
1
star