Inserting movies and audio files into a page can be a frustrating experience. The HTML for working with movies and sounds is treated differently among different browsers. Microsoft Internet Explorer 3.0 and Netscape Navigator 3.0, for instance, recognize and interpret the same code in their peculiar ways--depending also on installed features and defaults--and a work-around solution for one won't work the same for the other.The following illustrations, therefore, are compromises adequate for both browsers but do full justice to neither one. Playing MoviesMovie files come in a variety of formats, a common one being AVI (Audio Video Interleave), which is used in the following illustrations. Similar techniques can be used for other formats. Also, since movie files can be quite large, it is usually best not to embed the movie for automatic play when the page is opened; the wait for downloading and playing can be lengthy. Rather, a link from text or a graphic image is used.The GIF image shown here (captured from the screen while the associated movie was playing) has been defined as a clickable image to download and play the movie. Try it. When you click on the image, the movie is played in different formats depending on which browser you are using and the particular features installed. If you are using Internet Explorer, for example, the movie may play in an "external" viewer (usually mplayer.exe), outside the browser. Netscape Navigator, on the other hand, may play from inside another page in the browser (as may Internet Explorer if you have both browsers installed and Explorer uses the playback features installed with Navigator). The particular program used to play the movie and the availability of controls to start, stop, and replay the movie depend on which system application is associated with the particular movie format. It's difficult to say exacly how your browser will react. (If this movie plays on a web page with a white background, you won't be able to see that it is located in the upper-left of the screen. Just click there and it will play). The HTML code, however, is the same for both browsers and the same as for other links--in this case it is to a movie file: <A HREF="movie.avi"><IMG SRC="image.gif"</A> (Recall, there are additional <IMG> parameters that can be included to control the size and placement of the clickable image.) Playing SoundsIn the same fashion as for movies, sounds can be played from your page (if you have a sound card installed, of course). Again, several different formats are available (WAV, AU, AIFF, MIDI), all of which should be playable through the sound application on your system. Click on the image at the right to hear its associated sound. The particular player used will vary depending on your system and browser configurations.The HTML code for playing a sound file from a clickable image is the same as for playing a movie:
<A HREF="sound.mid"><IMG SRC="image.gif"</A>
Here, though, is where browsers differ significantly in their handling of embedded images. No standard HTML is available, so you have to decide whether to design you code for either Navigator or Internet Explorer, or perhaps both. To see the differences, click on the image that represents your browser to go to the page that handles it your way.
|