REALbasic Development
Volume Number: 16
Issue Number: 4
Column Tag: Programming
Rapid Development with REALbasic
by Erick J. Tejkowski
Extend REALbasic to suit your needs
Introduction
Long the "Holy Grail" of computing, video is finally coming of age in the computer
world, but Mac users have known this for some time. QuickTime has been around for
awhile now and so has sophisticated video hardware for the Mac. With the explosive
growth of the web in recent years, hundreds have wired their web servers with a
variety of video camera devices, broadcasting to the worldviews of local scenery,
photos from home, or pictures of the family pet.
Luckily, Apple has been involved in one way or another with desktop video from the
start. With pioneering technologies in software and hardware, multimedia has usually
appeared first, not to mention the best, on Macintosh desktops.
This article will continue in that tradition and describe how to make a web-based
camera that will periodically post photos to a web site for the world to see. The reader
will also discover how to incorporate these abilities into their own designs, including
stop-motion photography, home surveillance, and other fun experiments.
Requirements
Since this project is a bit more hardware related than usual, a brief discussion about
the programs requirements might be in order. First, there is a question of video
hardware. For a camera, any typical video composite signal is fine. Video hardware
that produces composite video usually has S-Video and/or RCA jacks like those on your
home stereo. Since most people have a video camcorder these days, we will focus on
them. Web cams also make a fine choice, as do digital cameras (if they have composite
video output). If you have no camera, but would still like to experiment, a VCR will do
as a video source. Unfortunately, QuickCams© will not work for this project, nor will
USB devices. These have more sophisticated software requirements, and as such, do not
fit into this beginner's style article.
In your computer, you will need a video-input card. Any AV Mac will do, as will as any
third party video cards available on the market. Again, it will need a composite video
input to interface with the camera described above. To set up your hardware, simply
connect the composite video output of the camera to the composite video input of the
video card.
To create the software, a few decisions had to be made. To better illustrate the beauty
of REALbasic's simplicity, it was decided that the reader should be able to create a
working application with only a modicum of effort and expense. Thus, to expedite the
capture of video, we will use Apple's own video technology. The Apple Video Player,
available with most versions of the MacOS including compatible 68K versions, will
bear the responsibility of capturing the video. True capture capabilities can be added
to REALbasic, but they are not free and are a bit more complex to program. They will
be discussed later, however, for those programmers wishing to expand their video
horizons. To interface with the Apple Video player, the REALbasic application will use
AppleScript. Since AppleScript is installed with the operating system, this
requirement should also not be much of a problem for most users.
The final consideration before embarking on this project was the subject of FTP. Once
the photos are captured, we will want them to be transferred to a web site for viewing
by a web browser. FTP is not really a beginner's topic. Although several classes
already exist that will help you in your FTP endeavors, this project will remove the
added complexity of adding FTP to your application. Furthermore, the solution will
preclude the need to purchase space on a web server. Like it or not, many beginners do
not have FTP accounts at their disposal. How will all of these objectives be met? (....
Enter drum roll....) iDisk! In case you haven't heard, iDisk is part of the greater
iTools services offered by Apple on their web site. Registration affords you an email
account, 20MB of disk space on the server, personalized greeting cards, and a host of
other features. The best part, however, may be that it's completely free! For those of
you who have not made the jump to MacOS 9 (a requirement for registration), check
the reference section at the end of this article for suggestions about how to use iTools
with older operating systems.
For this project, we will utilize iDisk. iDisk is a 20MB partition on Apple's web
servers for you to store files. On the disk, you can store text, video, pictures, and
more just as you normally do with web servers. iDisk is a bit different though in that
you can also mount your iDisk directly on the desktop! The mounted iDisk acts just like
a hard drive in the Finder. You can copy, delete, and "Get Info" to your heart's content.
Now, the issue of FTP merely becomes a matter of saving a file to a disk, something
that can be accomplished in REALbasic with only one line of code. The operating system
takes care of the rest for us. To reiterate, Listing 1 details what you will need for the
project. One final note to make is that this project can even be completed using a demo
version of REALbasic, though your applications will expire after five minutes of use.
Listing 1. Project Requirements
______________________________
A video camera.
A Mac with a video input card.
REALbasic version 1 or 2
AppleScript
Apple Video Player