Streaming sound

Hi,

I’m building a streaming mp3 player. So that you can load a mp3 from all over the internet in a streaming way, but soon It became obvious that when I set the loadSound to true (used to stream sounds) that sometimes the mp3 begins to stop and load and then play again. A sort of short stops. So I thought let’s place a buffer so that when the song is loaded half way it’s starts playing and gone are the short stops. But that’s where my problem started and some questions arised. I use the onload method to check if any sounds are loaded into the sound object. I used this sentense to handle the onload action:

mySound.onLoad = onLoadSound;

The onLoadSound method looks like this:


function onLoadSound(success:Boolean):Void
{
	playTicker = true;
	
	if(Math.round(mySound.getBytesTotal()/2) === Math.round(mySound.getBytesLoaded()))
	{
		trace("half ways");
		success = true;
	}
	
	if(success)
	{
		trace("start");
		mySound.start();
	}
	else
	{
		tickerHolder.text = NOFILEFOUND;
	}
}

But now that I’m not exactly streaming anymore, so I have set the loadSound to false. Now I wonder if the onID3 method I used for getting some specific information out of the mp3 also acts like a none streaming file stream?

Also something is wrong with my check if the loading process is half way.
I have some songs on my pc and one on the internet. The songs on my pc load very well. (offcourse :P) But they don’t get into my if statement. :frowning:

And the song loaded from an internet adress doesn’t even get into the onload function :puzzle:

Any suggestions?

thnx

No one?

If you were having problems with the sound stopping whilst it was streaming, one suggestion is to alter the bit rate of your mp3 file, you have to find a balance between file size and quality.

You also also change the global property _soundbuftime. This determines how long the mp3 will wait to download before it starts playing. The default is 5 seconds.

I provide _soundbuftime and two different versions of mp3s as options for my users depending on their bandwidth, for example a user on 56kb modem may want to listen to a high quality version of the mp3, but they will have to set there _soundbuftime to arround one minute to enable the mp3 to stream a substantial chunk of the file before it starts playing, thus, cutting down on the chance of breaks while it is playing.