PDA

View Full Version : Netstream - checking bytesLoaded


Sekter
04-23-2008, 03:04 PM
In FLVplayback I can easily say: PlayerVideo.addEventListener("progress",Video_PROGRESS);

function Video_PROGRESS(eventObject:Object):Void
{
//CONTINUOUSLY compare bytesLoaded and bytesTotal until bytesLoaded = bytesTotal
}


However in netstream the only event i have is: onStatus which is pretty useless since it will only execute once, so to be able to continuously check for the bytesLoaded I am having to do something like:

var intervalID = setInterval(test,5);
function test()
{
if(stream_ns.bytesLoaded == stream_ns.bytesTotal)
{
stream_ns.pause(); //meaning resume
clearInterval(intervalID);
}
}

Is this the best way to do what i want or am i missing something that i can use in netstream?