Webcam32 FAQs       User's Guide       Java Support       Help Wizard


JavaCamPush tutorial

JavaCamPush is the name given to Webcam32's ability to push images directly to a Java applet included in a web page.

This section provides a step-by-step tutorial with samples on setting up a web page to use JavaCamPush.  To get the most out of this tutorial, review the JavaCamPush documentation for Webcam32 here.  Don't worry if it seems too complicated at first, the purpose of this tutorial is to simplify the setup and usage.  After you have used it for a while, you will realize that it is not as difficult as it may have initially seemed.

 



Part 1 - The idea

This part describes the principles of how JavaCamPush works.  Reading this section makes clear the tutorial steps that will be followed in other parts.  For the impatient, you may jump directly to Part 2 if needed.  If you encounter problems, please come back and read this section.

JavaCamPush is one of two primary techniques within Webcam32 to achieve streaming video.  Streaming video is the ability to have images within a web page continuously update as fast as possible presenting the appearance of real-time video.

Webcam32 is able to provide this function by continuously capturing a new, still frame (image) from the video capture device and sending that image to the browser.  As Webcam32 sends frame after frame, the appearance to the end user at the browser is that of a continuously updated video.

In order for Webcam32 to be able to send that image to the browser, the web page that the browser is viewing must contain a Java applet.

What is a Java Applet?

A Java Applet is a computer program written in a programming language called Java.  Java is a highly portable language.  This means that a program written in Java will run perfectly well on Windows as well as a Mac or a Unix machine.  The Java Applet is dynamically copied from a Web server when a browser views a page which contains a reference to that applet.  The browser downloads the applet and runs it in a secure environment (often called a sandbox.  Within this environment, the applet can not access any files on the computers disk or form any network connections to other machines.  This prevents a malicious or broken applet from damaging your computer.  The browser runs the applet and the the applet can change an area of the browsers window or interact with the user of the browser.


The Webcam32 applet that supports JavaCamPush is called, unsurprisingly, JavaCamPush.

When a user with a browser surfs to a web page that contains the JavaCamPush applet, JavaCamPush will contact Webcam32 over the Internet and ask for a stream of live video frames.  These images will then be sent as quickly as possible from Webcam32 to the applet.  The JavaCamPush applet will obtain the images and display them, one after another.

In order for the browser to form a connection to Webcam32 to receive the stream of images, the JavaCamPush applet must know how to connect to Webcam32 to receive the images.  This is achieved by coding into the HTML of the web page that contains the JavaCamPush applet, the TCP/IP address of the PC running Webcam32.

Lets read that again, this is where the majority of mistakes occur when configuring JavaCamPush.

The HTML of the Web page must contain the TCP/IP address of  the computer running Webcam32.

What is a TCP/IP address?

When someone calls you on the telephone, that person needs to know your telephone number.  TCP/IP addresses are the telephone numbers of the Internet.  When you wish to contact a remote computer from your PC, your PC needs to know the TCP/IP address of the machine that you wish to contact.  TCP/IP addresses are written in a format like 209.132.50.16.  This is 4 decimal numbers separated by a period (".").

When you or I make a telephone call, we normally remember or have written down a telephone number and dial it immediately.  But what if we don't know the number of someone we wish to call?  The answer is that we can look it up in the telephone book or call the operator.  How would you find the telephone number for your local cinema?

On the Internet, a service called the Domain Name System or DNS performs this lookup of TCP/IP addresses for us.  Instead of having to remember the, meaningless, TCP/IP addresses, we remember the names of computers on the Internet such as www.surveyorcorp.com.  When we refer to a name such as this (called the domain name), inside the computer, it is internally converted to its corresponding TCP/IP address.

For fun (some fun huh?) open a DOS window and enter the command:

PING WWW.SURVEYORCORP.COM

You will then see the TCP/IP address of the computer known as www.surveyorcorp.com.  Try some other computers, for example www.yahoo.com or www.microsoft.com).


By telling the HTML of the web page containing the JavaCamPush applet your TCP/IP address, the applet can then contact your PC directly and start requesting images from Webcam32.

Each and every computer connected to the Internet has a TCP/IP address.  When you connect to the Internet, you too have a unique TCP/IP address.  For the majority of users reading this, you will use the services of an Internet Service Provider or ISP.  The ISP is the company from which you buy Internet access.  Whenever you dial the ISP provided telephone number from your computer's modem, the ISP dynamically assigns your PC a new TCP/IP address.  This means that each and every time you connect to the Internet from your PC, the chances are high that you will get a new TCP/IP address, different from the one that was assigned to you the last time you connected.

Webcam32 can be configured to modify the web page containing the JavaCamPush applet each time Webcam32 is started.  This ensures that even if the TCP/IP address of your PC has changed, the web page will contain the correct reference to your PC.

Sound simple enough?  In fact it is this simple ... in principle.  The challenge of JavaCamPush is getting the parameters correct.  Next we provide a tutorial for setup.



Part 2 - Setup

Setup of JavaCamPush comes in two parts.

Setup of Webcam32

Setup of Webcam32 involves installing the product.  This is covered elsewhere in the Webcam32 documentation.

To setup Webcam32 for JavaCamPush specifically, requires opening the TCP/IP settings dialog of Webcam32.  This can be done either by pressing the TCP/IP button on the toolbar ...   Alternatively, selecting File and then Preferences, then TCP/IP from the menu will achieve the same result.

Select Features:



Select Access:



After changing these, press OK for the changes to take effect.

Setup of the Web page

To setup the tutorial web test web page, you must download the following ZIP file:

Sample JavaCamPush tutorial page

Create a folder (directory) on your PC to hold the contents of the ZIP file.  For this tutorial, we suggest C:\JavaCamPush

Extract the contents of the downloaded ZIP file into this folder.

The folder should now contain the following files:

The sample page is trivial.  It contains very little other than the JavaCamPush applet reference.  Once we have completed basic testing, this page can be modified using an HTML page editor to contain the text and images of your own web page layout.

It is very tempting to modify the sample page at this point.  Don't do that for the initial tests.  It is easy to corrupt the page.  Once you have a basic page working, change the page incrementally to suit your own content.

The sample web page must be uploaded to your Webserver.  This requires that you have configured Webcam32 for basic FTP image upload.  This is described in detail:

Once basic still image FTP setup has been configured, the IP Upload capability of Webcam32 must be setup.  In the IP Upload menu of the FTP Settings dialog (see below), the following changes must be made:

Once these settings have been entered, press the Upload Now button to upload the page immediately.  The page will be re-uploaded every time we restart Webcam32.



When Webcam32 uploads the page, the HTML is modified before upload to include the current TCP/IP address of the machine running Webcam32.



Part 3 - Testing

At this point, we should have configured Webcam32 as described above.  We are now ready for testing.

Make sure that Webcam32 is running and shows a video preview.

Start a browser (either Netscape or Internet Explorer will be fine).  In the URL to surf to field at the top, enter the URL to your personal pages on the Webserver and the page javacampush.html.

For example, if your Webserver page is

http://www.myisp.net/~johndoe

enter

http://www.myisp.net/~johndoe/javacampush.html

The page should load and the Webcam32 JavaCamPush applet should display with live video images.


Additional JavaCamPush references