Why the heck would I need to link my stream?
Simple, so people can easily get to it. The idea of directly linking an audio stream to a webpage was started back before I was on the net. But it really took off when real networks used it to get people to their client's streams easily and without knowing all those crazy IP numbers. As you know most who use SHOUTcast host it on their own system, so they do not have a fancy domain name to link to, it usually ends up being http://22.214.171.124:8000, which is very cumbersome to the average internet user who has trouble remembering a telephone number. It takes a couple of passes to remember those large numbers, and when you are a fan of several streams remembering all that is just not rational and can drive your listeners up the wall. Most users are very aware of clicking through, and they can easily do that from your web page because they have already stumbled across it or have memorized it's nice address.
So, how does it work?
Quite simple, the user visits your webpage, they find a link that says "Click here to listen" so they click there, what immediately happens next is that they are served a Playlist file with the *.PLS extension, more commonly. What this file does it it tells the system that it is going to download a file called whatever.pls, when the user installed Winamp, Real Player or whatever, the player told the system that it was in charge of handling those files, so the browser will use that file type association to open the Playlist file in that player, after that the player reads through that file for a Location tag, when it finds that it automatically loads that into the player and begins playing the stream. So in essence you are actually going to link to a playlist file containing the URL to your station's server. Do not link directly to the stream, this will provide a most undesirable effect, and will not allow them to truly listen to your stream.
OK great, how can I do it?
Well the simplest method is using your SHOUTcast servers built in Web server, this feature has a listen link already built in with all the correct information. So all you have to do is link to it from an outside source. That is the easy way, and it will get you the results you are looking for, another method is to actually host the PLS file on your website, this makes the link look all fancy and allows you to hide the IP address from the user, fairly effectively. To do this method you must place a file on your server, call it whatever you like, but make sure it has a PLS extension after it. Edit the file so that it says:
So now your probably asking yourself, "What does all that stuff mean?", well I am going to tell you
[playlist] <-- Serves as a Category for the rest of the entries, this *is* case sensitive
Numberofentries=1 <-- this tells the player how many files it will expect to find referenced by the file. This is case sensitive
File1=http://myserverip:port/ <-- This tells the player that the first item located in the playlist is located at
Title1=My Title <-- this tells the server what to display as the file's name in the Winamp Playlist (not all players support this feature.
Length=-1 <-- this tells the player how long the file is in seconds, in our case it is a stream, so the stream is indefinate, so -1 will make the player display nothing.
Version=2 <-- this tells the player what version format the PLS file is in, older PLS formats did not include the title tag.
As you might expect you can fit more entries into the file by writing the file like so:
Title2=My 2nd Title
In this example there was a use of two Playlist slots, allowing you to put more than one server in or even a static file, you could put extra files into someone's playlist to listen to like say a promo or intro file. This is also great for back up's. Say for example your first server fails and they do not connect, well most players will move on the the next item in the list, so the user would in essence be redirected to a mirror server this way. Got the idea?
So if I can use the PLS file, why can't I use the standard Playlist file M3U?
You can, in fact it is perfectly fine to use either file, it's just that the shoutcast website has made extensive use of this file format, but as Icecast users know, it is not the standard, M3U's come in real handy when you have large playlist, PLS seem to lack any real ability beyond this simple task. M3U files also support title tags in the Winamp Player, so in essence you will get more out of using M3U files. But PLS files have been used extensively, and I promote their use for the simplicity and the fact that you have probably seen them more often in this streaming medium.
I tried hosting PLS files with my web host and it didn't work, the files just got displayed as text files, why did this happen?
Simply because your web servers MIME types were not setup properly to handle PLS files, in this case you must add them to your MIME types file. The proper entry is:
you are using M3U files
If your web host does not allow you to access your mime types, you can request that it be added or, if your web host supports it, you can use the .htaccess file to add the mime type to the server. If you see an .htaccess file already in your base www directory, add this line to the bottom of the file: (WARNING: If you are uncomfortable with configuring a server or do not fully understand what you are doing, you can cause your website to cease functioning by deleting parts of the .htaccess file unknowingly)
This method will effectively tell the server how to handle the file correctly from the directory of the .htaccess file and all subdirectories of it.