hie there..i m using tis embeded media player in my web. but, how can i provide checkbox for each song and then let the user play the multiple songs together using tis code? the music file format are .wma, .mp3 or .midi....
plz help me...thank you

<embed type="application/x-mplayer2" id="music1"
pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" 
src="" 
name="MediaPlayer1" 
width="300"
height="70"
controltype="2" 
showcontrols="1"
showstatusbar="1"
AutoStart="0">
</embed>

Recommended Answers

All 3 Replies

Hope this will solve the issue!
Please let me know if you find any problem on this script!

<html>
<head>
<title>SomeTitle</title>
<style type="text/css">
<!--
fieldset { background-color: #F5F5F5; 
          border: 4px groove #C0C0C0; 
          width: 200px; 
}
legend { color: #000088;  }
form { margin: 6px; 
       padding: 2px; 
       color: #C0C0C0;
}
form input[type="radio"] { margin-left: 2px; }

form span 
{      color: #000088;
       margin-left: 2px; 
       font-weight: bold; 
       font-size: 12px; 
}
form select 
{       color: #000088;
        text-align: left; 
}
-->
</style>
<script type="text/javascript">
<!--
/* Demo test by essential */
document.onclick = playMySound; function playMySound( e )
{ e = e ? e : window.event;
  t = e.target ? e.target : e.srcElement;
//--> Replace this with your own media file!
var playList0 = ['Mp3 Selection List','Yourmp3Music1.mp3', 'Yourmp3Music2.mp3', 'YourMp3Music3.mp3'];
var playList1 = ['Midi Selection List', 'YourMidiMusic1.mid', 'YourMidiMusic2.mid', 'YourMidiMusic3.mid'];
var playList2 = ['Wma Selection List','YourWmaMusic1.wma', 'YourWmaMusic2.wma', 'YourWmaMusic3.wma'];
//-- End of editing -->
var musicList = document.musicBox.myMusic;
var musicSelection = musicBox.myPlayList.options;
var musicIndex = musicBox.myPlayList.selectedIndex; 
if (( t.name ) && ( t.name == 'myMusic' ) && ( t.checked )) { var i = t.value;
for ( var x = 0; x <= playList0.length; x++ ) { 
musicSelection[x].text = eval('playList' + i + '[' + x +']');
musicSelection[x].value = eval('playList' + i + '[' + x +']'); } 
}
if ( musicSelection[0].selected ) { return false; } else { document.getElementById('music1').src = musicSelection[musicIndex].value; 
}
}

//-->
</script>
</head>
<body>
<fieldset><legend>Music Box</legend>
<form name="musicBox" action="#" onsubmit="return false;">
<span>My Music Format</span><br />
<label>
<input type="radio" name="myMusic" value="0" />&nbsp;Mp3 Format</label><br />
<input type="radio" name="myMusic" value="1" />&nbsp;Midi&nbsp;Format</label><br />
<input type="radio" name="myMusic" value="2" />&nbsp;Wma Format</label><hr width="100%" style="margin: 2px; padding: 0px; border: 1px solid #C0C0C0;">
<div id="playlist">
<span>My Music Playlist</span><br />
<select name="myPlayList">
<option>Select Music Format</option>
<option value=""></option>
<option value=""></option>
<option value=""></option>

</select>
</div> 
<br />
<embed type="application/x-mplayer2" id="music1" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="somecurrentaudiofile.mp3" name="MediaPlayer1" width="300" height="70" controltype="2" showcontrols="1" showstatusbar="1" AutoStart="0"> </embed>
</form>
</fieldset>
</body>
</html>
<script type="text/javascript">
<!--
/* Demo test by essential */
document.onclick = playMySound; function playMySound( e )
{ e = e ? e : window.event;
  t = e.target ? e.target : e.srcElement;
//--> Replace this with your own media file!
var playList0 = ['Mp3 Selection List','Yourmp3Music1.mp3', 'Yourmp3Music2.mp3', 'YourMp3Music3.mp3'];
var playList1 = ['Midi Selection List', 'YourMidiMusic1.mid', 'YourMidiMusic2.mid', 'YourMidiMusic3.mid'];
var playList2 = ['Wma Selection List','YourWmaMusic1.wma', 'YourWmaMusic2.wma', 'YourWmaMusic3.wma'];
//-- End of editing -->
var musicList = document.musicBox.myMusic;
var musicSelection = musicBox.myPlayList.options;
var musicIndex = musicBox.myPlayList.selectedIndex; 
if (( t.name ) && ( t.name == 'myMusic' ) && ( t.checked )) { var i = t.value;
for ( var x = 0; x <= playList0.length; x++ ) { 
musicSelection[x].text = eval('playList' + i + '[' + x +']');
musicSelection[x].value = eval('playList' + i + '[' + x +']'); } 
}
if ( musicSelection[0].selected ) { return false; } else { document.getElementById('music1').src = musicSelection[musicIndex].value; 
}
}
 
//-->
</script>

The code play the song within the html file itself? can it be source to other links but stay as just a audio name itself?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.