On Demand Content [Technical]

This forum will contain various articles contributed by the team and other invited guest.
Post Reply
User avatar
Will work for food (Administrator)
Posts: 2939
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door

On Demand Content [Technical]

Post by Jay »

What the heck is On Demand, well as the phrase would allude to it means that a particular data or file would have to be called or executed in order for the stream to start. This is how traditional webpages work, when you call a page url, it triggers the server to send you a particular file, and the whole file not just a portion of it.

So On Demand Radio or Video is streaming but not Live, it is usually a pre-recorded performance.

Why would I want it?
Well there could be several reasons, if you are an artist you might want people to be able to listen to your music at anytime they want, sort of like a preview. So if you were an artist you could give people the ability to listen to your music anytime they are ready, as opposed to Live Streaming where your content would have to be rotated.

Or if you run a radio station that has a talk show, you could put the entire show up on a webserver for your listeners to listen to later. If in case they missed parts of your show they can retreive them again.

Really the reasons could be many, but it is important as a webcaster that you know you have the option to do it.

How can I do On Demand Content
The traditional way to On Demand is putting a playlist file up on a webserver that points to an audio file. Then link to the Playlist file, anytime someone clicks on the link their player will auto spawn and start playing the music or audio.

Traditional On Demand with MP3
1. Upload the audio file to your webserver.
2. Right click on the eject button in Winamp and then choose "Open Location"
3. Type in the URL for the file that you just uploaded.
4. Once the content plays successfully from your website in Winamp, Open the Playlist Editor and click on the "List Opt" button.
5. Click "Save List"
6. In the dialog box name your Playlist and click save.
7. Upload the *.m3u or *.pls file playlist to your website
NOTE: for more information on linking click here
8. Make an anchor tag that links the HTML page to the Playlist file.

This option is great because you can use the bandwidth of your Webhost rather than your own, however be careful that you do not exceed the maximum allowed Transfer per month with your webhost, mp3's are not bandwidth friendly. Be sure to review your webhosts policy on MP3 as well, some make it difficult to host MP3 files because of the stigma they have as a Copyright infringement tool.

If for some reason the playlist file's contents are displayed rather then downloaded to the player. Your webhost's MIME Types are not setup to handle the M3U or PLS audio playlist format, in this case you need your host to add these types to your webserver's configuration. If you have access to your MIME types File, you need to add the following lines:

Code: Select all

          audio/x-mpegurl m3u
          audio/x-scpls pls
If you do not have access to your MIME Types file, then your webhost may allow you to create a file called .htaccess and put it in the directory that contains that file format. IMPORTANT: Messing with this file and deleting existing lines or not inputing the lines into the file properly will cause a 500 Server Error on your webserver, please make proper backup copies of any existing .htaccess files before attempting this.

Open your .htaccess file and add the following lines:

Code: Select all

          AddType audio/x-mpegurl m3u
          AddType audio/x-scpls pls
Save the .htaccess file to the directory that has the pls or m3u file inside it.

SHOUTcast On Demand with MP3
Alot of people like this option for it's simplicity but do not quite understand that an improperly configured shortcut could possibly break this feature. Please follow these instructions carefully:

1. After installation of the SHOUTcast server is complete, move your MP3's to the Content Directory.
2. Before Starting the SHOUTcast DNAS, ensure that you are either:
a) In the current operating directory of SHOUTcast (i.e. C:\Program Files\SHOUTcast\) or;
b) Using a properly configured Shortcut to the Server. (Using the Shortcut provided by the install will break the feature)

To fix the shortcut, right click on the shortcut and choose Properties, be sure that the "Start In:" Field in your Shortcut is filled in, if it is not then the Content Directory will not be associated properly and you will get an invalid resource error when you attempt to play the content in your player. The appropriate Start In Directory is the Directory that has sc_serv_gui.exe in it or the Content Directory, but do not include the content directory in the Start in field.

3. After the DNAS has started you have two ways of getting the On Demand content.
a) Directly, by opening Winamp or other streaming player, and using Open location and putting in "http://yourip:port/content/myfile.mp3" or;
b) Indirectly, by opening your browser and typing in the Address field "http://youip:port/content/myfile.pls"

The PLS file is automatically generated by the Server so viewers will not be able to download the content.

It is important that you understand that security is not tight with this method either, because ANY content can be copied. Even Real's Server security can be circumvented. There is always a tapedeck :) So once you make content available on the web, understand that it can still be snatched.

So why should I use SHOUTcast when I can have my Webserver?
Well as I stated SHOUTcast hides the MP3's from web-browsers making it a little harder to save the file, but as I said this security isn't absolute, it is sort of like using "The Club" (TM) for your car, it is a deterant. However if you don't mind letting people download your content then a webserver is ultimately the easiest way to go, because you do not have to worry about where it is being hosted. And if your bandwidth is precious like most everyones, then you will want to have it hosted somewhere that can handle a higher volume of clients then a standard DSL or Cable connection.

SHOUTcast does make life easier by automatically generating a file name from the name of the MP3, so if you have the bandwidth to host a SHOUTcast Server then that may make things easier from the prospective of a simple drag and drop or upload to the server and everything is ready to be linked on a page. I have put together a script called Mp3 ToolBox which essentially does the function of protecting your music while utilizing a webserver for the bandwidth and serving of the mp3's. You can find more about this script at the Mp3 ToolBox homepage.

Hopefully now you know at least what On Demand is and some ways to utilize it, please leave any questions in the comments box or at our forums. I would love to add your experiences to this article.

Feel free to leave a comment if you feel that I have missed something. Do not reply with questions. Questions should go in the Audio Streaming forum. Questions will be split from this thread and moved to appropriate forums.

Stream Host
Posts: 3
Joined: Sun Apr 06, 2008 3:36 am

Post by Akastream »

Thanks. Pretty nice tut'. :)

Post Reply