homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Site Graphics and Multimedia Design
Forum Library, Charter, Moderator: open

Site Graphics and Multimedia Design Forum

How Do I Add Songs To Play On Demand To My Website
Is there an easy code or way to do this

 4:32 am on May 24, 2007 (gmt 0)


I have a friend that has done a few demos that he has placed on a CD. He wants to create a small website and have people visit the site and listen to his songs on demand. What he wants is for the song to play in the background without the person downloading anything or opening another program.

But how do we do this. Do I create a new folder put the songs in there then on the home page create links so that if the person clicks song A begins to play and then clicks on aonther link and song b begins to play.

Can someone help us on this issue?



 10:02 am on May 24, 2007 (gmt 0)

Background Music

There are two common ways to add background music to a web site. The first involves a simple link, the second is more tenacious - you actually embed the music right into the site, so it begins to play as soon as someone begins to view the page.


You can give your viewers the option to listen to music that flows with the theme of your web site by including a clickable link to the music file. The music can be in a variety of formats, including mid (midi), wav, MP3, ram, ra, aiff, and so on), and it is solely up to the viewer whether they listen to it or not, as they browse your site. You can provide a simple text link to the file or create a coordinating image to take them there.

Example Text Link:

<A HREF="http://www.yourdomain.com/beautifulday.wav">Listen to Music</A>

Which would look like:

Listen to Music

Example Graphic Link::

<A HREF="http://www.yourdomain.com/floating.wav"> <img src="http://www.visionsofadonai.com/musicbutton.jpg" border=0 ></A>

This would ultimately look like this (Music by Djan Karet, Dreamscapes):


Sound can be embedded so that the music plays as soon as a web page is opened. You simply need to place appropriate code on your page. For instance, to embed a wav file of a song called "Beautiful Day". you would put the following code into your html coding (this works for various sound files such as mid, wav, mp3, ra, aiff):

<EMBED SRC="beautifulday.wav" HIDDEN=true AUTOSTART=true>

<NOEMBED><BGSOUND SRC="beautifulday.wav"></NOEMBED>

Coding a Console:

The above code works well to embed background music, but it does not allow the viewer to control whether to listen to the music or not. If you wish to give them a choice, use the following code:

<embed src="beautifulday.wav" width="140" height="40" autostart="true" loop="true"> </embed>

If you do not want the music to loop (play repeatedly) you can change the loop="true" command to "false". You can also customize the size of the control panel that emerges by varying the width and height within the above code.

Make sure you have rights to the music file before you use it!


 10:06 am on May 24, 2007 (gmt 0)

Embedding them within flash is becoming very popular as well - consider this as it can be quite powerful and supported with all browsers which have a flash plugin.


 12:57 pm on May 24, 2007 (gmt 0)

The trouble with embedding it in a single page is the song restarts each time the user goes to another page. Do a search for embedding in a i-frame, never did it myself and don't know how well it works. On a personal note I find background music annoying and I think most surfers would agree.

I did a website for a band and instead created a link to a pop-up which has an embedded media player. The page automatically generates a random playlist and starts playing. There's also selections for albums, songs etc... kind of like a little personal radio. the users like it quite a bit.


 5:57 pm on May 24, 2007 (gmt 0)

Great guys but if I use a link to start the specific wav file what about using a link to stop it.

That way I can have several links to wav files on one page.


 6:14 pm on May 24, 2007 (gmt 0)

Starting and stopping sounds is what Flash does extremely well. :-) Additionally, it adds a layer of protection to the sound files themselves.

You will also find .mpgs will compress far better, .wavs are huge. If you put an mpg into your Flash, it will load faster, Flash will stream it, and you can effect all sorts of controls on the sound besides starting and stopping.


 6:24 pm on May 24, 2007 (gmt 0)

If you use a direct link to the file it will open the clients default media and begin to play the file in most instances. You can't stop it after that.

Do a search for embedding a media player, there's literally hundreds of ways of doing this. To allow for selections the best method I've seen is using a form with drop down box, from their you need to either use javascript or submit the form to reload the player.

The other method I've seen is using a I-frame, links in one I-frame will reload the player.

You may want to also look into flash players as someone else suggested. There's lots of free ones, simply load up a playlist and supply a link to the player.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Site Graphics and Multimedia Design
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved