?
Solved

multiple wma embeds

Posted on 2003-11-25
8
Medium Priority
?
327 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 200 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
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…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

649 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