Play Internet radio in the background

Most of the time, I just don’t mind that the iPhone doesn’t permit any non-Apple apps to run in the background. Switching between apps in the iPhone by hitting the Home button is fast and easy, especially on the iPhone 3GS. It’s only when I want to switch over and check on Twitter while I’m listening to streaming Internet audio that I realize I’m trapped. Or so I thought.

It turns out that, thanks to the iPhone 3.0 software update, the iPhone is finally capable of playing back streaming audio in the background. You can’t do it with a third-party app, of course, but you can do it with Safari.

There are some catches. First off, only streams that are supported by iTunes—MP3 and AAC, basically—will work. Fortunately, the two streaming stations I listen to most often are available as MP3 streams. Second, you can’t use Safari and listen to the audio at the same time! Finally, it’s a real pain to type in a long audio-stream URL, and it's not really easy to bookmark a stream URL.

But there’s still an easy way to put your favorite stations at your fingertips. Here’s how.

Make it easy

If you really want to make it easy, you can just download Flycast for iPhone. Flycast includes a “play in background” feature that essentially automates this process. You use Flycast to browse for your favorite streams, and then when you select them, Flycast opens the stream within Safari and it plays in the background.

Do it yourself

The HTML page you'll create (left) and the resulting, backgroundable, audio stream in Safari.

However, one of the stations I listen to on my iPhone doesn’t show up in Flycast’s directory. So I made my own directory of favorite streams and added it to my home screen.

The first thing I did was create a basic HTML document. Then I added links to my favorite stations, which I found by looking on their Web sites or searching through online Internet radio directories. What you’re looking for is a URL that you can open in Safari. Safari on the iPhone will accept MP3 streams or .m3u files that point to the proper stream URLs. In the case of one of my favorite radio stations, Radio Paradise, the 128k stream is located at http://www.radioparadise.com/musiclinks/rp_128.m3u.

I also wanted to create a pretty(ish) icon that I could use as a shortcut on my iPhone’s home screen. This isn’t necessary, but it’s a nice optional step. To do so, find an appropriate image and open it in your image editor of choice. In the end what you want to save out is a PNG image that’s 57 pixels wide and 57 pixels high. (Make sure the PNG isn’t transparent.) Then upload your PNG image to anyplace you have access to that allows you to post Web pages.

Here’s the format for the HTML file you’ll want to create:

<html>
<head>
<link rel="apple-touch-icon" href="http://www.examplesite.com/radio.png"/>
<title>Radio</title>
</head>
<body>
<h2>KCBS</h2>
<p><a href="http://208.80.54.69/KCBSAMDIALUPCMP3">Listen</a></p>
<h2>Radio Paradise</h2>
<p><a href="http://www.radioparadise.com/musiclinks/rp_32.m3u">32K</a></p>
<p><a href="http://www.radioparadise.com/musiclinks/rp_128.m3u">128K</a></p>
</body>
</html>

Basically it should all be self explanatory—there are links to one KCBS link and two Radio Paradise links. The link in the link rel="apple-touch-icon" section should be the URL to the PNG you uploaded. If you don’t have a custom PNG, just delete that line.

Once that’s done, save your HTML file up to that same place you can post Web pages. Then load the page in your iPhone’s Safari browser, touch the Plus icon at the bottom of the screen, and choose Add to Home Screen. You’ll see your PNG graphic and be able to give your icon any title you want.

Now you’ve got a quick-access shortcut to background-streaming audio. Now if only it worked with MLB At Bat 2009—but for that to happen, I think Apple will have to allow third-party apps to play audio in the background. Until then, this technique gets us halfway there.

Notes as links

Update: Reader Barry G. writes in that he just types or pastes stream URLs into the Notes app, which automatically turns them into live hyperlinks. Then he just switches into Notes and taps on the URL in question in order to launch Safari. It works, though if you're a heavy user of Notes it requires some extra steps, and URLs are pretty ugly to look at. But if you don't want to be bothered with HTML or saving a shortcut on your home screen, using Notes is a good low-tech option. Thanks to Barry for writing in!

Subscribe to the iOS Tips & Trends Newsletter

Comments