Forum Moderators: phranque
I would not advise to connect the webcam directly to the web, i.e. grant worldwide access to the webcams own server. If too many visitors access the device, performance will suffer. What I am using right now is sort of a selfmade proxy:
This works pretty good for me.
Here's the JavaScript for the
<head> section of the site:
<script type="text/javascript" language="javascript">
<!--
function reloadImg(tImg, tTimeout) {
if(!document.images[tImg]) tImg = tImg.name;
uniq = new Date();
newImage = document.images[tImg].src;
if(newImage.indexOf ("?")!= -1) {
uniq = "&uniqid="+uniq.getTime();
index = newImage.indexOf("&uniqid=", 0);
}
else {
uniq = "?uniqid="+uniq.getTime();
index = newImage.indexOf("?uniqid=", 0);
}
if(index > 0) {
newImage = newImage.substr(0, index);
}
document.images[tImg].src = newImage+uniq;
setTimeout('reloadImg('+tImg+','+tTimeout+')', tTimeout * 1000);
}
// -->
</script>
And this is how it gets started inside the
<body> tag: <body onload="reloadImg('webcam1',3); reloadImg('webcam2',15);"> And then of course the image(s) need to have NAME-tags:
<img NAME="webcam2" src="http://www.example.com/webcam2.jpg" width="320" height="240"> Hope that helps!