Click to See Complete Forum and Search --> : Using JS with Windows Media Player


TravisMath
08-01-2005, 01:51 PM
I have this form that's supposed to play different songs using windows media player. Except there's one error and i don't know where to look to fix it. If you could help it would be greatly appreciated. You will have to change the urls to your own urls b/c i've just been working off my computer until i get this to work; then i'll put everything on the net.

<object id="darkplayer" codeBase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" type="application/x-oleobject" height="0" standby="Loading Microsoft Windows Media Player components..." width="0" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95">
<param NAME VALUE>
<param NAME="ShowControls" VALUE="0">
<param NAME="ShowStatusBar" VALUE="0">
<param NAME="ShowDisplay" VALUE="0">
<param NAME="DefaultFrame" VALUE="Slide">
<param NAME="Autostart" VALUE="1">
<param NAME="Loop" VALUE="True">
</object>
<script language="JavaScript">
<!--
var playstate = 1;
shuffle = 1; // set to 0 to always play first song in list
// set to 1 to randomly choose the first song to play
songs=new Array(10);
songs[0]="C:\Documents and Settings\Mike McDonald\My Documents\My Music\Thousand Foot Krutch\The Art Of Breaking\01 - Absolute.mp3";
songs[1]="C:\Documents and Settings\Mike McDonald\My Documents\My Music\Thousand Foot Krutch\The Art Of Breaking\02 - Slow Bleed.mp3";
songs[2]="C:\Documents and Settings\Mike McDonald\My Documents\My Music\Thousand Foot Krutch\The Art Of Breaking\03 - The Art Of Breaking.mp3";
songs[3]="C:\Documents and Settings\Mike McDonald\My Documents\My Music\Thousand Foot Krutch\The Art Of Breaking\04 - Stranger.mp3";
songs[4]="C:\Documents and Settings\Mike McDonald\My Documents\My Music\Thousand Foot Krutch\The Art Of Breaking\05 - Hurt.mp3";
songs[5]="C:\Documents and Settings\Mike McDonald\My Documents\My Music\Thousand Foot Krutch\The Art Of Breaking\06 - Hand Grenade.mp3";
songs[6]="C:\Documents and Settings\Mike McDonald\My Documents\My Music\Thousand Foot Krutch\The Art Of Breaking\07 - Move.mp3";
songs[7]="C:\Documents and Settings\Mike McDonald\My Documents\My Music\Thousand Foot Krutch\The Art Of Breaking\08 - Hit The Floor.mp3";
songs[8]="C:\Documents and Settings\Mike McDonald\My Documents\My Music\Thousand Foot Krutch\The Art Of Breaking\09 - Go.mp3";
songs[9]="C:\Documents and Settings\Mike McDonald\My Documents\My Music\Thousand Foot Krutch\The Art Of Breaking\10 - Make Me A Believer.mp3";
songs[10]="C:\Documents and Settings\Mike McDonald\My Documents\My Music\Thousand Foot Krutch\The Art Of Breaking\11 - Breathe You In.mp3";
if (shuffle == 1) {
var randsg = Math.floor(Math.random()*songs.length);
document.darkplayer.FileName = songs[randsg];
document.darkplayer.scr = songs[randsg];
document.forms['form'].playlist.options[randsg].selected = true;
}
function play(list) {
if (playstate == 2) {
document.darkplayer.Play();
} else {
var snum = list.options[list.selectedIndex].value
document.darkplayer.FileName = songs[snum];
document.darkplayer.scr = songs[snum];
}
playstate = 1;
}
//-->
</script>

<form name="player">

<p style="text-align: center">
<select style="FONT-SIZE: 8pt; WIDTH: 150px; COLOR: #FF0000; font-family:Windsor BT" name="playlist" size="1">
<option value="0">Absolute</option>
<option value="1">Slow Bleed</option>
<option value="2">The Art of Breaking</option>
<option value="3">Stranger</option>
<option value="4">Hurt</option>
<option value="5">Hand Grenade</option>
<option value="6">Move</option>
<option value="7">Hit the Floor</option>
<option value="8">Go</option>
<option value="9">Make Me A Believer</option>
<option value="10">Breathe You In</option>
</select><br>
<input TYPE="BUTTON" NAME="darkplay" VALUE="play" OnClick="play(document.forms[form].playlist);">
<input TYPE="BUTTON" NAME="darkpause" VALUE="pause" OnClick="document.darkplayer.Pause(); playstate=2;">
<input TYPE="BUTTON" NAME="darkstop" VALUE="stop" OnClick="document.darkplayer.Stop(); playstate=2;"></p>
</form>

Jonny Lang
08-01-2005, 02:20 PM
You ignored the code I posted. So, code deleted.