One of the biggest limitations of the current version of AirPlay shipping with iOS 4.2.1 (well, video streaming to Apple TV aside) is the fact that you can’t use an iOS device as an AirPlay speaker. In fact, a speaker can be an Apple TV, an audio system connected to an AirPort Express station or an AirPlay-enabled audio system. But, you can’t send audio from an iOS device to another iOS device or from iTunes on your Mac/PC to an iPhone/iPad.

Imagine the possibilities of iOS devices as AirPlay speakers: you’re in the car, iPhone is connected to your car’s audio setup, a friend’s in the backseat playing with his iPad. He wants to send some music from his iPad library to the iPhone, he fires up the iPod app on his tablet and instantly streams music to the car’s audio system thanks to the iPhone acting as a speaker. Or, your Mac’s in your bedroom and you want to play some tunes on your iPad. If only the iPad was an AirPlay speaker, you wouldn’t have to sync music (and thus eat space) on it.

With the following tutorial (files courtesy of TouchBite) you’ll be able to turn any iOS device running iOS 4.1 and above into an AirPlay speaker.

Requirements:

iTunes 10.1 installed on your computer;

Jailbroken iPhone / iPod Touch / iPad running iOS 4.1 / iOS 4.2.1 (4.2.1 recommended);

This .zip archive;

Cyberduck installed on your Mac (WinSCP for Windows users)

- Download this archive, and extract the contents on your computer. You’ll have two files ready to be copied on your iOS device: “airtunesd” and “com.apple.airtunesd.plist”.

- Copy “airtunesd” to /usr/libexec on your iOS device. Copy “com.apple.airtunesd.plist” to System/Library/LaunchDaemons. You can use Cyberduck for this. In order to transfer files on your iOS device, make sure you’ve installed OpenSSH from Cydia.

- Change the permissions for both files to 755. You can do this using Cyberduck or iFile directly on your device.

- Reboot your device.

- Make sure your computer and the iOS device are on the same local network.

- Start iTunes on your computer, and play a song. If everything has been set up correctly, you should notice the AirPlay icon in the lower right corner. Click on it, and you’ll see a speaker icon with the name of the iOS device you want to turn into an AirPlay speaker.

Now, a few considerations on this method. Even if @Weito, the creator of the tweak, claims it should work perfectly on any iOS device running iOS 4, 4.1 or 4.2.1, I haven’t managed to turn my jailbroken iPhone running 4.1 into an AirPlay speaker. My jailbroken iPad running iOS 4.2.1 is an AirPlay speaker now, and everything works really well.

Still, I tried to control iTunes from my iPhone using the Remote app and I see the AirPlay icon in there. In this way, I can leave my MacBook Pro in the bedroom, and stream audio to the iPad using my iPhone as a controller.

I also noticed that if you’re streaming audio from your Mac to the iPad and you start playing music on your iPad using the iPod app, AirPlay will drop the connection and you’ll need to restart iTunes and disconnect / reconnect the iPad to your local network to make AirPlay work again. Why would you want to play music while you’re streaming anyway? AirPlay streaming will also override your system’s audio.

If you want to control music from your iPad, you can use the Remote app (which in my opinion looks even better than the native iPod app).

Overall, this is a great way to make your iOS device an AirPlay-compatible speaker, and as you can guess the tweaking possibilities are really, really endless. I can see this being further developed in the next days and even released in Cydia as a standalone package but in the meantime, you can follow this guide to make it work.

Update: After upgrading my iPhone 4 to iOS 4.2.1 (and jailbreaking to install the files above) the AirPlay speaker functionality works. Also, I installed a tweak from Cydia called “AllPlay” both on the iPad and iPhone which enables AirPlay in all third party apps.

Here are a few screenshots showing that it’s possible to stream Youtube audio from iOS device to iOS device.

After playing around with this hack for the whole afternoon, I can say it’s all pretty stable and fast. Things go a little crazy when you try to switch audio streaming through iTunes from an AirPlay speaker to another, but a simple Respring and disconnecting / reconnecting to the local network seem to be easy and quick fixes.

We’re waiting for someone to release an installation package in Cydia, anyway.

Update #2: We just found out you can send audio from any app on your Mac to an iOS device running this AirPlay hack using Rogue Amoeba’s AirFoil. The app will recognize the devices as Apple TVs, and quality is just as good as in iTunes. Very cool.