Stream MP3 in the background

Posted on 2004-08-19
Last Modified: 2013-12-24
As a newbee,
I am looking for a way to stream background sound in my website.
I have 10 different themes, currently in MP3.

1. A theme would be chosen randomly and played in the background.
2. Each sound file is like 3MB and therefore better not force the users to download all of them
   in advance.
3. I would like to give the user the ability to change the background music.
Question by:peledc

Accepted Solution

Squew01 earned 500 total points
Comment Utility
Add this script just after the <HEAD> tag

<script language="javascript"> Date();;

function rnd() {
        rnd.seed = (rnd.seed*9301+49297) % 233280;
        return rnd.seed/(233280.0);

function rand(number) {
        return Math.ceil(rnd()*number);

function music()
music[0]="mymusic0.mp3"; // Don't forget to change the name


if (navigator.appName.indexOf("Microsoft") != -1){        
document.write('<BGSOUND SRC="'+ music[i] +'"> ')    
else if (navigator.appName.indexOf("Netscape") != -1){
document.write('<EMBED SRC="'+ music[i] +'" HIDDEN=TRUE AUTOSTART=TRUE> ')

Add this code after tha <BODY> tag


To change the played song, use this link <A href="#">Another Song</a>

Don't forget to change mymusic0.mp3, mymusic1.mp3, ...


Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now