HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
HTML tag to play mp3 songs
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form
View previous topic :: View next topic  
Author Message
bengaluru



Joined: 10 Dec 2006
Posts: 1

PostPosted: Sun Dec 10, 2006 9:33 am     HTML tag to play mp3 songs Reply with quote

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

PostPosted: Thu Mar 01, 2007 4:12 pm     Reply with quote

Check out these two scripts:

Web Midi JukeBox Application

Select a Hit

There are several more to pick from, too.

Ron
glazarou



Joined: 10 Mar 2007
Posts: 1

PostPosted: Sat Mar 10, 2007 12:48 pm     Reply with quote

<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

PostPosted: Sat Mar 10, 2007 3:47 pm     Reply with quote

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

PostPosted: Sat Mar 10, 2007 4:07 pm     Reply with quote

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

PostPosted: Tue Jul 24, 2007 2:37 pm     Reply with quote

Did the code given ever work for you? You haven't posted any feedback.

Ron
rajkomma



Joined: 25 Nov 2008
Posts: 1

PostPosted: Tue Nov 25, 2008 7:54 pm     Embed Mp3 Play List Reply with quote

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

PostPosted: Tue Nov 25, 2008 8:45 pm     Reply with quote

I have used this one and it works really well. All instructions are on the site http://www.premiumbeat.com/flash_resources/free_flash_music_player/

You need not know flash only how to edit an xml file.
PayneLess Designs



Joined: 28 Feb 2007
Posts: 1408
Location: Biloxi, MS

PostPosted: Wed Nov 26, 2008 12:04 am     Re: Embed Mp3 Play List Reply with quote

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

PostPosted: Wed Nov 26, 2008 4:47 am     Reply with quote



Multiple Music Player might work as well.

_________________
Corey
Toll Free Numbers | Mile High Merchant Accounts | Expression Web Blog
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial