SHOUTCast, SHOUTCast, Let It All Out

These are the things I could do without.

For the past couple of months, I have been working on a SHOUTCast player app in AIR. When I signed on to do the project, I had absolutely no idea that playing SHOUTCast streams in Flash is a Herculean task. It seems there’s this nagging little memory leak related to Flash loading a never-ending audio stream. Flash doesn’t release the memory for the audio already played, and eventually that audio data just builds and builds and builds until your CPU or memory maxes out. So far, I have found little to nothing in the form of a nice quick solution to this.

That being said, perhaps the most viable current solution was posted at MadArco’s DevBlog . It basically entails streaming the audio for 20-30 minutes, then recreating the audio stream in a new variable, and crossfading the two streams, at which point the original can be released from memory and garbage-collected. It’s a nice idea, but in CS3, after the first couple of swaps, I lost sound altogether, and this problem re-occured no matter which “swapping” method I attempted. MadArco’s solution is in AS2, and perhaps I lost something along the way while attempting to convert it to AS3, or perhaps AS3 isn’t able to handle this particular method.

There’s also a nice explanation of the “swapping” concept here.

So, after even more research (by “research” I mean thinking of new ways to search for a solution in Google) I found a post on FlashBrighton about generating audio and PCM wave data. I also found this on, about using PHP to create a socket connection to read ID3 tags.

See where I’m going with this?

I’m proposing an all-in-one memory-leak-and-ID3-problem fix ShoutCast solution for Flash. Here’s my thoughts on it so far:

1.) Use Socket for getting the ID3 data, and, if possible, getting the stream as well.

2.) Use the FlashBrighton wave-data solution to create the audio from the ByteArray returned by the MP3 stream. This is possible using the URLStream class.

3.) Distribute it as a component or nice reusable class in order to allow beginners to use it easily.

I made some attempts at this yesterday, but the bytecode stuff is way over my head. If anyone has any input, or would like to have a go at this, please leave a comment and let me know what you think!


, , , , ,

  1. #1 by spender on December 17, 2007 - 6:36 pm

  2. #2 by Gabrielito Soy on July 16, 2011 - 11:52 pm

    Hello There!.

    Well, i no know if i’ve understod all of your trouble…i’ve trying a lot of possible solutions to both of the concepts, and i finally have solved all of two lines:

    Audio Refreshing
    Shoutcast stats data

    In a Flash/AS2 .swf generated app.

    It is fully based on the most viable current solution was posted at MadArco’s DevBlog, but i have added a few of little goods, as;

    VolumeControl – This affects all of the URL’s (same URL repeated) in MadArco’s App.
    StopSound Button – This stops all of the sounds within the swf
    PlaySound Button – This refreshes the same URL as a new sound each time you click
    (After you stopped).

    Stats (Broadcast items data) as; Who is OnAir and Wich song are sounding right now that are pulled from shoutcast (real time) via a couple of PHP files on server to swf file.
    These PHP files refresh themselves each certain time (in my case, 3 minutes), and data pulled to swf file refresh itself too, each 3 minutes.

    I’ve finished it just today (right now), but i haven’t an available server to try it.

    It theorethically must functions all itself.

    If you want to try, please contact me at:


    Gabriel (Mexico).

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

  • Least-Old Tweets

    Error: Twitter did not respond. Please wait a few minutes and refresh this page.

%d bloggers like this: