View Single Post
  #11 (permalink)  
Old 02-26-2008, 01:02 AM
kgun's Avatar
kgun kgun is offline
WebProWorld 1,000+ Club
 

Join Date: May 2005
Location: Norway
Posts: 5,071
kgun RepRank 3kgun RepRank 3
Default Re: Live Camera Feed to Web Page

Quote:
Originally Posted by Alan-Hart View Post
This JavaScript will load new images from a 640 × 480 webcam as fast as your connection (or the server's) can supply them, without caching problems. It requires the "document.images" object, though could easily be updated for more modern DOMs by using document.getElementWithId(). You mean document.getElementById().

<script type="text/javascript" language="JavaScript">
newImage = new Image();
function LoadNewImage()
{
var unique = new Date();
document.images.webcam.src = newImage.src;
newImage.src = "http://path/to/webcam.jpeg?time=" + unique.getTime();
}
function InitialImage()
{
var unique = new Date();
newImage.onload = LoadNewImage;
newImage.src = "http://path/to/webcam.jpeg?time=" + unique.getTime(); document.images.webcam.onload="";
}
</script>
<img src="http://path/to/webcam.jpeg" name="webcam" onload="InitialImage()" width="640" height="480">
May be that script is good enough, but is it crossbrowser compatible?

Good starting point.
Reply With Quote