NetworkCam

CMP home Downloads Menu no menu Last updated 2004-06-28 by Roedy Green ©2002-2004 Canadian Mind Products.

Introduction

NetworkCam is a Java Applet that lets you view streaming video from web cameras that servers present as a series of still jpg images. It is different from the competition in that: It would be easiest to get your webcam broadcast working with the server and client software that came with your webcam, then only once it is working, flip over to NetworkCam client so you can enjoy its special rate control features. It least get it working to the point where you can view the images in your browser by clicking reload manually to refresh before you start fooling around with NetworkCam.

What Do You Need?

You need some basic familiarity with HTML, webservers, URLs, zip files, jpgs, Applet tags and uploading to websites. You don't need any knowledge of Java. If you don't have that, find a friend who does and bribe him with a nice dinner to get this set up for you. It is not at all hard for someone who knows these basics.

You need some sort of webcam and software to serve (broadcast) jpeg, gif of png pictures over the internet using HTTP: protocol. NetworkCam presumes some other software is already handling that.

To use it, you must compose an HTML page with some embedded commands in it that control how fast you want the pictures to refresh.

Your webserver automatically sends a copy of the NetworkCam Applet jar to anyone wanting to view your stream. All they need do is browse your webpage to trigger this. The Applet runs in the viewer's browser, and automatically fetches pictures at the rate you specify.

You need to upload a piece of html similar to the following example and also the networkcam.jar file to your website using at FTP uploader (unless, of course, it your webserver is running on your local machine.)

HTML

Typical HTML looks like this to access your camera stream and display it in a browser.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<body>
<applet code="com.mindprod.networkcam.NetworkCam.class"

archive="networkcam.jar"

align="top"

width="320"

height="240"

vspace="10"

hspace="10">

<param name="RefreshFast" value="10">

<param name="RefreshSlow" value="60">

<param name="RefreshTimeout" value="30">

<param name="Image" value="http://pmovid32.uoregon.edu/jpg/image.jpg">

<p align="center">

<img src="http://pmovid32.uoregon.edu/jpg/image.jpg"

alt="Static View"

width="320"

height="240"

align="top">

</p>
<p align="center">
If you were using a Java-enabled browser, you would
<br>
see a Java applet continuously updating the image.
<br>
Click your browser's Reload/Refresh for a new snapshot.
</p>
</applet>
</body>

</html>

What is all this gobbledegook?

Most of it you don't need to understand, just copy exactly as is.
HTML Tag Meaning
archive="networkcam.jar" This tells the browser where to look for the Java Applet program. The browser will look for the usual unsigned version in networkcam.jar or if you want to use the special signed version for experimenting you would specify signednetworkcam.jar.
height="240" Means you want an image 240 pixels (dots) tall. It works best if you pick a number the same size as your original stream. If you want to magnify, it works best to pick a height twice or 1.5 times as big as the original. If you want to shrink, it works best to pick a size half as big. Magnifying gives fuzzy images. Shrinking transmits much more slowly than sending a small original would. Your camera software may give you the option of simultaneously broadcasting several sizes. You can flip back and forth by changing web pages. Note, you have to specify the height in two places, once for Java and once for people who don't have Java.
width="320" Means you want an image 320 pixels wide. Use the same magnification factor you used on height or the aspect ratio will be distorted and the image will look stretched. Note, you have to specify the height in two places, once for Java and once for people who don't have Java.
<param name="RefreshFast" value="10"> This says you want the pictures to refresh every 10 seconds at first. If you leave this parameter out entirely, 10 is the default.
<param name="RefreshSlow" value="60"> This says you want to pictures to slow down and refresh every 60 seconds after a while. If you leave this parameter out entirely, 60 is the default.
<param name="RefreshTimeout" value="30"> This says you want to pictures to refresh at the fast rate for 30 seconds before reverting to the slow rate. If you leave this parameter out entirely, 30 is the default.
<param name="Image" value="http://pmovid32.uoregon.edu/jpg/image.jpg"> This is the URL of the camera stream. Normally, it will be your website where the stream originates and the directory where the networkcam.jar also lives. Technical note: you cannot access a stream on a server other than where the jar originated from unless you use the signed version of the jar.

Use Without The Internet

You can also use this program without the Internet on a single machine or on a LAN. Your URL will look a little different:
file://localhost/E:/jpg/image.jpg
where E: might be a local or remote mapped drive. Or perhaps using the physical IP address:
http://192.168.2.100/jpg/image.jpg
If the Applet jar is not in on the same machine as where the stream is coming from, you must use the signed version of the Applet.

Multiple Streams Per Page

Just repeat the whole section from <applet to </applet> with different sizes, and streams. You might arrange them in a grid using the HTML table command. See The HTML cheat sheet for basics on how to decorate and arrange your web page.

If you have many streams visible on many pages, only the streams currently visible on screen are actually pumping any data. All the others scrolled offscreen or on other pages are automatically suspended. They automatically restart when you bring them back into view.

Signed Or Unsigned?

There are two versions of the Applets included networkcam.jar and signednetworkcam.jar. One is the usual unsigned Applet. It has the restriction it can only view streams originating on the same machine the jar was loaded from. The signed version bypasses that restriction. However, you must click GRANT to give the Applet the priviledge to do this unusual thing that ordinary Applets are not permitted to do. The signed version is slower to start up since Java goes through extra security checks when it loads it.

Testing

You can test using the signed version of the jar and other people's streams such as:
http://scicam.eou.edu/jpg/image.jpg
http://216.199.98.162:8888/jpg/image.jpg
http://195.24.63.230/cgi-bin/image640x480.jpg
http://c-cam.uchicago.edu/cgi-bin/hugesize.jpg
http://pmovid32.uoregon.edu/jpg/image.jpg
http://207.245.67.113/cgi-bin/fullsize.jpg

The Competition

If NetworkCam is not what you want, or if you need extra pieces to fit in with NetworkCam, try looking at the list of competitors at help4webcams.com.

Warnings and Troubleshooting

  1. This program is for non-military use only.
  2. If it does not work, check the Java console for error messages. You can turn on the Java console either in browser preferences or in the Windows Control Panel under Java plug-in.
  3. This program does not work in Opera 7.21 due to a bug in Opera's URLConnection implementation. It has been tested to work in Netscape 7 and IE 6 with Java 1.4. It has also been tested with IE 5.0 and Java 1.1.4. For it to work in with Microsoft's JVM, you will have to recompile it with an old Java compiler.
  4. If you have a slow connection, you may notice the refresh appears to be somewhat slower than you requested. This is because it waits 10 (or whatever you configured) seconds after finishing loading one image before starting the next. If it took 5 seconds to load on average, it would take then 15 seconds before you saw the next image. This way it never tries to refresh faster than the communication line can keep up.
  5. If you refresh too fast, or click too fast, you may not see images changing as fast as you would like because the server may only be able to produce images at some given rate. There is no point it trying to refresh the images faster than they are produced. Every time you click, NetworkCam obediently abandons the current background refresh download and immediately starts a fresh one. If you were to click frantically and continuously, it would never get a chance to finish a download, and you would never see any changed images until you stopped clicking.

Costs

$10.00 USD ($10.00 USD) for the Applet with source code registration. You can use it free as long as you want. Nobody is going to come after you if you don't register. Registering help support development of software like this.

DOWNLOAD


You are visitor number
2771.
You can get an updated copy of this page from http://mindprod.com/zips/java/networkcam.html