Streaming MP3

By pgstudio | Jun 25, 2009

actionscript3

HI guys…

i´m having some problems with buffering sounds.
i´m doing a MP3 player for my site and everything seems ok except that i can´t get the full length of a sound before it finishes downloading/buffering and it´s messing my progressBar.

that´s my code:

position = (soundChannel.position / sound.length);

sound.length returns the total length of the downloaded data at the momment and not the full length of my Mp3 file.

Let´s say i have a 1minute long Mp3 file and i only downloaded 30secs of it,
if my playback reaches 15secs of the sound, it will say that i´m at 50% of the song and not 25%.
Is there anyway to know the full length of a file before it finishes downloading ?
So i can make a buffer download progress bar (like youTube does, so you know how much u have downloaded)
and a songProgressBar.

I´ve read some things about the NetStream class but i don´t know if it will solve my problem.

i don´t have Flash media server.. it would load the file form the local file system.

Thanks for the help! :)

Cheers..
PG

actionscript3

Please reply at our Forum

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

© 2007 ActionScript 3.0