Setting up an MP3 streaming server

Update: With the advent of SoundPlay 4.0, you can do much more sophisticated MP3 streaming than the M3U technique outlined here. Read Streaming audio from SoundPlay for more information.
This tip is excerpted from Scot Hacker’s MP3: The Definitive Guide, coming from O’Reilly and Associates March 3, 2000. While it is written for all platforms, it may be especially handy for BeOS users, since up-to-date ports of the SHOUTcast and icecast servers are probably held up waiting for the arrival of BONE.

There are two kinds of streaming MP3 servers: True streaming and „on demand,“ or „pseudo-streamers.“ Genuine MP3 streaming, where your server acts like a radio broadcast station (users hear what you’re playing at any given moment) can require quite a bit of setup and configuration, plus special software. MP3-on-demand, on the other hand, is very simple to set up and can be run from any standard web server. With this method, users will click a link to a playlist file (which may reference from one to any number of MP3 files) and the link will be passed to their preferred MP3 player. The playlist will be launched in the preferred MP3 player, which will manage the download of the referenced MP3 files, playing them as soon as it has enough bits to work with. The files in the playlist will appear in their player’s list window (filenames only), so they can skip around between songs at will. In other words, pseudo-streaming is asynchronous, rather than synchronous.
To set up MP3-on-Demand, you must first have a running web server — any platform and any server software will do. Now, place some legal MP3 files on your site and create a text file listing the full URLs to these files. For example, your text file might look like this:

Save this file into the site with an .m3u extension, e.g. Blues_Playlist.m3u. M3U stands for „MPEG URL.“ Finally, check your server’s MIME configuration database (consult your server’s documentation if you’re not sure what this means) to see that the following MIME types are present:

audio/x-mpeg .mp3
audio/x-mpegurl .m3u

[BeOS users: Since most BeOS web servers use the system’s filetypes database rather than a server-specific MIME database, you’ll want to set this up in the FileTypes preferences panel.]
You may need to restart the server to have it recognize the new MIME type. Now, place a link on your site to the M3U file. Users accessing the file should see it passed automatically to their favorite MP3 player, which will display all the files in the list, start playing the first one automatically, and let them switch among files with a single click.
Of course, if you do this, you will need to make sure you have plenty of bandwidth. Whereas real MP3 streaming (covered in detail in MP3: The Definitive Guide) is capable of downsampling files to be bandwidth friendly, this method does not. The bitrate and frequency at which they’re encoded is the bitrate and frequency at which they’ll be served.
[BeOS users: You may also want to check out Simon Huet’s MP3ToStream add-on for Robin Hood. This will avoid the necessity to set up M3U files, but doesn’t offer playlist capabilities.]



No comments so far.

(comments are closed)