Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Background Music to Website

Status
Not open for further replies.

slycer

Technical User
Nov 22, 2002
84
0
0
US
Hi...I am creating a website and cannot remember the source code to have music playing in the background. I beleive its something like <body bgmusic=&quot;soung.wav&quot; or something like that. Can anyone provide me with some help on this?
 
For Netscape you'll want to do this.
Code:
<embed src=&quot;yourmusicfile.mid&quot; autostart=&quot;true&quot; loop=&quot;true&quot; width=&quot;2&quot; height=&quot;0&quot;>
 </embed>

For Opera, and IE, do this
Code:
<bgsound src=&quot;yourmusicfile.mid&quot; loop=&quot;infinite&quot;>

&quot;Hey...Where are all the chicks?&quot; -- unknown
 
I am very very new to all this. But when music is added, does it make a site load slower? Much slower?
 
depends on the size of the music file. MIDI files are usually quite small (and quite annoying). WAV files and MP3 files are much larger, but marginally less annoying. the larger the file, the longer the download. If you include wav files or mp3 files on your site and the song's length is more than a few seconds, chances are your visitor will have browsed away from your page before the file has even finished downloading (unless you've explicitly told them not to, and they are far more patient than i am). And if they don't browse away from the site and they are not expecting to hear a sound, it can be quite a jarring experience to hear a sound coming from your computer when you don't expect it (as there will likely be a long delay). <p>Liam Morley<br><A HREF="mailto:"></A><br>&quot;light the deep, and bring silence to the world.<br>light the world, and bring depth to the silence.&quot;
 
Personally, I think having a song play continously on a website while you are surfing on it, is quite annoying. I am builidng this site for someone else.
 
if you have access to it, you might want to consider using macromedia flash for your background music. as you can stream an mp3 that way, users won't have to wait long, and you can build an interface which makes it easier to turn off. i've always found sites with the background music done in flash significantly less irritating, though that's just my opinion. <p>Liam Morley<br><A HREF="mailto:"></A><br>&quot;light the deep, and bring silence to the world.<br>light the world, and bring depth to the silence.&quot;
 
Except that the load time for the flash file would be more, and the user would need the Flash plugin. Background music is typically a no-no of site-design. That being said embeding it and the src tag and the bgsound tags are prob. the best... Make sure to check it against w3c's verifier to make sure both tags are legal. if they aren't the verofier may have a suggesion on what it should be.
 
I have a web site which contains background music. The music plays all right in all my browsers. But when I try to validate the pages, the only thing that comes up as not valid is the code for the background music.
This is my code:

<bgsound src=&quot;sounds/NA2earth.mid&quot; loop=&quot;infinite&quot; />

These are the errors I get:

Line 14, column 13: there is no attribute &quot;src&quot;

Line 14, column 40: there is no attribute &quot;loop&quot;

Line 14, column 52: element &quot;bgsound&quot; undefined

This is the explanation to the first two errors:

“there is no attribute ‘FOO’ for this element (in this HTML version)”
You have used an attribute with an element that is defined not to have that attribute. This is most commonly caused by using vendor-specific attributes without setting the document type appropriately.

This is the explanation to the third error:

“element ‘FOO’ undefined”
You've used an unknown tag (represented here by ‘FOO’). Make sure the DTD indicated by your DOCTYPE actually includes this element.


And this is how my DOCTYPE is set:

<!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
&quot;
<html xmlns=&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;>

Any suggestions as to how I can get this to validate?

Sailor Skip
 
An interesting side note:

You can use a bgsound tag inside an html email. In the case of outlook 98/2000/XP, it's easiest if you create a small html file with the bgsound tag in the body. Then use the file as a template for a signature. The tag should look like <bgsound src=chimes.wav>; you directly reference the sound file. Once you have the signature, start a new message. Insert the sound file first, then insert the signature. When you send the message, there is no attachment symbol, and the sound file will play even in the preview pane.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top