Solved

multiple wma embeds

Posted on 2003-11-25
8
321 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
ID: 9824967
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
ID: 9827377
but thats only for midi files.
0
 
LVL 5

Expert Comment

by:apparition
ID: 9827399
should waork the same way for wma files
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 5

Expert Comment

by:apparition
ID: 9827412
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
ID: 9827704
im using a basic embed src code
0
 
LVL 5

Accepted Solution

by:
apparition earned 50 total points
ID: 9827735
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

948 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

24 Experts available now in Live!

Get 1:1 Help Now