Update (9.21.15): VMLite informs us in the comments that a new version of rPlay will be available by next month! iOS 9 support has been figured out, and this new (likely paid) version will eliminate the internet based license check. Chromecast mirroring is also in the works!
A friend of mine has been talking about buying an Apple TV lately, mostly so he could use the AirPlay mirroring functionality. Airplay allows you to mimic what’s happening on your recent generation iDevice or Macbook on your TV wirelessly–watch YouTube, show pictures, play music, even ‘mirror’ the screen exactly. I’d heard somewhere that AirPlay was possible with a Raspberry Pi, and started looking into it.
I soon found that many devices will do music and sometimes even YouTube videos over AirPlay, but mirroring is typically only possible on an actual Apple TV. However, I came upon this YouTube video that showed a guy(and his killer accent!) that had pretty recently managed that very thing. The program is called rPlay, from a company called VMLite.
At the time of writing, rPlay is in beta. You’ll need to go to the forums and make a post or e-mail the developers(firstname.lastname@example.org) to request a license key, without which you’ll be unable to use mirroring(though the guys at VMLite informed me other AirPlay functions will work without one!) . I was a bit late to the game, but emailed a request, and within about a day had a key and some basic instructions in my inbox.
I write this tutorial for a couple reasons. First of all, the instructions didn’t cover some common errors. Like me, you’ll likely run into some hiccups and need to do a couple extra things to get everything working. Second, this was my first RPi project, and if you’re in the same boat, you may appreciate a bit of extra info to get you started. This is written from a beginner’s perspective.
Getting your Raspberry Pi running
This section is for those starting at the beginning–first time RPi users. If this doesn’t apply to you, skip ahead.
I was able to get things started up using this tutorial on Engadget, and I suggest you do the same. However, there’s a couple things I’d like to add.
When securing your power supply, ensure that it’s not only 5V, but also outputs at least 700mA. Your SD card will need to be at least 2GB, and there are lots of reasons to get different types or memory capacities if you want to do a bit of research and decide what your needs are. Also, you technically don’t need the USB mouse if you truly intend to only use the Pi for AirPlay, but odds are you want to tinker more than that. Otherwise, you can pick almost all of it up for $10 or less each online(assuming you don’t have the supplies already, which you likely do). A Model B Pi is recommended for rPlay; VMLite reports it performs much better with it’s larger RAM(512MB vs 256MB on the Model A). However, if you do use a Model A, note that you’ll probably need some extra things, like a USB hub and wi-fi dongle.
I followed most of their guide to install a compatible OS image on your SD card. Their link for the downloads didn’t serve me; I got mine from here, and got the newest Raspbian “wheezy” image. The email instructions I received said rPlay runs on a “dumb terminal.” I wasn’t sure what this meant, but I think rPlay will work with any image you’d like, since you’ll only really need the command line(note that there are some differences in how some images use rPlay!). By the way, I used the torrent option with uTorrent…it made a world of difference for download speed and stability.
(Note: I was using the Mac instructions–the following might be slightly different for Windows or Linux)Later in the process of loading the SD card you’ll need to alter Engadget’s instructions so that the name of your image reflects the name of the image you downloaded, the most recent one, not theirs from 2012-06-15. Also, when they talk about ‘converting’ the name of your disk, that is happening automatically. You don’t have to change the name of anything, they’re merely informing you that it has changed so you can type in the correct things.
After loading the image, I followed their advice on booting for the first time and setting things up. Couple things to note here…first, the layout of the configuration menu has changed, and some features you’ll want to access are layered in the “Internationalization Options” and “Advanced Options” menus. Also, step 2 of ‘getting rPlay running’ can be done while in the config menu now, if you want to get it out of the way. I didn’t continue from where they encouraged you to start the GUI after rebooting; again, you’ll load rPlay with the command line.
Getting rPlay running
You have your RPi running and ready to go…now to get to the good stuff. This will largely be the instructions given to me in an email that included the license key, and all the extra bits I add are mostly tips I got from the rPlay bug fixes on the VMLite forums.
This will all be done from the command line; just type things in. Some steps may not be necessary, but I typically favor doing all that you can to ensure no problems arise along the way.
Note that I’m using the Raspbian image; I’ve been told some steps vary a little. I’ll note ones I’m aware of.
1. Update the firmware of your RPi.
sudo apt-get install rpi-update
This may take a couple minutes, but this step gave me no problems. The first line gets your updater, the second runs it.
Note: “sudo” is a common command line element; it gives unrestricted access to the system when entered before a command, and most things we’re doing won’t work without it.
2. Allocate maximum memory to the GPU.
AirPlay is a graphics intensive function, and you’ll need all hands on deck to run it on your RPi with it’s relatively low computing power. You may have already done this as you were configuring your RPi for the first time; if not, enter the configuration menu with
Go to ‘Advanced Options,’ then ‘Memory Split.’ Delete whatever number was previously there, and allocate 256 for your model B Pi, or 128 for a model A(half the total RAM), and confirm the change. I think I rebooted here even though I don’t think you’re encouraged to; again, I just like to cover my bases.
3. Download some necessary libraries/apps rPlay depends on.
First, load what you’ll need:
sudo apt-get install libao-dev avahi-utils libavahi-compat-libdnssd-dev libva-dev youtube-dl
Then, if the previous command reports no errors, update YouTube (note: the dash before update in the following command is a double dash):
sudo youtube-dl –update
Here’s where I first ran into problems; I got some “404” errors when running apt-get; I’m not sure any of the dependencies(there’s five there, separated by spaces) properly loaded. If you had problems, try this command:
sudo apt-get -f install
Then try to install the dependencies again. A clue that you need to use this line, besides seeing errors, is that the YouTube update won’t work(you can’t update something you don’t have). I actually had to repeat some things; I thought all was well, but then I’d try to continue and it would say I didn’t have the necessary dependencies, encourage me to use the ‘-f install’ command, etc. If the YouTube update works correctly, you may get a message saying something about how the distribution method had changed; press enter to continue, and it will report that youtube-dl can now be used. You should be ok to continue.
4. Download rPlay and run.
wget -O rplay-1.0.1-armhf.deb http://www.vmlite.com/rplay/rplay-1.0.1-armhf.deb
sudo dpkg -i rplay-1.0.1-armhf.deb
First command is the download, second is the install. Here you’re likely to run into problems if everything from step 3 wasn’t settled. I believe you need to reboot at this point; rPlay is set to auto-start. Note that anytime rPlay starts, you’ll get three warnings from Avahi about not using their native this-and-that…VMLite assures beta testers these are ‘benign’ warnings, and not to worry about it.
5. Validate rPlay with a license key.
Now time to make things legit; mirroring won’t work without validating your RPi to use rPlay(not sure if other AirPlay functions might? I didn’t experiment — Update: I mentioned this before, but the guys at VMLite have told me other features DO work without a license!). You’ll do this on the web, and you can do it on your RPi if you want(use command ‘startx’ to bring up the GUI and use the Midori web browser), but I just did it on my laptop for simplicity. Don’t use Safari for your browser here; VMLite tells me you’ll run into bugs. If you do it on your RPi, replace your RPi’s IP(which is given to you as you boot up, look for it just above the log-in info request) with “localhost.” Type the following URL into your browser:
http://<ip of your RPi>:7100/admin
The username and password are ‘admin.’ Scroll to the bottom where you can enter your key, click submit, and you’ll get a confirmation. If you want you can edit the other options on this admin page. You can also do all this by editing /etc/rplay.conf via the command line with the ‘append’ command. Plus you can be paranoid like me, and reboot…again :)
You’re ready to try it out!
6. Try out AirPlay!
With your RPi ready to go, bust out your iDevice and turn on AirPlay. On iOS 7, you drag your control center up from the bottom, and the AirPlay option should be located on the same line as AirDrop. Select your Pi as the device, and activate mirroring if you want to play with that. In video playing apps, you’ll typically need to select the output device again from within the app to push only the video to the screen(separate from mirroring). Whatever feature you decide to play with, your video and/or sound should be running to whatever is hooked up to your Pi! The method is similar for an iPad or Apple computer. There is some limited support on Android devices as well; they’ll recognize your RPi as a Chromecast(VMLite has also made an iOS app, titled rplay, that will allow your iDevice to act as a Chromecast!).
- For Raspian, AirPlay will function at any time(command line, GUI, etc), but this isn’t universally true. For XBMC images like RaspBMC or Xbian, for example, you’ll need to exit XBMC to the command prompt. Other images may have other requirements.
- Remember that your RPi and iDevice need to be attached to the same network, in other words, the same router. Most people have a hard time getting things working on school or work networks.
- In my experience, leaving the range of your wi-fi while your device is still mirroring is a great way to make sure your RPi completely freezes.
- When I updated to iOS 7, I needed to update all my libraries(sudo apt-get update) and restart rPlay(sudo /etc/init.d/rplay stop; sudo /etc/init.d/rplay start). Prior to this my Pi wasn’t showing up on the AirPlay menu. Even after the fix, things are buggy and sometimes fail. I’m still hunting for a solution to this, and it may come with the next rPlay update.
- Remember that your Pi will need to have the ethernet and HDMI cables hooked up at boot time. I regularly fiddle with my router, and this has been a frequent annoyance(I can’t figure out why AirPlay refuses to show up for my Pi).
As I mentioned, rPlay is in beta. You’re unlikely to see perfect performance. I’ll outline what I was and wasn’t able to accomplish. I originally thought many of my issues were due to the terrible internet in my apartment, but we’ve since gotten a rather good upgrade, and I’ve seen little change.
I was able to get mirroring working pretty well on my iPhone 5. I could definitely notice a delay between what was happening on my phone vs. the screen, but it wasn’t bad. The edges of my iPhone’s screen seemed to be cut off a little on the big screen. Music seemed fine, photos, etc. However, using YouTube and Netflix were laggy and very, very low resolution(I think the bettered internet speed helped the resolution a bit, but there were still syncing problems).
Without mirroring, YouTube via AirPlay worked rather well. You can’t try to navigate around too quickly, you may encounter some issues if you do(possibly including freezing). I couldn’t change the position of the playback, for example, but I was able to get videos to play mostly without issue(certainly better than over mirroring, no audio/video out of sync problems). No problems viewing native pictures, videos, or playing music. However, Netflix wouldn’t load a video at all(much to my chagrin).
I did a quick experiment to use Chromecast, but wasn’t able to get anything to happen. VMLite acknowledges the Chromecast support is sketchy, but they are actually working on an app that will allow your iDevice to route Chromecast signals from an Android device to AirPlay.
I was pretty pleased when I was able to get things working, and I hope you’re successful too.
I’d love some feedback from others working on this. If you know some ways to fix problems I had, had problems of your own, or just noticed some mistakes or something out of date about my tutorial, please comment and I’ll do my best to keep things accurate.
Hopefully VMLite will continue to improve the rPlay experience and I can continue to report improvement from here on out.
Enjoy your Pi!
Update (2014-06-16): I’ve reached out to VMLite recently to inquire about the future of rPlay. Unfortunately, there isn’t much to report…I’m told we still have a while to wait before a full version is released, and they’re focusing somewhat on Android capabilities. However, this is a bit previous, and I will email them again to see if I can get more recent news.
Update (2013-09-20): iOS 7 has brought with it some challenges for developers that are affecting rPlay(in addition to the hiccups still remaining on the beta version). I’m having a hard time getting things to work consistently, and several others on the forums are reporting the same.