1. Update Raspberry Pi System
1. Update Packages
sudo apt update
sudo apt upgrade
2. Update OS Firmware (Optional)
If you wish to update to a newer firmware, you can use rpi-update. Note that this installs development firmware, so you can skip this step if stability is a higher priority.
sudo apt install rpi-update
sudo rpi-update
sudo reboot # Reboot after update
2. Setting Up RPiPlay
1. Install Required Packages
Install the necessary dependencies for building RPiPlay.
sudo apt install cmake
sudo apt install libavahi-compat-libdnssd-dev
sudo apt install libssl-dev
sudo apt install libplist-dev
Note: libplist-dev might not be necessary in all environments, but install it if you encounter errors.
Environment Details
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
2. Clone RPiPlay Repository
Clone the RPiPlay source code from GitHub.
git clone https://github.com/FD-/RPiPlay.git
cd RPiPlay
3. Build RPiPlay
mkdir build
cd build
cmake ..
make
After make completes, an executable file named rpiplay will be generated in the build directory.
4. Launch RPiPlay
You can launch the generated rpiplay executable directly.
./rpiplay
You can pass the following options as arguments at startup to configure detailed settings:
-n <name>: Specify the network name of the AirPlay server.
-b (on|auto|off): Show black background always, only during active connection, or never.
-r (90|180|270): Specify image rotation in multiples of 90 degrees.
-f (horiz|vert|both): Specify image flipping.
-l: Enables low-latency mode. Low-latency mode reduces latency by effectively rendering audio and video frames as soon as they are received, ignoring the associated timestamps. As a side effect, playback will be choppy and audio-video sync will be noticably off.
-a (hdmi|analog|off): Set audio output device
-vr renderer: Select a video renderer to use (rpi, gstreamer, or dummy)
-ar renderer: Select an audio renderer to use (rpi, gstreamer, or dummy)
-d: Enables debug logging. Will lead to choppy playback due to heavy console output.
-v/-h: Displays short help and version information.
3. Run RPiPlay Automatically on Raspberry Pi Startup
To configure RPiPlay to start automatically on Raspberry Pi boot, set it up as a systemd service. Create a service file in the /etc/systemd/system/ directory:
sudo nano /etc/systemd/system/rpiplay.service
Example rpiplay.service file:
[Unit]
Description=RPi Play Service
After=network.target
[Service]
Type=simple
Restart=always
RestartSec=10
User=pi # User to run RPiPlay as
ExecStart=/home/pi/RPiPlay/build/rpiplay -n MyPiAirPlay -b auto -a hdmi # Path to executable and options
StandardOutput=inherit
StandardError=journal
[Install]
WantedBy=multi-user.target
In ExecStart, the -n option allows you to set the name displayed for the AirPlay device.
Enable and Start the Service
After creating the service file, enable and start the service with systemd:
sudo systemctl daemon-reload # Reload systemd configurations
sudo systemctl enable rpiplay.service # Enable auto-start on boot
sudo systemctl start rpiplay.service # Start the service now
To check the service status, use:
sudo systemctl status rpiplay.service
Now, your Raspberry Pi should function as an AirPlay receiver. You should see “MyPiAirPlay” (or the name specified with -n option) in the AirPlay device list on your iPhone or iPad.