# Streaming sound

**URL:** <https://forum.kirupa.com/t/streaming-sound/61749>\
**Category:** Uncategorized\
**Created:** [August 21, 2004, 11:09am UTC](https://forum.kirupa.com/t/streaming-sound/61749 "2004-08-21T11:09:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![icestream](https://avatars.discourse-cdn.com/v4/letter/i/e19adc/32.png) [@icestream](https://forum.kirupa.com/u/icestream)\
**Post date:** [August 21, 2004, 11:09am UTC](https://forum.kirupa.com/t/streaming-sound/61749/1 "2004-08-21T11:09:29Z")

</div>

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:

```auto

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. ☹

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

Any suggestions?

thnx

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 21, 2004, 2:38pm UTC](https://forum.kirupa.com/t/streaming-sound/61749/2 "2004-08-21T14:38:11Z")

</div>

No one?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 20, 2004, 11:43pm UTC](https://forum.kirupa.com/t/streaming-sound/61749/3 "2004-09-20T23:43:34Z")

</div>

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.
