Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Airplay bindings to Ruby
tree: bd0e9636f1

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
lib
test
.gitignore
.travis.yml
Gemfile
README.md
Rakefile
airplay.gemspec

README.md

Airplay

Travis

Ruby Airplay

A client (and someday a server) of the superfancy http content stream technique that Apple uses in its products.

Now supports any Airplay-compatible device, like Airserver

You can try this in an AppleTV for instance.

IMPORTANT!

Since iOS 5 there are some changes in the API so to keep playing something (like a video) you must keep the client alive!

Basic Usage

require 'airplay'

airplay = Airplay::Client.new
# To send an image
airplay.send_image("fancy_pants.jpg")

# To stream a video
airplay.send_video("http://www.yo-yo.org/mp4/yu2.mp4")

Sending images

require 'airplay'

airplay = Airplay::Client.new

airplay.send_image("fancy_pants.jpg")
airplay.send_image(File.open("/home/userman/Pictures/fancy_pants.jpg"))
airplay.send_image("http://mine.icanhascheezburger.com/completestore/Wezinyercupz128401525895963750.jpg")

Transitions

require 'airplay'

airplay = Airplay::Client.new

airplay.send_image("fancy_pants.jpg", :dissolve)
airplay.send_image("fancy_pants.jpg", :slide_left)
airplay.send_image("fancy_pants.jpg", :slide_right)

Scrub

require 'airplay'

airplay = Airplay::Client.new
airplay.scrub
# {:duration => 189, :position => 50}
airplay.scrub(30) # Media goes to 30s
airplay.scrub("10%") # Media goes to the 10% of its duration

Password Authentication

require 'airplay'

airplay = Airplay::Client.new
airplay.use "Apple TV"
airplay.password "password"

airplay.send_image("lolcatz.jpg")

Player

require 'airplay'

airplay = Airplay::Client.new
player = airplay.send_video("http://www.yo-yo.org/mp4/yu2.mp4")
player.pause
player.resume
player.scrub
# {:duration => 189, :position => 50}
player.scrub("50%") # Go to the half of the media
player.stop

Useful methods

require 'airplay'

airplay = Airplay::Client.new
airplay.browse
#=> [#<Airplay::Node:0x007fbb5a83eb28 @name="elCuervo", @domain="local.", @ip="10.1.0.63">, #<Airplay::Node:0x007fbb5a83b0b8 @name="Apple TV", @domain="local.", @ip="10.1.0.220">]
airplay.use "elCuervo"
airplay.use "Apple TV"

Contributors

Thanks to all the contributors:

  • File handler support when sending an image. By pote
Something went wrong with that request. Please try again.