Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Embedded windows media player

Status
Not open for further replies.

odiumragnarok

Vendor
Dec 21, 2002
45
US
Hello. I need some HTML help with embedded WMP, I want it to play more than one song. The problem is that I don't know how to do that, and how to add a "shuffle" or random feature, so different songs will be played everytime the page is opened. This is the code:

<HTML>
<HEAD>
<TITLE>Doc JavaScript's Streaming Media JukeBox</TITLE>
<SCRIPT LANGUAGE = "JavaScript">
var streams = new Array();
streams[0] = new makeStream(" "Microsoft Promo for Windows Media Player");
streams[1] = new makeStream(" "Microsoft Training for Windows Media Player");
streams[2] = new makeStream("mms://netshow.microsoft.com/ms/sbnasfs/wmt/turtle28.asf", "The Turtle");
streams[3] = new makeStream("mms://netshow.microsoft.com/ms/sbnasfs/wmt/wmt.asf", "Flying Windows Media Player logo");

function makeStream(url, name) {
this.url = url;
this.name = name;
}

function handleControlsOnOffClick() {
if (document.mediaPlayer.showControls == true) {
document.mediaPlayer.showControls = false;
document.playerCtrl.controls.value = " Show Controls ";
}
else {
document.mediaPlayer.showControls = true;
document.playerCtrl.controls.value = " Hide Controls "
}
}

function handlePlayOrPauseClick(){
var state;
playerStatus = document.mediaPlayer.playState;
if (playerStatus == 6) {
document.mediaPlayer.play();
document.playerCtrl.playOrPause.value = " Pause ";
}
else if (playerStatus == 1) {
document.mediaPlayer.play();
document.playerCtrl.playOrPause.value = " Pause ";
}
else if (playerStatus == 2) {
document.mediaPlayer.pause();
document.playerCtrl.playOrPause.value = " Play ";
}
}

function changeSize(newSize) {
document.mediaPlayer.displaySize = newSize;
}

function change() {
var list = document.playerCtrl.streams;
var streamURL = list.options[list.selectedIndex].value;
document.mediaPlayer.stop();
document.playerCtrl.playOrPause.value = " Pause ";
document.mediaPlayer.fileName = streamURL;
}

</SCRIPT>
</HEAD>
<BODY LEFTMARGIN = "100">
<h3>Doc JavaScript's Streaming Media JukeBox</h3><P><P><HR><P>
<OBJECT
ID="mediaPlayer"
CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
CODEBASE=" STANDBY="Loading Microsoft Windows Media Player components..."
TYPE="application/x-oleobject">
<PARAM NAME="fileName" VALUE=" VALUE= <PARAM NAME="animationatStart" VALUE="true">
<PARAM NAME="transparentatStart" VALUE="true">
<PARAM NAME="autoStart" VALUE="true">
<PARAM NAME="showControls" VALUE="true">
</OBJECT><P>
<FORM NAME="playerCtrl">
<INPUT TYPE="button" VALUE=" Pause " NAME="playOrPause" onClick="handlePlayOrPauseClick()" STYLE = "font-family:courier">
<INPUT TYPE="button" VALUE=" Hide Controls " NAME="controls" onClick="handleControlsOnOffClick()" STYLE = "font-family:courier"><BR>
<INPUT TYPE="button" VALUE=" Small " NAME="small" onclick="changeSize(1)" STYLE="font-family:courier">
<INPUT TYPE="button" VALUE=" Normal " NAME="normal" onclick="changeSize(0)" STYLE="font-family:courier">
<INPUT TYPE="button" VALUE=" Large " NAME="large" onclick="changeSize(2)" STYLE="font-family:courier"></FORM>
</BODY>
</HTML>

Any help would be appreciated, thanks!
 
I know it's not what you asked, but there are some really nice Flash music players, e.g. , that may do what you want and will work on Macs and linux boxes as well as Windows (so long as they have the Flash plug-in installed). Something to consider anyway.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top