How do I put background music on my web page?
Its fairly simple to put a background music (wav, midi, mp3 or aiff) file on your web page but first you have to consider your visitors. Never put a sound that plays automatically in the background with no option for the user to turn it off. In fact, it would probably be best to give your visitors the choice of turning on the music only if they want to hear it.
The <EMBED> tag is the most common way of adding sound to a Web page. Its advantage over the <BGSOUND> tag is that it is supported by both browsers, and more consistently across the PC and Mac platforms. The <EMBED> tag introduces many features that aren't supported by <BGSOUND>. Furthermore, while the <BGSOUND> tag only supports background sounds, the <EMBED> tag also features an interactive interface (including various buttons to play, stop, and handle the sound). Let's take a look at the <EMBED> tag in action
(requires a sound-enabled browser)
The HTML code that generates a control panel is very simple:
This code:
<EMBED height="20" SRC="BLUES.MID" VOLUME="50" loop="true" controls="console" AUTOSTART="FALSE" width="128">
Will produce this console:
|