Refresh the Webcam Image
Once you've decided which kind of WebCam are you going to set up, you need to know how to make it refresh the image...
Refreshing the image
To get the latest shot captured by the WebCam, users connecting to your page will have to Reload it, unless you
does not apply to the Server push method, since it is continously streaming a video feed).
META tag command: The oldest method (still in use though) of refreshing a WebCam image on a Web page is made via a set of HTML commands.
There is an HTML tag than can make a web page to auto reload after a period of time (in seconds) is reached.
The syntax for this tag is as follows:
<META HTTP-EQUIV=REFRESH CONTENT="seconds">
Where seconds is the number of seconds it will take the browser to Reload the current page.
The most significant disadvantage of this method is that the whole page is reloaded, so a heavy graphics site will be a pain to reload on slow connections and will result on high bandwith (Internet connection) usage.
Alternatively, you can use this method if you fit the image into a FRAMESET tag, that is, compose a web page with FRAMES, so a very little frame is used to store the HTML code for both the image and the META tag. Later on this tutorial you'll visit some samples of this method.
If, however, you don't like frames, then you'll need to switch to the use of Java Applets.
Tip: There are some old browsers with a small bug which doesn't allow to refresh an image after some reloads. This is not our intention (we want the pic updated all the time), so Jason Millers gives us some input on this issue:
"I had the cache bug annoying me in my WebCam page. I added the following to the header and it works now:"
<META HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
Java Applets: Small programs embedded inside a Web page, executed in realtime, which will load the WebCam images freeing the browser from that job.
There are tons of Java Applets built by the users or by third party companies. All of them have one thing in common: you can put them anywhere (almost!) in your WebCam page and they'll refresh the image for you, without refreshing the whole page; just the image.
The main idea is to put the HTML codes to call the applet where you want the image displayed and configure its parameters.
May be, one of the most popular Java Applets in the Net (and easy to set up too) is the JavaCam Applet (its usage is well explained in the next section of this tutorial).
We also recommend to take a look at AnfyTeam's AnfyCam Java Applet, part of a collection of Java applets for your Web pages. The good point of this applet is that it has a nice graphical interface where you enter the parameters and it generates the necessary HTML and Java files, ready to be uploaded to your server.
OK, now let's decide which is the best Cam hardware that will fit your needs.