hi,
for an online-radio-project ([L=play-fm]
http://www.play-fm.net]play-fm[/L]) I
recently tried to build a flash-movie which should be capable of playing
shoutcast-streams (for me it seems to be the easiest way to provide as many
platforms/browsers with an mp3-stream without using external players).
theoretically this should be no problem, basically I just use this code:
s = new Sound();
s.loadSound ("url.of.shoutcaststream:8003",true);
this works perfectly when running in the standalone-flash-player, the
flashMX-IDE and even when embedded in html-page in mozilla & opera. only
problem is that internet explorer seems to have a problem, when using an
embedded flash-movie in connection with shoutcast streams (at least with _some_
flash-versions, I'm not sure but I think the problem occurs when flash is
integrated via activeX).
I did a lot of internet research and found out 2 possible reasons for this
problem:
* security-issues: newer flash-players might have restrictions when it comes
to cross-site-connections (which in my case is actually happening: the
webserver hosting the flash-movie is not the same as the shoutcast server)
* some problems with the http-headers, the shoutcast-server is sending.
I personally think the second reason is the one actually causing my problems.
I found a workaround in some newsgroups, which uses a PHP script, which
connects to the shoutcast-server and passes thru the data - with corrected
http-headers - to the flash-client. I tried this workaround but it still didn't
work for me. also, if I understand this right, this doubles the traffic (since
my webserver & streaming-server are different machines on different providers),
which is an absolute problem for my setup :-(...
has anyone used this workaround successfully and could inspect my code, maybe
I got something wrong there:
$streamname = "64.236.34.97"; // put in whatever stream you want to play
$port = "80"; // put in the port of the stream
$path = "/stream/1018"; // put in any extra path, this is usually just a /
header("Content-type: audio/mpeg");
$sock = fsockopen($streamname,$port);
fputs($sock, "GET $path HTTP/1.0\r\n");
fputs($sock, "Host: $streamname\r\n");
fputs($sock, "User-Agent: WinampMPEG/2.8\r\n");
fputs($sock, "Accept: */*\r\n");
fputs($sock, "Icy-MetaData:1\r\n");
fputs($sock, "Connection: close\r\n\r\n");
fpassthru($sock);
fclose($sock);
moreover, is there any other way to solve this problem? I've heard that this
problem doesn't occur when using icecast-servers, anyone to approve that?
thanx a lot in advance for any help, this problem is really bugging me since
two days ;-)
mike