| View previous topic :: View next topic |
| Author |
Message |
bengaluru
Joined: 10 Dec 2006 Posts: 1
|
Posted: Sun Dec 10, 2006 9:33 am HTML tag to play mp3 songs |
|
|
|
Hi guys,
I have a greeting card website and have 5 mp3 songs in a drop down list which the user can choose.
I want the <embed> tag to play the song the user has chosen. Any idea how I do this ?
Thanks for your help. |
|
PayneLess Designs

Joined: 28 Feb 2007 Posts: 1408 Location: Biloxi, MS
|
|
glazarou
Joined: 10 Mar 2007 Posts: 1
|
Posted: Sat Mar 10, 2007 12:48 pm |
|
|
|
<embed src="put the song's url here">write song's title here</embed>
it's very simple code put it's works fine |
|
Pattons3rd

Joined: 28 Dec 2006 Posts: 1212 Location: Colorado
|
Posted: Sat Mar 10, 2007 3:47 pm |
|
|
|
| glazarou wrote: |
<embed src="put the song's url here">write song's title here</embed>
it's very simple code put it's works fine |
I think they wanted something to make the song that the user had chose play. |
|
PayneLess Designs

Joined: 28 Feb 2007 Posts: 1408 Location: Biloxi, MS
|
Posted: Sat Mar 10, 2007 4:07 pm |
|
|
|
Try this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
text-align:center;
}
form {
margin:0;
padding:0;
}
-->
</style>
<script type="text/javascript">
<!--
function PlayIt(){
document.getElementById("music1").innerHTML='<object id="mediaPlayer" width="270" height="45" '
+'classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" '
+'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" '
+'standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">'
+'<param name="fileName" value="'+document.getElementById('cancion').value+'">'
+'<param name="animationatStart" value="true">'
+'<param name="transparentatStart" value="true">'
+'<param name="autoStart" value="true">'
+'<param name="showControls" value="false">'
+'<param name="loop" value="true">'
+'<embed type="application/x-mplayer2" '
+'pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" '
+'bgcolor="101010" showcontrols="false" width="270" height="45" '
+'src="'+document.getElementById('cancion').value+'" autostart="true" designtimesp="5311" loop="true">'
+'</embed>'
+'</object>'
}
//-->
</script>
</head>
<body onload="document.forms['player'].reset()">
<form name="player" action="" method="">
<select name="" id="cancion" onchange="PlayIt()" size="1">
<option value="none">::::::::::::: Choose Your Song Here :::::::::::::</option>
<option value="http://urltosong1.mp3">Song 1</option>
<option value="http://urltosong2.mp3">Song 2</option>
<option value="http://urltosong3.mp3">Song 3</option>
<option value="http://urltosong4.mp3">Song 4</option>
<option value="http://urltosong5.mp3">Song 5</option>
<option value="http://urltosong6.mp3">Song 6</option>
<option value="http://urltosong7.mp3">Song 7</option>
<option value="http://urltosong8.mp3">Song 8</option>
<option value="http://urltosong9.mp3">Song 9</option>
<option value="http://urltosong10.mp3">Song 10</option>
</select>
</form>
<span id="music1">
<object type="application/x-mplayer2" width="300" height="45" data="">
<param name="src" value="">
<param name="filename" value="">
<param name="type" value="application/x-mplayer2">
Your system does cannot find the windows media player that was specified.
</object>
</span>
</body>
</html>
Ron |
|
PayneLess Designs

Joined: 28 Feb 2007 Posts: 1408 Location: Biloxi, MS
|
Posted: Tue Jul 24, 2007 2:37 pm |
|
|
|
Did the code given ever work for you? You haven't posted any feedback.
Ron |
|
rajkomma
Joined: 25 Nov 2008 Posts: 1
|
Posted: Tue Nov 25, 2008 7:54 pm Embed Mp3 Play List |
|
|
|
Hi,
I tried the code you wrote to play the mp3 songs.
as you wrote the code "select the song to play" does not work.
only the single song play each time.
i used the code as below:
<head>
<style type="text/css">
<!--
body {
text-align:center;
}
form {
margin:0;
padding:0;
}
-->
</style>
<script type="text/javascript">
<!--
function PlayIt(){
document.getElementById("music").innerHTML='
<object id="mediaPlayer" width="270" height="45" '
+'classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" '
+'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/
nsmp2inf.cab#Version=5,1,52,701" '
+'standby="Loading Microsoft Windows Media Player components..."
type="application/x-oleobject">'
+'<param name="fileName" value="'+document.getElementById('cancion').value+'">'
+'<param name="animationatStart" value="true">'
+'<param name="transparentatStart" value="true">'
+'<param name="autoStart" value="false">'
+'<param name="showControls" value="true">'
+'<param name="loop" value="false">'
+'<embed type="application/x-mplayer2" '
+'pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" '
+'bgcolor="101010" showcontrols="true" width="270" height="45" '
+'src="'+document.getElementById('cancion').value+'" autostart="false" designtimesp="5311" loop="false">'
+'</embed>'
+'</object>'
}
//-->
</script>
</head>
<body>
<form name="player" action="" method="">
<select name="" id="cancion" onchange="PlayIt()" size="1">
<option value="none">::::::::::::: Choose Your Song Here :::::::::::::</option>
<option value="music/TinyStar.mp3">TinyStar</option>
<option value="music/MarinaManasulu.mp3">MarinaManasulu</option>
<option value="music/Nathadri.mp3">Nathandri</option>
<option value="music/Karunamayive.mp3">Karunamayive</option>
</select>
</form>
<span id="music">
<object type="application/x-mplayer2" width="300" height="45" data="">
<param name="src" value="music/TinyStar.mp3">
<param name="filename" value="TinyStar">
<param name="src" value="music/MarinaManasulu.mp3">
<param name="filename" value="MarinaManasulu">
<param name="loop" value="false">
<param name="autoStart" value="false">
<param name="showControls" value="true">
<param name="animationatStart" value="true">
<param name="transparentatStart" value="true">
<param name="type" value="application/x-mplayer2">
</object>
</span>
What could be the mistake!!!
As i can play only a single song each time when the window is opened. I can view the songs in the list but i can not play them.
Anybody has the solution??
Thanks,
Raj. |
|
sticks464

Joined: 31 Dec 2006 Posts: 1283
|
|
PayneLess Designs

Joined: 28 Feb 2007 Posts: 1408 Location: Biloxi, MS
|
Posted: Wed Nov 26, 2008 12:04 am Re: Embed Mp3 Play List |
|
|
|
| rajkomma wrote: |
What could be the mistake!!!
As i can play only a single song each time when the window is opened. I can view the songs in the list but i can not play them.
Anybody has the solution??
Thanks,
Raj. |
I can't verify any problems with your code as the links to your music are relative paths.
Either use Sticks' link or try http://PlayList.com/ ' online tool for making a playlist. |
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8428 Location: Castle Pines North, CO USA
|
|
|