noelhibbard / node-airplayhub

AirPlay server which accepts streams and then streams the audio back out to multiple AirPlay devices with sync support.
51 stars 12 forks source link
airplay airplay-proxy multiroom

Description

node-airplayhub is an AirPlay server which accepts streams (using nodetunes) and then streams the audio back out to multiple AirPlay devices with sync support (using node_airtunes).

Installation

1. Pre Reqs

To install this package you will need to install these packages first:

$ apt-get install -y build-essential git libavahi-compat-libdnssd-dev nodejs npm nodejs-legacy

2. Install

$ npm i -g git+https://github.com/noelhibbard/node-airplayhub

3. Config file

The first time you launch node-airplayhub it will generate a config file and automatically populate it with all the AirPlay targets that are advertizing on your network. The default location is ./config.json. If you want to spesify a different location, use the -c or --config option. Here is what the config file looks like:

{
    "servername": "[AirPlay Hub]",
    "webuiport": 8089,
    "debug": false,
    "idletimout": 600,
    "zones": [
        {
            "name": "Room1",
            "host": "127.0.0.1",
            "port": "5000",
            "volume": "50",
            "enabled": false,
            "hidden": false
        },
        {
            "name": "Room2",
            "host": "127.0.0.1",
            "port": "5001",
            "volume": "50",
            "enabled": false,
            "hidden": false
        },
        {
            "name": "Apple TV",
            "host": "192.168.0.21",
            "port": "5000",
            "volume": "50",
            "enabled": false,
            "hidden": true,
            "alias": "TV in Livingroom"
        }
    ]
}

Place the config file somewhere like this /etc/airplayhub.json

4. Launch

Launch node-airplayhub like this to see the command line options:

$ node-airplayhub --help

Once you start node-airplayhub you can browse to http://[hostname]:[webuiport]/ to select zones and set volume levels.

Service

I also included a systemd service file (node-airplayhub.service) which you can edit it to your liking and then place it in /etc/systemd/system then use this command to enable the service:

$ systemctl enable node-airplayhub

Then this to start the service:

$ service node-airplayhub start