# airplay2

> Apple AirPlay client library for AppleTV

Latest version **0.1.8** (published 2015-06-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install airplay2
pnpm add airplay2
yarn add airplay2
bun add airplay2
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.8 |
| Published | 2015-06-30 |
| First published | 2014-01-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 96 |
| Author | zfkun |
| Maintainers | zfkun |
| Keywords | apple, mac, media, airplay, hls, ffmpeg |

## Links

- npm: https://www.npmjs.com/package/airplay2
- Repository: https://github.com/zfkun/node-airplay
- Homepage: https://github.com/zfkun/node-airplay#readme
- Issues: https://github.com/zfkun/node-airplay/issues
- npm.io page: https://npm.io/package/airplay2

## Dependencies (2)

- [mdns](https://npm.io/package/mdns.md) https://github.com/zfkun/node_mdns/tarball/master
- [plist](https://npm.io/package/plist.md) ~1.1.0

## Recent versions

- 0.1.8 (latest) — 2015-06-30
- 0.1.7 — 2015-06-30
- 0.1.4 — 2014-05-03
- 0.1.3 — 2014-01-02
- 0.1.2 — 2014-01-02

## README

node-airplay
=================

[![NPM](https://nodei.co/npm/airplay2.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/airplay2/)

[![npm version](https://badge.fury.io/js/airplay2.svg)](http://badge.fury.io/js/airplay2)
[![Dependency Status](https://david-dm.org/zfkun/node-airplay.svg)](https://david-dm.org/zfkun/node-airplay)


node-airplay is a client library for Apple's AirPlay remote playback protocol.

***some code full reference [node-airplay](https://github.com/benvanik/node-airplay), thanks!***


## Installation

From npm:

	npm install airplay2

From bower:

    bower install airplay

From source:

	git clone https://github.com/zfkun/node-airplay.git
	npm link

## Dependencies

+ [node-plist](https://github.com/TooTallNate/node-plist)

	- had merge my fix, see my [pull-request](https://github.com/TooTallNate/node-plist/pull/42)

 
+ [node_mdns](https://github.com/zfkun/node_mdns)

	- It's my fork, hack an error `no such record`
	- Unfortunately the original [`node_mdns`](https://github.com/agnat/node_mdns) is woefully out of date and has required many tweaks to get working
	
+ [ffmpeg](http://trac.ffmpeg.org/wiki/MacOSXCompilationGuide#Shortcut:CompileFFmpegthroughHomebrew)

	brew install ffmpeg

	


## Usage

``` javascript
// remote video
var browser = require('airplay2').createBrowser();
browser.on('deviceOn', function(device) {
    device.play('http://remotehost/video.mp4', 0, function() {
        console.info('video playing...');
    });
});
browser.start();
```

``` javascript
// local video (by HLS)
var hls = require('airplay2').createHLS();
hls.start(7001);
hls.open('/Users/zfkun/videos/1.mkv', function(info) {
    console.info('video opened: ', info);
});

var browser = require('airplay2').createBrowser();
browser.on('deviceOn', function(device) {
    device.play(hls.getURI(), 0, function() {
        console.info('video playing...');
    });
});
browser.start();
```


## Help

+ [Unofficial AirPlay Protocol Specification](http://nto.github.io/AirPlay.html)
+ [HLS(HTTP Live Streaming)](http://tools.ietf.org/html/draft-pantos-http-live-streaming-12)
+ [ffmpeg build for ios](http://www.cocoachina.com/bbs/read.php?tid=142628&page=1)
+ [ffmpeg build for MacOS](http://trac.ffmpeg.org/wiki/MacOSXCompilationGuide#Shortcut:CompileFFmpegthroughHomebrew)
+ [mdns User Guide](http://agnat.github.io/node_mdns/user_guide.html)



## API

+ [Browser](https://github.com/zfkun/node-airplay/wiki/Browser-API)
+ [Device](https://github.com/zfkun/node-airplay/wiki/Device-API)
+ [Client](https://github.com/zfkun/node-airplay/wiki/Client-API)
+ [HLS](https://github.com/zfkun/node-airplay/wiki/HLS-API)



## Todo

+ 多码率切换
+ 外挂字幕

---
_Source: https://npm.io/package/airplay2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
