Old 14th February 2002, 04:19   #1
Sawg
Guest
 
Posts: n/a
On Demand Streaming

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:
http://www.host.com/~user/music/song.mp3

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 M3U/PLS specification 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 Code:
<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:
http://YOUR_IP:PORT/content/song.pls

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:
http://localhost:8000/content/scpromo.pls

If you are connecting directly with Winamp (and only Winamp) you can use the MP3 extension instead of the PLS:
http://YOUR_IP:PORT/content/song.mp3

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.

==================
Inspired by "On Demand Content" by Jay Krivanek from Shoutclub.com
  Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Tech Support Greatest Hits

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump