PDA

View Full Version : Problem with a script...someone pls help me



chano
Nov 17th, 2005, 01:41 PM
Hi all

Im trying to use a java script i found to use a multi track player on my website. To play 1 min of each mp3 song thru a dropdown list and a play, pause and stop button. The problem is it keeps playing the same song when i stop it and play the next song. Can someone pls help me solve this?

I will post the scrit below and tnx in advance for you help


<td colspan="6" valign="top"> <object id="multiplayer" 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="false">
</object> <form name="form">
<select name="playlist" size="1">
<!-- Add song info here -->
<option value="0">On the Main Street - OTM</option>
<option value="1">Bay, Ayo - OTM</option>
<option value="2">Lontananzas from Brasil - OTM</option>
<option value="3">Eclepticismo - OTM</option>
<option value="4">Matural Bridge - OTM</option>
<option value="5">Cross fire - OTM</option>
<option value="6">Zacapaneca - OTM</option>
<option value="7">GMS - OTM</option>
<option value="8">Thema Republica - BW</option>
<option value="9">La vida es un sueno - BW</option>
<option value="10">Chan- chan - BW</option>
<option value="11">Besame mucho - BW</option>
<option value="12">Galletas - BW</option>
<option value="13">Solar en Guaguanco - BW</option>
</select>
<br>
<input type="BUTTON" name="multiplay" value="play" onClick="play(document.forms['form'].playlist);">
<input type="BUTTON" name="multipause" value="pause" onClick="document.multiplayer.pause(); playstate=2;">
<input type="BUTTON" name="multistop" value="stop" onClick="document.multiplayer.stop(); playstate=2;">
<script language="JavaScript">
<!--
var playstate = 1;
shuffle = 0; // Set to 0 to always play first song in list
// Set to 1 to randomly choose the first song to play
songs=new Array();

// Add song URLs here
songs[0]="songs/otm1.mp3";
songs[1]="songs/otm2.mp3";
songs[2]="songs/otm3.mp3";
songs[3]="songs/otm4.mp3";
songs[4]="songs/otm5.mp3";
songs[5]="songs/otm6.mp3";
songs[6]="songs/otm7.mp3";
songs[7]="songs/otm8.mp3";
songs[8]="songs/bw1.mp3";
songs[9]="songs/bw2.mp3";
songs[10]="songs/bw3.mp3";
songs[11]="songs/bw4.mp3";
songs[12]="songs/bw5.mp3";
songs[13]="songs/bw6.mp3";


if (shuffle == 1) {
var randsg = Math.floor(Math.random()*songs.length);
document.multiplayer.FileName = songs[randsg];
document.multiplayer.scr = songs[randsg];
document.forms['form'].playlist.options[randsg].selected = true;
}
function play(list) {
if (playstate == 2) {
document.multiplayer.Play();
} else {
var snum = list.options[list.selectedIndex].value
document.multiplayer.FileName = songs[snum];
document.multiplayer.scr = songs[snum];
}
playstate = 1;
}
//-->
</script>
</form>

Original Source

http://rainbow.arch.scriptmania.com/scripts/music/multi_music_player.html