

Ask HN: streaming shoutcast stations in flash (as3) - jmtame

i was going to use minicaster, but you can't use as2 flash projects inside of as3 flash projects.<p>ok, fair enough, so i'll just write my own.  after trying to create one sound object, let the timer run for 5 minutes, and then delete the object for garbage collection, memory steadily creeps up at a rate of 0.02 mb per second (meaning it doesn't work).  so creating new sound objects, deleting old ones, didn't fix the memory leak.<p>so i figure: ok i'll go try eecolor's as3 streamer on google code.  turns out you need to be given explicit permission from a shoutcast station because you're using sockets.<p>does anyone have any idea how to stream a shoutcast station in flash cs4 (as3) from any website?  i'm stuck on this, unless i rewrite minicaster in as3.<p>one thing i may have left to try: an SWFBridge instance in each swf file, where i load minicaster and rely on the bridge for communication.  does anyone know of alternatives?
======
allenbrunson
i wrote a flash/actionscript client for streaming mp3 files myself. i'm about
90 percent sure that there is no getting around the fact that every server you
connect to _must_ give you explicit permission to connect, either through an
.xml file or a little server running on a specific port.

this limitation exists no matter whose code you use. it's a security thing
that macromedia/adobe put in there on purpose.

~~~
jmtame
i can stream any shoutcast station without permission using the sound object,
my issue is the memory leak.

flash thinks it's dealing with an mp3 song that plays infinitely. it increases
by approximately .02mb per second.

i know you can stream any station using minicaster, but you can't import an
as2 swf into an as3 swf.

~~~
allenbrunson
i was talking about socket usage, that's the part you need permission for.

and i think you should try a longer test before you assume it's leaking
memory. i vaguely recall running into this myself, and i think it hits an
eventual plateau, without leaking forever.

~~~
jmtame
you're probably right. i'm fairly certain i'm freeing up the objects properly
for garbage collection, and re: sockets, you definitely need permission for
that.

which makes me wonder what minicaster is doing...

but i should test for longer periods. i've been testing for 3 minutes at max,
maybe should let it sit for 30+. minicaster keeps the memory fixed every 5
minutes though.

