...

View Full Version : checking if web cam image is finished loading



raoul
08-05-2002, 03:08 PM
Hi,

I wonder if this is possible. I have a webcam application with a live stream.

I can't get the front-end applet to work so I am trying to do something with javascript.

the end user connects directly to the machine with the web cam through a port:

http://user.ip.here.portno/cam.jpg

To get the fastest stream possible it is necessary to check if the current frame/jpg has finished loading so the next image can start loading. The problem is that images are not cached.

Can this still be done and how to set it up?
raoul

joh6nn
08-07-2002, 04:37 AM
Image has a boolean property, called "complete", which tells you if the image has finished loading or not.

however, a better way to do it, would be to use the "onload" event of the image. everytime the image finishes loading, you can refresh the page.

document.images["picture"].onload= function() {
window.location.reload();
}

raoul
08-07-2002, 03:22 PM
Thanks John,

Actually I was trying all sort of things and what I ended up with is almost similar as your solution.

Simply:

<img name="image1" src="image.jpg" onLoad="newImage()">

works quite well as I use two layers on top of eachother to prevent the image from blinking during loading. When the image is finished loading the layer is made visible and loading of the new image in the other layer is started.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum