Yesterday I had a task make stream images from ip camera. IP camera always put images to the same directory with same image name. This is a source code, whick can do this.

var tick=0;
image=new Image();
reload = new Date();
reload = reload.getTime();
image.src="http://your_domain.lt/camera/image.jpg?nocache="+reload;

function refreshCam()
{
tick++;
if(tick>3){restart=1;} else {restart=0;}
if(image.complete)
{
tick=0;
document.images["webcam"].src = image.src;
image=new Image();
reload = new Date();
reload = reload.getTime();
window.status = "";
image.src="http://your_domain.lt/camera/image.jpg?nocache="+reload;
}
if(restart)
{
tick=0;
image=new Image();
reload = new Date();
reload = reload.getTime();
window.status = "";
image.src="http://your_domain.lt/camera/image.jpg?nocache="+reload;
}
window.status = window.status + ".";
setTimeout("refreshCam()", 1000);
}
refreshCam();

And this is html code for this script


<IMG NAME="webcam" SRC="hhttp://your_domain.lt/camera/image.jpg" BORDER=0/>

This script refresh image once in a second. If you want to change time, you can do it in function setTimout(). 1000 is one second.

I hope, it will help for someone. 🙂