Lessons | previous |

29. Multimedia In Your Page

a. Animate my GIF!

media type: animated GIF
what it does well: time-based information, sequences, processes, cartoon style/flip card style animation
issue to consider rating comments
"hurdle" or barrier for creating media Most newer graphics programs as well as freeware/shareware can create GIF images. Many sites offer free collections of animations you can use
"breadth" of audience that can view media GIF animations can be viewed in nearly every graphical web browser in use today; no plug-ins needed
bandwidth consumption can be quite small file sizes and the data can "pseudo stream" as they play.

An animated GIF image is just an extension of the same file format used for inline GIF images we saw in lesson 7. But rather than just showing one image, an animated GIF has layers of different images, and information in the file can control how long it waits before displaying the next image, and how many times to loop through the entire sequence.

Several current graphics programs should have options to create animated GIF files. Plus, you can find free or low cost shareware programs (e.g. http://shareware.com/) that can turn a series of images into a GIF animation. And since the web is fully of dancing, blinking, and moving GIFs, there are plenty of free clip-art sites where you can download animations to use for your own pages. We provide a list of links to these sites at the end of this lesson.

Another advantage of this media type is that the entire graphics file does not have to be downloaded before it starts to play; an animated GIF will commence as soon as enough information is downloaded to display the first "frame" of the animation. Therefore, it appears to "stream" the animation and you can create animation files that are several hundred k in size that may start playing when perhaps 20% of the file has been received be the viewer.

What are some down sides of animated GIFs? The primary one is that because the movement attracts your eye, they can be distracting to someone trying to comprehend the other information on the same page. The other disadvantage so that they generally tend to be used as a novelty, and after the first few times you see the same animated teddy bear. it can start to look cliché or juvenile.

Animations can be very useful to show time-ordered information, i.e. to show changes in a feature over time (e.g. erosion of a beach, growth of a plant, changes in stock market prices) or to demonstrate a process (e.g. how to change a tire, how blood moves through the heart). Like GIF images, the files are much smaller for graphics that have large continuous regions of solid color and sharp edges, as compared to images with more spatial variation such as photographs.

b. Movie Time

Blame it on television, Hollywood, MTV, etc, but we are a society tuned to video. And with the web, we can also include information in a video format.

But just be cause you can does not mean that you should. Why not? Very simply, video is a lot, a lot, of data to send across the internet, and likely your experiences to date are those "tiny" squares of herky jerky video segments where the voices seem horribly out of synch with the action. If you think about it, to make a "moving picture" means sending a lot of still images (like the frames of old movie film) to create the sense of movement, not to mention adding a layer of audio information.

So until high speed internet access is the norm (and it might be some day), we use technology to compensate via some clever techniques that "compress" video to make the file sizes smaller, and other techniques that allow the video information to "stream" to us (meaning we see content as it is sent, not having to wait for a large file to download.

media type: digital video
what it does well: time-based information, sequences, historic events, places impossible or unsafe to experience
issue to consider rating comments
"hurdle" or barrier for creating media Special equipment needed to take video source material and convert it to digital computer files. There are low cost solutions, but they still call for special hardware, a lot of disk space, and video editing software.
"breadth" of audience that can view media To view video, you typically need a web browser "plug-in", but most newer browsers come with one already installed.
bandwidth consumption Can be quite large. Video represents a tremendous amount of information and is reduced quality over modem speeds. Options exist to "stream" content but it may require special servers.

We suggest you try to think about the use of video without comparing it to television or the movies. The worst uses are what we call "Talking heads", i.e. a person sitting still talking to you. The video adds very little, and as we see later, you can send the equivalent information using less bandwidth intensive media by combing still images and audio.

When might it be crucial to use video in your web page? Most likely will be to show something that is changes over time, like we saw in animation, but perhaps needs to have a more "real-world" look over as compared to graphics. Often it might be a historic event (the assassination of John F Kennedy). Video may be important to show us something that we cannot see easily because of location (landing on the Moon, the Mars rovers) or physical limitations/ safety considerations (deep ocean exploration, inside a nuclear reactor). Or video may be critical to demonstrating a procedure (surgery, welding a steel beam).

You can use a "digitized" movie simply to play back like video, non-stop, from start to finish. But you can also use a sliding "control" to quickly jump to any point in the movie sequence. This can allow you to explore "snapshots" of a time-based process.

Let's shift and talk about video technology. Traditionally, movies/films were recorded via a photographic process (think about movie reels) and played back through projector. To use video on a computer, all of the information must be digitized or turned into a data file, essentially a series of still images that when played back at an appropriate speed, looks to the human eye like actual motion. Generally, this is achieved when we see about 30 images every second (or "frames per second").

To create a video clip you must have some special computer hardware to take a video input (from a source such as a VCR, a television output, a video camera) to do the magic of making a video file. While several years ago this was considered high end equipment, there are many low end (i.e. cheap) tools to do this. You would also likely need some special software to edit video clips once they are on your computer, which again range from very cheap (simple) to expensive (complex, professional).

When we start talking about digital video, we enter a region of acronym soup for the various kinds of video files. Probably the most important and commonly used formats are Apple's QuickTime and Moving Picture Experts Group (MPEG). There are of course, many others, and we cannot really review all of them here. For more information visit the About.com guide to Desktop Video. For this tutorial, we will present the code to embed a QuickTime movie into your web page. While other video formats may used, such as MPEG, AVI, etc, QuickTime is the format to will be able to be used by the widest range of web browsers.

For more information on video, see the Web Developer's Virtual Library.

When the web first emerged, video clips were rarely used because, to watch them, you had to download the entire video file (which can be several megabytes for even short segments) before you could see anything. Later as web technology has evolved, solutions have emerged that allow video to be "streamed" to you, meaning when ask for video (clicking on a web page link), you will start to see the video information as soon as enough has been sent to show you a portion, and the rest continues to "stream" in as you watch the beginning parts. The leading technology here is RealNetworks; the limitation for you, the humble web page developer, is that RealVideo requires specialized servers to transmit streaming data. You can find great examples of RealVideo from the CNN news site.

It also takes some special web browser "add-ons" from the viewers end to see digital video. RealVideo and QuickTime require browser "plug-ins" to work. Fortunately, most web browsers now come with these technologies already included, but sometimes they may be updated. You should not, however count on everyone being ready to view video content!

Because video is a high bandwidth media format, as a design principle you should place video at a "click away", meaning that you present video as an option for your web site visitor to click to view, with some advance notice. We will demonstrate this in our lesson.

To include a digital video clip in a web page, we use the <EMBED> tag, which in some ways is similar to the <IMG) tag in that we specify a file source and the dimensions of the media we want inserted into the page:

 <EMBED src="video.mov" width="320" height="240"></embed>

There are other options to add to this tag to control the playback:

embed option values notes
src path to movie file name can be relative or full URL
width height dimensions of movie file  
autoplay true/false whether the movie should automatically start playing or wait for user to click the play button
controller true/false whether the movie displays a control bar the bottom
href URL location to send visitor if they click on the movie
target window name allows href to be displayed in another browser window
loop true/false whether the repeat the movie in a loop
pluginspage URL where to send a visitor that does not have the QuickTime plug-in

For more details on the EMBED parameters, see Apple's QuickTime Authoring site.

c. Sound of [web] Music

media type: digital audio
what it does well: historic events, narration, providing environmental cues, background music, grabbing attention
issue to consider rating comments
"hurdle" or barrier for creating media Hardware needed to digitize sounds is commonly built into most newer computers and may be as simple as a microphone. Free or low coast shareware can be used to edit and modify sound, and many sites exist with downloadable audio files.
"breadth" of audience that can view media Most recent computers have built in ability to play back sound and it is typically built into most web browsers. Many people will have their volume turned down.
bandwidth consumption Can be quite large but is much less than video. Small sound effect files can be small and some sound file formats (MIDI) are designed to be very small in size. Options exist to "stream" content but it may require special servers.

Sound is one of our most crucial human senses for receiving information and it can be used very effectively for web sites.

However, as you visit different web sites, the main time you come across sound is hearing some corny rendition of marching music, some vague familiar television show theme song, or tinker-toned Beethoven as soon as a web page loads. When a designer adds irrelevant graphics to a work, it is called "Eye Candy"; using sound for many web sites amounts to "Ear Candy".

"So, M. Opinionated, when is sound good?" Good question. Audio can be very useful for re-casting historic moments (speeches, special events, news, etc). It often is a less bandwidth alternative to video when the content is mostly spoken (e.g. classroom lecture). Obviously it might be used to learn about music and acoustics, to compare renditions of classic works, and simply to entertain-- the web can act as a radio. Sound may be used to set an environment (soft music for reading a poem).

Like video, sound must be converted analog to digital, from audio waves that travel through air, to numerical representations of wave frequencies. It can be done as easily as talking into a microphone plugged into the back of your computer, to high end digital recording in a sound studio. In the end, you end up with a computer file that can be played back through a speaker and, again travels through the air to your ears.

Sound files come in many different formats, which creates another layer of alphabet soup confusion. Some of the common file formats are WAVE (WAV), AIFF, AU, MIDI, MP3 etc. A comprehensive overview of the differences between them is beyond our tutorial, and we will just have to accept that we can have a sound file on a computer that can be sent over the Internet and played at the other end.

One format is of special interest, MIDI, because it generally makes for the smallest sound files. Rather than digitizing the sound waves itself, in MIDI format sounds are represented as more or less text characters representing the notes on different types of instruments, and when it is played back, the computer uses a built in sound library to play back the designated note. Therefore, the data that sent is very small. MIDI sounds tend to have a "toy-like" playback and are no where as rich as a CD audio.

Many sites offer sound in RealAudio format in which the sound files streams from a special web server to your web browser. This is most efficient for so called "web radio" stations, sites that offer real time audio news feeds, sites that promote musical events, etc (e.g. World Radio Network, RadioTower, Broadtcast.com, NPR, CNN). Because it requires special equipment, RealAudio is not part of this tutorial.

We also should mentioned the format known as MP3, or MPEG Audio Layer 3, a special form of high quality audio that can compress a very rich sound file into a much smaller file. It may be a music format that changes the music industry. You can find many sites such as MP3.com that offer MP3 music, but again, encoding content into this special format calls for special hardware and software (and touches on tricky legal issues of encoding other artist's content).

For more information on audio over the web, see the Web Developer's Virtual Library for Audio for the WorldWide Web

To include a sound file in a web page, we typically use the same <embed> tag that we saw in the previous lesson on web video:

 <embed src="muzak.wav" autoplay=true controller=false></embed>

which is the typical way to write a sound file that will be played automatically as soon as a web page is opened, and by having the controller invisible, to the person seeing your page, the music just starts playing magically. If you want to provide them the choice of playing the sound or not, you would have the controller visible and the autoplay set to false:

 <embed src="muzak.wav" autoplay=false controller=true></embed>

Again, if you are going to use music or sound in your web page, think carefully about the purpose of the content and if it will be reasonable to hear it every time a person goes to that page. You should never assume that the audio will work for every visitor (and some visitors are deaf), so consider providing text alternatives or suggestions for people that may not be able to hear the content.

More Information

You can always build a link to any media file by using our familiar hypertext link:

  Try out my latest <a href="new_riff.wav">guitar riff</a> 
  or <a href="trumpet.mid">trumpet call</a>

assuming we had a WAV file and a MIDI file with these names. The web browser will leave the page it was linked from and then try to load the sounds the best it can, in blank web page. After hearing the sound, you would have to press the browser back button to return to the page you came from. The implementation is not as seamless as embedding it in the page but it works.

d. Hit Me With a Shockwave

media type: shockwave
what it does well: synchronized media, animations, simulations, manipulatives, communicate with databases, realistic interfaces, non-linear content

What Director does well, and thus Shockwave allows you to do in a web page, is to deliver "rich" content experiences that may include text, graphics, animation, sound, video, in almost any kind of visual design you can imagine. It is powerful because it can manipulate and synchronize these different media types, as well as communicate with other systems, such as databases or other software.

The challenge to the average web page designer is that to do Shockwave well, they must learn Director, well, no small task, and not cheap software to buy. Because most shockwave designs are unique, often they cannot be easily re-purposed like "clip art" but there are some exceptions we will point out later.

One of the limitations is that Shockwave calls for extra software functionality to work in your web browser. Many web browsers and new computers are shipped with this already installed. The technology has improved enough so that if a person accesses a site that requires Shockwave, it can either start downloading the needed "parts" or send you to a site so you can easily install Shockwave on your computer. Once you have it installed for one web site, any other web site can now use this functionality.

This lesson will not cover the creation aspects of Shockwave, but will show you how to add an existing shockwave application to your web site. Shockwave files always end in ".dcr"

Because of the way Shockwave is implemented in web browsers, we actually have to write almost duplicate HTML that works for both; Internet Explorer uses a <object> tag while NetScape uses the <embed> tag (similar to what we saw for video, but with a few different parameters).

The general HTML code looks like:

<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" 
codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=7,0,2,0" 
WIDTH="480" HEIGHT="300" NAME="sw" ID="swmovie">
	<PARAM NAME="SRC" VALUE="sw_file.dcr">
	<PARAM NAME="BGCOLOR" VALUE="#FFFFFF">

	<embed src="sw_file.dcr" 
	width=480 height=300 bgcolor=#FFFFFF 
	pluginspage="http://www.macromedia.com/shockwave/download/">
	</embed>
</OBJECT>

As you may see, the <embed> tag for NetScape (shown in purple) is contained within the Internet Explorer <object> tag (shown in red). What it means is that the NetScape browser will ignore the <object> tags and the Internet Explorer browser will ignore the <embed> tags. Here is a bit more explanation of the other options in the tags:

purpose of option OBJECT tag EMBED tag
web location of shockwave installer code, redirects browser there to download needed software if not present object classid="....."
codebase="http://...."
pluginspage="http://..."
dimensions in pixels width=..., height=... width=..., height=...
identification code, can be used with browser scripting (JavaScript, VBScript) NAME="..", ID="..." NAME=".." (not required)
relative file location of shockwave file <PARAM NAME="SRC" VALUE="sw_file.dcr"> src="sw_file.dcr"
background color while loading, helps blend with color of page <PARAM NAME="BGCOLOR" VALUE="#FFFFFF"> bgcolor=#FFFFFF

We also have created two Shockwave templates that you can use without having to know anything about how Shockwave works. These are part of an online workshop that shows you how to add Shockwave and JavaScript functionality to your own web pages.

  1. The Quizzer allows you to create sets of multiple choice quizzes, where each time the quiz is taken, the order in which the questions appear, and the order in which the answers for each are displayed, are randomized.
  2. The Clicker allows you to create web-base slide shows that may include multiple sets of captions (two languages) and can have audio associated with each of the slides.

More Information

This is but one example of how shockwave turn a web site into a place that is much more than a static collection of text and pictures. You can find numerous other examples of Shockwave from: