Solved

multiple wma embeds

Posted on 2003-11-25
8
319 Views
Last Modified: 2010-04-09
is there a way that i can embed multiple wma files onto a webpage and everytime someone opens the page, songs play in random order?
0
Comment
Question by:tlau001
  • 4
  • 2
8 Comments
 
LVL 5

Expert Comment

by:apparition
Comment Utility
Heres a link to a script that shows how to embed multiple sound files
http://www.silverblades.net/history/htm-midi-random-files.htm
0
 

Author Comment

by:tlau001
Comment Utility
but thats only for midi files.
0
 
LVL 5

Expert Comment

by:apparition
Comment Utility
should waork the same way for wma files
0
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

 
LVL 5

Expert Comment

by:apparition
Comment Utility
What is the code you are using to embed one wma file? Post and I'll modify it so it can embed multiple
wma files
0
 

Author Comment

by:tlau001
Comment Utility
im using a basic embed src code
0
 
LVL 5

Accepted Solution

by:
apparition earned 50 total points
Comment Utility
then this code should work fine....
Just replace the variables "midis[0]" with your wma file path

example
<SCRIPT LANGUAGE = "JavaScript">
now = new Date();
seed = now.getTime();
Mcount = 10;
midis = new Array(Mcount);
names = new Array(Mcount);
var playing;

midis[0] = "yourdirectory/yoursong.wma"; // Song # 1
names[0] = "Your Song Title";

midis[1] = "yourdirectory/yoursong.wma"; // Song # 2
names[1] = "Your Song Title";

midis[2] = "yourdirectory/yoursong.wma"; // Song # 3
names[2] = "Your Song Title";

midis[3] = "yourdirectory/yoursong.wma"; // Song # 4
names[3] = "Your Song Title";

midis[4] = "yourdirectory/yoursong.wma"; // Song # 5
names[4] = "Your Song Title";

midis[5] = "yourdirectory/yoursong.wma"; // Song # 6
names[5] = "Your Song Title";

midis[6] = "yourdirectory/yoursong.wma"; // Song # 7
names[6] = "Your Song Title";

midis[7] = "yourdirectory/yoursong.wma"; // Song # 8
names[7] = "Your Song Title";

midis[8] = "yourdirectory/yoursong.wma"; // Song # 9
names[8] = "Your Song Title";

midis[9] = "yourdirectory/yoursong.wma"; // Song # 10
names[9] = "Your Song Title";


function random(num)
{
ia=9301;
ic=49297;
im=233280;
seed = (seed*ia+ic) % im;
return Math.ceil( (seed/(im*1.0)) * num);
}


function Play_Midi()
{

playing = random(Mcount) - 1;
if (navigator.appName == "Netscape") {
document.write("<embed src=",midis[playing]," hidden=true autostart=true>");
} else {
document.write("<bgsound src=",midis[playing]," loop=1>");
}
}

function Show_Midi()
{

document.write("Now playing : ",names[playing]);
}

</SCRIPT>


Place the following code anywhere between the <body> .... </body> tags

<SCRIPT>
Play_Midi();
Show_Midi();
</SCRIPT>
0

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

763 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

11 Experts available now in Live!

Get 1:1 Help Now