Groups | Blog | Home
all groups > flash (macromedia) > april 2004 >

flash (macromedia) : flash / shoutcast streaming


playfm
4/23/2004 8:23:35 PM
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
floatingcode
4/27/2004 12:01:03 AM
hey, man... nothing wrong with your code... it's correct. I built a player that
works perfectly on a mac but WILL NOT work on a PC (piece of crap). I believe
it is an Active-X/Bill Gates Rules the World issue. My player works without a
hitch on icecast and shoputcast streams through an XML file. If it is shoutcast
that needs to be run then the xml calls a PHP file with the header info.

So, what is the deal here? WINDOZE???? URRRRGH!!! Anyway, let's collaborate.
We can get this thing working. I am currently going through MSDN and perhaps it
is some kind of active-x thing.

Let me know what you think-- todd@floatingcode.com

best,

Todd
playfm
4/27/2004 8:03:02 AM
hi todd, thx f. your reply. In the meantime I'm also quite sure that it's
active-X making trouble here...but however I'm still looking for a solution...

unfortunately - since I'm quite a shoutcast-newbie - I didn't get your
suggestion using a XML-file yet. where does this xml-file have to be stored &
how does has it to look like?

thx in advance,
mike


+sarah+
12/6/2004 2:06:11 AM
Hey, I know this is an older topic, but I'm hoping to revive it. I've been
trying to do the same thing stream a shoutcast through a flash object, and I've
had the same problems. But the problem isn't headers... its the cross-domain
security policies. While in the dev workspace, you can do aything, but the
moment it goes online you need to put a crossdomain.xml policy file in the root
of your server. The problem is, shoutCAST is not a webserver, so it can't serve
this file even if flash requests it. I know the crossdomain thing is meant a
security policy to stop leeching, but here is a case where it is unnecessarily
stifling development. Any way around this?

+sarah+

play.fm
1/7/2005 7:02:30 PM
are there any examples of websites using shoutcast & flash ?

spyder_ur
8/1/2005 12:00:00 AM
I dunno about the PHP thing, didn't try it. However... someone helped me find
a solution. My test case was the smoothjazz.com stream, which has shoutcast at
http://64.236.34.67:80/stream/1005. To get it to work, you have to add

System.security.allowDomain("http://64.236.34.67");

at the top of your actionscript. So it stands to reason then that any other
stream should be the same, just allow its domain first.
spyder_ur
8/1/2005 12:00:00 AM
ARBreed
8/18/2005 12:00:00 AM
Hi There!

I too run a radio station and am attempting to build a flash based player for
my listeners to launch from the site. I used to get hosted thru Live365 and the
flash player worked fine, but we are switching to Audio Realm (which is
shoutcast) and now I started to have problems. My high band stream movie works
fine when I launch it directly from my PC, but when I uploaded it to my server
and attempt to launch it from the web it does not work (IE and FireFox - both
PC) I attempted allowing the domain as mentioned above but this still did not
help. I am just confused as to why it would work fine when launch from my PC
but not when accessed from the web.

And again, it worked with the Live365 stream but not AudioRealm (which is
shoutcast). Can any help me out? It would be MUCH appreciated!!

Thanks!

CODE:



System.security.allowDomain("http://sc3.audiorealm.com");
mySound = new Sound();
mySound.loadSound("http://sc3.audiorealm.com:12778/", true);
mySound.start();
spherop
9/17/2005 2:35:51 AM
I have been hoping for this to work as well. But no one to my knowledge has
resolved it (IE + Shoutcast + Flash).

My hope - is in a fix in Flash 8???? Does anyone know if this might be
possible? Anyone tried version 8 with Shoutcast yet?
atlweb
11/16/2005 10:49:12 PM
Does anyone have references or examples of using flash with Live365?

AddThis Social Bookmark Button