Faux Audio Streaming
Categories: goog code snippets
If you ever find yourself with the need or desire to build a streaming audio library but don't want to mess with incorporating REAL Server or some other formal product to do it, I came across a cool little workaround that I thought I'd toss out there just "FYI".
In my experiment, the test audio files are in MP3 format, but I assume that any format that can be natively played by Windows Media Player will work just as well.
The basic steps:
Okay, let's say I have two songs I want people to be able to play, but I don't want them to have to wait until the entire file downloads before it starts playing. I create my main template with a link to a pointer file, like so:
I then create the actual pointer file, which itself contains complete URLs to the audio files:
Now, when I click the link in the main template, I'm prompted to open Windows Media Player. When I do, the first song immediately begins to play even before it has completely downloaded. In addition, I see in my media player's playlist all of the mp3 files listed in my pointer file, and have the ability to skip around.
You can see it in action by clicking here.
In my experiment, the test audio files are in MP3 format, but I assume that any format that can be natively played by Windows Media Player will work just as well.
The basic steps:
- Upload MP3s to their new home;
- Create a template containing a link to a "pointer" file;
- Create the pointer file, which itself contains links directly to the MP3(s);
Okay, let's say I have two songs I want people to be able to play, but I don't want them to have to wait until the entire file downloads before it starts playing. I create my main template with a link to a pointer file, like so:
<a href="mytest.m3u">Click here to try out "faux audio streaming"</a>
.....
.....
I then create the actual pointer file, which itself contains complete URLs to the audio files:
http://www.dougboude.com/documents/02 Help Is On It's Way.mp3
http://www.dougboude.com/documents/03 Love's Theme.mp3
Important: This pointer file is saved with a "M3U" extensionhttp://www.dougboude.com/documents/03 Love's Theme.mp3
Now, when I click the link in the main template, I'm prompted to open Windows Media Player. When I do, the first song immediately begins to play even before it has completely downloaded. In addition, I see in my media player's playlist all of the mp3 files listed in my pointer file, and have the ability to skip around.
You can see it in action by clicking here.
Subscription Options
You are not logged in, so your subscription status for this entry is unknown. You can login or register here.
Re: Faux Audio Streaming
When I clicked the example link, it opened iTunes but wouldn't play the mp3's at all.
I imagine that if I associated the M3U with MS Media Player it would work.
OS: Windows XP, iTunes 6.
I imagine that if I associated the M3U with MS Media Player it would work.
OS: Windows XP, iTunes 6.
Posted by Micah on September 25, 2006 at 8:47 PM

