Link to home
Avatar of cindysei
cindysei

asked on

music to web page

I've put in code to the following web page - it works for me locally but not on the server I've uploaded it to. Is it because there is an "embed" tag? I got this code from the internet so don't really understand it. What can I do so it plays "live"? Here's the code for the page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>music</title>
</head>

Thanks, Cindy
<body>
<table width="400" border="1">
  <tr>
    <td><img src="images/background-music.jpg" width="400" height="220" alt="music" /></td>
  </tr>
  <embed src="Amélie.mp3" width=150 height=45 autostart=true repeat=true loop=true>
</table>
</body>
</html>
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

An embed tag without a player will use the default media player on the user's computer.  It often has to download completely before it will play.  Most of us use a flash music player.  Also, you are not supposed to put anything between a </tr> and </table>.  That will cause an error in the W3C HTML validator.  If you have Flash, you can make a simple one.  If you don't, I've used the XSPF music player on some web sites.  http://musicplayer.sourceforge.net/   Their directions are a little obscure but it does work.
Avatar of cindysei
cindysei

ASKER

So why does it work for me locally but not when I test it live? If I'm using my computer in both instances - I should already have the player, right? What do you mean :"if I have Flash, I can make a simple one?" - I'm not an expert at all as you might have guessed so any further direction would help. I really didn't think playing music automatically on a page would be so difficult code wise!
No browser will automatically play music by itself.  They always require an external program or a plugin to do that.  It's not particularly difficult but it takes a little more than what you are doing.  About Flash, I meant the Adobe Flash compiler program.  I have an old copy that I use strictly for generating music clips that will play on web sites.

Did you upload the MP3 to the server?
Yes, I uploaded to the server. Sorry, I get the flash thing now - was having a blond moment. I have flash but it's been years since I've used it so a tad rusty. I was trying to get away with as little coding as possible. In Dreamweaver, can I put in a plug-in code? If so, where in my page should I do that? Thanks for your help! Cindy
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial