Determine users DL speed

Must be all the christmas festivities that have shut my brain down for today. Anyone got some code, working or suggestions for working out users download speed?

just an idea : you can do it with modify a “preloading script”… u can calculate users download speed per second…
this means that;get difference between 2 getBytesLoaded(); and calc. download speed per second…

Would be pretty cool, eh? A flash speed-test script in flash… I think it has to be some server-side scripting but I’m sure theres a way to add a tag or something that will make it download differently… It’s beyond me anyways, so phooey

i thought it again, and u can use setInterval(); for calc. DL speed per second…
maybe this helps u more…

esxs’ first idea looks good to me. You get the amount loaded at one point, you get the amount loaded a little bit after, you substract and divide by the time elapsed. Something like this:

this.onEnterFrame = function () {
// time elapsed since the last run
var elapsed = getTimer() - this.time;
this.time = getTimer() ;
// bytes loaded since the last run
var downloaded = theClip.getBytesLoaded() - this.loaded;
this.loaded = theClip.getBytesLoaded();
// speed in bytes per millisecond
var speed = downloaded / elapsed;
}[/As]By the way, setInterval would seem very appropriate for this because you can control precisely the timing, but unfortunately, the function is not precise at all...

thx for the sample code Ilyas … i don’t have enough time to write it, but this is what i want to explain…
and u r right about the setInterval…just an idea :slight_smile:
nice cooperate :wink: