Streaming Audio to iPhone & iTouch

iphone playing mp3
I’m going to refer to the iPod Touch as the iTouch when I write, it’s easier.

Anyway, I bought an iTouch earlier today, or rather TinyTube bought one b/c there are a lot of Apple mobile user-agents showing up over there. We want to be able to test for the Apple devices, but there are no good iPhone emulators available that I’m aware of.

I figured out earlier how to stream video to the iPhone, and it turns out that the iTouch works the same way. Easy. Basically it uses the Range: HTTP header to buffer chunks of the file for playback. It’s progressive streaming the video. Audio files work the same way. I’ve been able to get this to work with MP3 files, but not (yet) AAC files. Great, so we can stream audio files off our server to the iTouch.

But what about MP3 net radio, does it work? Nope. I tried surfing over to Shoutcast on the iTouch and using the .pls files there to stream. No go. Looks like the iTouch doesn’t understand how to parse .pls or .m3u files. I then tried ripping an Icecast URL directly out of a .pls file. Again, no go. Looks like the iTouch doesn’t understand Icecast protocol either.

Hmm… but it is able to stream static audio files okay. So, is there a way to trick iTouch into treating the Icecast stream as a static file? Of course the answer is yes, and my next technical post will cover some of the details on how to make it happen.

For now you can just listen to the result, it’s serving up the “Groove Salad” station I found on Shoutcast. Hit this on your thing: http://sparkle.wooly.org/cgi-bin/iStream.