top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

How can I add background music to my web page?

+3 votes

I want to put background music on my web-page.

posted May 5, 2014 by Ritika

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Music can be added to pages with the <EMBED> tag adding music to web-pages can be problematic, some browsers need additional plug-ins and sometimes browsers cannot play the sound file if the embed tag is in a table, but probably the biggest problem is that HTML coders reach a certain skill level and get to a stage where they start to think of adding whistles and bells to their code, or more accurately start to think
"I'm gonna download the best mp3 on the web and let visitors to my web-page listen to it, oh no wait, what am i saying, 'let them listen to it', if i give visitors the option of listening to it they might miss it completely and never know what good taste i have, let alone what a good coder i am, i know, i'll make them listen to it !!"

the next stage is wondering why the web-page with the new 10 MB mp3 takes so long to load and the the mp3 plays a small chunk of the song followed by silence followed by another small chunk of music then silence again and so on, and still the page has not loaded.

the clue to that is the 10 MB file size, it takes as long to load on the page as it did to download from the web, except now the file-size of the page also has to be downloaded by the user.

only .mid music files of 25 KB-50 KB or less are used on this site

the embed HTML

below is the example html code for the embed tag:

<embed src="soundfile.mid" hidden="false" border="0" width="310" height="45" autostart="true" autoplay="true" loop="true" volume="75%">

use the example html source code above to play audio on your webpage, here's a break down of the example html source code

how embed works

how the embed attributes work

src="soundfile.mid" the url of the file

hidden="false" shows the controls

hidden="true" hides the controls

width="310" height="45"

the dimensions of the control measured in pixels, play around with these

autostart="true" autoplay="true"

if set to true play automatically on load

autostart="false" autoplay="false"

if set to false do not play

loop="true" if false play once only, if true repeat constantly

volume="75%" set the volume as a percentage

answer May 6, 2014 by Akriti
Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.