Question

I am playing some SHOUTcast radio stations in a self made flashplayer. Because the flashplayer itself does not understand pls files, I have created a pls reader in PHP that opens and reads the pls file and redirects to a file/link listed in the pls file. (I only request for mpeg/audio streams).

The flashplayer request for this file (on same domain) and will be directed to the stream listed in this pls file.

for example, when 'opening' a pls file in PHP, this give for example the following info (via http://yp.shoutcast.com/sbin/tunein-station.pls?id=<someid>):

[playlist]
numberofentries=1
File1=http://132.241.56.35:8004
Title1=(#1 - 0/10) KCSC.ASChico.com - 24Kbps MP3
Length1=-1
Version=2

PHP redirects the request to http://132.241.56.35:8004 but doesn't hear anything. By opening it in the browser to test for it existence, it is a HTML-page, a SHOUTcast D.N.A.S. Status page. When opening it in winamp for example, it plays the stream. Do I miss something inhere?

Some redirects directly play in the flashplayer, so it seems that my method is OK.

What must I do to get this operational? Why is the link that suppose to be a stream a HTML page?

Was it helpful?

Solution

SHOUTcast servers check your user-agent string to see if it is a browser or not. The reason for this is that when you go to the SHOUTcast server's URL with a browser, you get the admin page. It does this detection by checking to see if the word Mozilla is in the string.

Since your Flash player is going to be using the browser's user-agent string, the SHOUTcast server sends you the admin console instead of the stream.

You can override this behavior easily by appending a semicolon ; onto the end of the requested path.

http://132.241.56.35:8004/;

This forces the SHOUTcast server to ignore your user-agent string and use MPEG OVERRIDE instead, which does not contain Mozilla and is assumed to be an audio player.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top