I've been trying for a long time to figure this out, to have a page
with several MP3 clips, and each one having a custom start and stop
button next to them to play the track. I finally found a bit of code
that does this, but it's made for only one mp3 file. I don't know
enough about javascript to customize the code myself. I know there
probably needs to be an "array" of some sort, but I need some help
figuring out where and how that works.
Here's the code I found
<script language="JavaS cript">
var state;
//URL of song - Direct path
function playerinit()
{
player.url="YOU RSONG";
player.settings .autoStart = true ;
}
//Play Function
function play()
{
if (player.control s.isavailable(' play'))
{
player.controls .play();
state=setInterv al("updatetime( )",1000);
}
}
//Stop Function
function stop()
{
if (player.control s.isavailable(' stop'))
{
player.controls .stop();
clearInterval(s tate);
}
}
</script>
</head>
<body onload="playeri nit();">
<!-- START PLAYER -->
<!-- Default Player Settings -->
<object id="player"
classid="CLSID: 6BF52A52-394A-11d3-B153-00C04F79FAA6"
type="applicati on/x-oleobject" width="0" height="0">
<param name="autoStart " value="0">
<param name="balance" value="0">
<param name="currentPo sition" value="0">
<param name="currentMa rker" value="0">
<param name="enableCon textMenu" value="0">
<param name="enableErr orDialogs" value="0">
<param name="enabled" value="-1">
<param name="fullScree n" value="0">
<param name="invokeURL s" value="0">
<param name="playCount " value="1">
<param name="rate" value="1">
<param name="uiMode" value="invisibl e">
<param name="volume" value="100">
<param name="URL" value>
<param name="defaultFr ame" value>
<param name="baseURL" value>
<param name="stretchTo Fit" value="0">
<param name="windowles sVideo" value="0">
<param name="SAMIStyle " value>
<param name="SAMILang" value>
<param name="SAMIFilen ame" value>
<param name="captionin gID" value>
<embed id="player" type="applicati on/x-mplayer2" src="" height="0"
width="0">
</object>
<!-- END Default Player Settings -->
<br />
<!-- Player Controls -->
<input TYPE="image" src="PLAYBUTTON HERE.gif" value="Play "name="play "
onclick="play() ;">
<input TYPE="image" src="STOPBUTTON HERE.gif" value="Stop" name="stop"
onclick="stop() ;">
<!-- END Player Controls -->