mpol777
05-10-2004, 04:41 PM
I must be spacing out. What I'm trying to do is get the percent loaded on a netStream load so I have control over when I kick off the play. Problem is with the following code bytesLoaded and bytesTotal both return as 0.
I don't want to use the setBufferTime method since that doesn't translate into how much is loaded and the size of the videos can vary greatly. So what am I missing here?
// attach front video
nc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
checkFrontProgress = function(videoRef) {
debug("videoRef: "+videoRef);
fbl = videoRef.bytesLoaded;
fbt = videoRef.bytesTotal;
debug("Loaded: "+fbl);
debug("Total: "+fbt);
fper = Math.floor(fbl/fbt*100);
if (fper >= 20) {
clearInterval(frontInterval);
videoRef.play(frontVideo);
}
}
frontViewVideo.attachVideo(ns);
frontInterval = setInterval(checkFrontProgress,100,ns);
I don't want to use the setBufferTime method since that doesn't translate into how much is loaded and the size of the videos can vary greatly. So what am I missing here?
// attach front video
nc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
checkFrontProgress = function(videoRef) {
debug("videoRef: "+videoRef);
fbl = videoRef.bytesLoaded;
fbt = videoRef.bytesTotal;
debug("Loaded: "+fbl);
debug("Total: "+fbt);
fper = Math.floor(fbl/fbt*100);
if (fper >= 20) {
clearInterval(frontInterval);
videoRef.play(frontVideo);
}
}
frontViewVideo.attachVideo(ns);
frontInterval = setInterval(checkFrontProgress,100,ns);