Broadcasting World Logo
On Demand Streaming
Posted on September 07, 2009

On Demand Audio
Version 1
Last Updated: 02-18-02

Some people ask if it is possible to stream MP3s but not have a live stream. This can be accomplished by using a normal web server or using On Demand Audio in the Shoutcast DNAS. We will start with the easiest first.


On Demand Audio with a Web Server
First you just upload the MP3 to your web server. It may be your own or a hosting provider, it doesn't matter. Though make sure you note (copy) the exact address of the location of the uploaded MP3 file. If it is a local server make sure you have the address to access it on your website, not your hard drive. You should end up with some URL like:
URL submitted by user.

Second you need to create a corresponding playlist. If you want to stream one file at a time, each uploaded MP3 will need its own unique playlist. If you want a collection you only need one playlist per collection. Open up your favorite text editor (like notepad, Microsoft Word is NOT a text editor) and paste in the URL(s) for your uploaded MP3(s). Save this file to either .m3u or .pls extension. Be careful and make sure that your editor does not give it a title like "playlist.m3u.txt" or any other invalid extensions. If you care to add more information to the playlists, like title of the file or stream, refer to URL submitted by user. on how to make extended playlists.

Next, upload the playlist files you just made to your web server. These playlists are what you will have to give out or link to on your web page. You can create as many links as you want on your page. An example link is shown below:

PHP:

<a href="http://www.host.com/~user/music/song.pls">Click here to hear Song</a>



That should do it. The down side to this method is that people can easily save your MP3 files to their hard drive, which may not be a good thing depending on if the files are copyrighted or not. The Shoutcast method is a little more secure.


On Demand Audio with Shoutcast
The latest Shoutcast DNAS comes prepared for on demand audio right after you install it. Using Windows Explorer (My Computer) if you explore the Shoutcast directory (C:\Program Files\Shoutcast\ by default) you will see a sub-directory called "content". This is where you put the MP3 files you would like to be available. By default, scpromo.mp3 comes in the content directory for testing. Shoutcast on demand does support sub-directories within the content directory but you cannot view directory structure from a browser.

NOTE: There is an error in the shortcut to the Shoutcast DNAS (GUI and console) that the Shoutcast Installer puts in your Start Menu. In the Start Menu go to Programs > SHOUTcast DNAS > right click on "SHOUTcast DNAS (GUI)" and select properties. Under the "shortcut" tab you need to change the contents of the "Start in:" box to the directory location of the Shoutcast DNAS ("C:\Program Files\SHOUTcast\" by default, with quotes). Hit "OK" when you are done.

Listening
Now the users should be able to connect to your "on demand" MP3 files. Shoutcast uses how a browser identifies itself to determine to show the MP3 or not, this is to protect copyrighted files (in theory).

If you are connecting through a browser, or via any link, the URL must be of the form:
URL submitted by user.

Notice the "/content/" after the port and before the song title. YOUR_IP and PORT are the IP and port of your server. The playlist files are generated dynamically by Shoutcast, so do not worry about them.
To test your set up you can try connecting to yourself:
URL submitted by user.

If you are connecting directly with Winamp (and only Winamp) you can use the MP3 extension instead of the PLS:
URL submitted by user.

Any sub-directories that you have within your content directory must be included in the URL for your file.

While this prevents browsers from downloading the MP3s to their hard drive, the songs still can be captured from within Winamp using conventional stream saving techniques (not discussed here).

Changing the Content Location
Now if you already have a large MP3 collection that you do not want to move around, you can change the content directory by editing sc_serv.ini (Start Menu > programs > SHOUTcast > Edit SHOUTcast DNAS configuration).

Under "Server configuration" look for the ContentDir chunk. This is where you can edit your path to your MP3 files.

; ContentDir specifies the directory location on disk of where to stream
; on-demand content from. Subdirectories are supported as of DNAS 1.8.2.
; Default is ./content, meaning a directory named content in the same directory
; as where sc_serv was invoked from.
; ContentDir=./content

First make sure you uncomment the "ContentDir=" line by removing the semicolon (;). Make sure the path does end with a slash (backslash or forward slash, depending on what you prefer to use). The comment out default of "ContentDir=./content" will NOT work if you uncomment it. The proper from is "ContentDir=./content/" with the ending slash. Then change the path accordingly to point to the location of your MP3 files. Note that the URL does not change, "C:\Media\Mp3\" is now considered the content directory. An example path is shown below:

ContentDir=C:\Media\Mp3\


And that is it. That should get you set up with on demand streaming on your system.


Ad: Bookmark and Share

Comments


Be The First To Comment!

Add Your Opinion


Name
Comment
  characters left


Add A Comment

Post a comment about this tutorial by filling out the form on the left. Please do not post spam links, personal info, personal threats or anything against our forum rules in comments.


advertisement

Add Us On Twitter

Partners

Latest News Headlines

Get Daily News Via RSS


About Us Advertise Privacy Policy Contact Us Copyright 2010, Broadcasting World. All rights reserved.