Solved

multiple wma embeds

Posted on 2003-11-25
8
325 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
Technology Partners: 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 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

688 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