Buffering video


To simulate a buffer for a small vídeo for the internet, I applyed this code on the preloader:

bytes_loaded = Math.round(this.getBytesLoaded());
bytes_total = Math.round(this.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
loadbar._width = getPercent*460;
loadText = Math.round(getPercent*200)+"%";
if (bytes_loaded >= bytes_total/2) {

So when half of the file has been loaded, it will play, but show on the loadbar of the preloader that “ALL” the video has been downloaded.

The problem is that not all of the internet conection will be fast enough to load the other half of the video in time to play without pauses.

How could I change the above code so flash could detect the conection speed or someting like that so it will play the video in the right time, just like quick time player?

Is that possible or is there another easier way to do this?

thanks for any help…