Latest Threat Research:Malicious dYdX Packages Published to npm and PyPI After Maintainer Compromise.Details
Socket
Book a DemoInstallSign in
Socket

airplay-protocol

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

airplay-protocol

A low level protocol wrapper on top of the AirPlay HTTP API

Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
258
-20.12%
Maintainers
1
Weekly downloads
 
Created
Source

airplay-protocol

A low level protocol wrapper on top of the AirPlay HTTP API used to connect to an Apple TV.

Currently only the video API is implemented.

Build status js-standard-style

Installation

npm install airplay-protocol --save

Example Usage

var AirPlay = require('airplay-protocol')

var airplay = new AirPlay('apple-tv.local')

airplay.play('http://example.com/video.m4v', function (err) {
  if (err) throw err

  airplay.playbackInfo(function (err, res, body) {
    if (err) throw err
    console.log('Playback info:', body)
  })
})

API

new AirPlay(host[, port])

Initiate a connection to a specific AirPlay server given a host or IP address and a port. If no port is given, the default port 7000 is used.

Returns an instance of the AirPlay object.

var AirPlay = require('airplay-protocol')

var airplay = new AirPlay('192.168.0.42', 7000)

Event: state

function (state) {}

Emitted by the AirPlay server every time the state of the playback changes.

Possible states: loading, playing, paused or stopped.

airplay.serverInfo(callback)

Get the AirPlay server info.

Arguments:

  • callback - Will be called when the request have been processed by the AirPlay server. The first argument is an optional Error object. The second argument is an instance of http.IncomingMessage and the third argument is a parsed plist object containing the server info

airplay.play(url[, position][, callback])

Start video playback.

Arguments:

  • url - The URL to play
  • position (optional) - A floating point number between 0 and 1 where 0 represents the begining of the video and 1 the end. Defaults to 0
  • callback (optional) - Will be called when the request have been processed by the AirPlay server. The first argument is an optional Error object. The second argument is an instance of http.IncomingMessage

airplay.scrub(callback)

Retrieve the current playback position.

Arguments:

  • callback - Will be called when the request have been processed by the AirPlay server. The first argument is an optional Error object. The second argument is an instance of http.IncomingMessage and the third argument is the current playback position

airplay.scrub(position[, callback])

Seek to an arbitrary location in the video.

Arguments:

  • position - A float value representing the location in seconds
  • callback (optional) - Will be called when the request have been processed by the AirPlay server. The first argument is an optional Error object. The second argument is an instance of http.IncomingMessage

airplay.rate(speed[, callback])

Change the playback rate.

Arguments:

  • speed - A float value representing the playback rate: 0 is paused, 1 is playing at the normal speed
  • callback (optional) - Will be called when the request have been processed by the AirPlay server. The first argument is an optional Error object. The second argument is an instance of http.IncomingMessage

airplay.stop([callback])

Stop playback.

Arguments:

  • callback (optional) - Will be called when the request have been processed by the AirPlay server. The first argument is an optional Error object. The second argument is an instance of http.IncomingMessage

airplay.playbackInfo(callback)

Retrieve playback informations such as position, duration, rate, buffering status and more.

Arguments:

  • callback - Will be called when the request have been processed by the AirPlay server. The first argument is an optional Error object. The second argument is an instance of http.IncomingMessage and the third argument is a parsed plist object containing the playback info

airplay.property(name, callback)

Get playback property.

Arguments:

  • name - The name of the property to get
  • callback - Will be called when the request have been processed by the AirPlay server. The first argument is an optional Error object. The second argument is an instance of http.IncomingMessage and the third argument is a parsed plist object containing the property

airplay.property(name, value[, callback])

Set playback property.

Arguments:

  • name - The name of the property to set
  • value - The plist object to set
  • callback (optional) - Will be called when the request have been processed by the AirPlay server. The first argument is an optional Error object. The second argument is an instance of http.IncomingMessage

License

MIT

Keywords

airplay

FAQs

Package last updated on 18 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts