GithubHelp home page GithubHelp logo

airplay's Introduction

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
  • Persistent connections debugging. By sodabrew

airplay's People

Contributors

elcuervo avatar pote avatar sodabrew avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.