Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stream a shoutcast radio broadcast in Flash (Shoutcast Flash Player)

I've been looking for a solution to this for years, but nothing is conclusively documented. There are many Shoutcast Flash players out there (e.g. radio.de) so I know it's possible. However, most of my research leads to this:

s = new Sound();
s.loadSound ("url.of.shoutcaststream:8003",true);

Which works for me in FireFox but not in IE. I don't want to buy a component, I want to know how those components do it so that I can build my own custom player.

like image 294
Jourdan Avatar asked Dec 14 '22 03:12

Jourdan


1 Answers

You're almost there. The full mantra is:

s = new Sound();
s.loadSound ("http://url.of.shoutcaststream:8003/;",true);

Notice the trailing slash and semicolon. Shoutcast servers (DNAS) look at the useragent of a request to detect what to send back in the response. If it's a broswer then it serves a page of HTML. If it's not a browser UA, it sends the stream. Trailing semicolon (for some undocumented reason) causes DNAS to ignore the UA and always send a stream.

There's no satisfactory solution to playing AAC streams, although Flash has the equipment to do so, for some reason the API for AAC is completely different and cannot play AAC Shoutcast.

The NetStream solution here is unlikely to provide a solution.

See my blog for more info:

http://www.flexiblefactory.co.uk/flexible/?p=51

like image 54
spender Avatar answered Jan 05 '23 00:01

spender