There is one other form of inline multimedia generally available to web surfers--audio. Most browsers treat audio multimedia as separate documents, downloaded and displayed by special helper applications, applets, or plug-ins. Internet Explorer, on the other hand, contains a built-in sound decoder and supports a special HTML tag that lets you integrate an audio file with your document that plays in the background as a soundtrack for your page. [the section called "Applets"] [the section called "Embedded Content"]
We applaud the developers of Internet Explorer for providing a mechanism that more cleanly integrates audio into HTML documents. And the possibilities with audio are very enticing. But at the same time, we caution authors that the special tags and attributes for audio don't work with other browsers, and whether this is the method that the majority of browsers will eventually support is not at all assured. So, beware.
Use the <bgsound> tag to play a soundtrack in the background. This tag is for Internet Explorer documents only. All other browsers ignore the tag. It downloads and plays an audio file when the host HTML document is first downloaded by the user and displayed in their browser. The background sound file also will replay whenever the user refreshes the browser display.
The src attribute is required for the <bgsound> tag. Its value references the URL for the related sound file. For example, when the Internet Explorer user first downloads an HTML document containing the tag:
<bgsound src="audio/welcome.wav">
they will hear the welcome.wav audio file--perhaps an inviting message--play once through their computer's sound system.
Currently, Internet Explorer can handle three different sound format files: wav, the native format for PCs; au, the native format for most UNIX workstations; and MIDI, a universal music-encoding scheme (see also Table 5.1).
Format | Type | Extension | Platform of Origin |
---|---|---|---|
GIF | Image | gif | Any |
JPEG | Image | jpg, jpeg, jpe | Any |
XBM | Image | xbm | UNIX |
TIFF | Image | tif, tiff | Any |
PICT | Image | pic, pict | Any |
Rasterfile | Image | ras | Sun |
MPEG | Movie | mpg, mpeg | Any |
AVI | Movie | avi | Microsoft |
QuickTime | Movie | qt, mov | Apple |
AU | Audio | au, snd | Sun |
WAV | Audio | wav | Microsoft |
AIFF | Audio | aif, aiff | Apple |
MIDI | Audio | midi, mid | Any |
PostScript | Document | ps, eps, ai | Any |
Acrobat | Document | Any |
Like Internet inline movies, the loop attribute for the browser's <bgsound> tag lets you replay a background soundtrack for a certain number of times (or over and over again forever), at least until the user moves on to another page or quits the browser.
The value of the loop attribute is the integer number of times to replay the audio file, or infinite, which makes the soundtrack repeat endlessly.
For example:
<bgsound src="audio/tadum.wav" loop=10>
repeats the ta-dum soundtrack ten times, whereas:
<bgsound src="audio/noise.wav" loop=infinite>
continuously plays the noise soundtrack.
There are other ways to include audio in your documents, using more general mechanisms that support other embedded media as well. The most common alternative to the <bgsound> tag is the <embed> tag, originally implemented by Netscape. Because of its more general nature, we cover the <embed> tag in 13.2.
This HTML Help has been published using the chm2web software. |