Solved

multiple wma embeds

Posted on 2003-11-25
8
323 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

 
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

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.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

831 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