4

I am using the following code to embed an mp3 file into my html document:

 <embed src="aharddaysnight.mp3" width="140" height="40" autostart="false" loop="FALSE"></embed>

In IE, this works fine, as an mp3 player with controls automatically shows up.

In FireFox, however, a pop-up appears that says additional plug-ins are needed. When I click on the option to install additional plug-in, it doesn't allow me to because of a security certificate error.

In Chrome, the player shows up, but the media starts playing automatically, even though the code says autostart "false".

Does anyone have a better way to embed mp3, or a fix to this problem?

Oak Bytes
  • 4,649
  • 4
  • 36
  • 53
user828640
  • 71
  • 1
  • 2
  • 7

2 Answers2

2

I have tested this in Chrome and Firefox and works in both, with the fall back. However if it is a long file, like the 2 hour audio I am trying it stops playing. Hopefully it will help you and I will keep looking for my fix.

<audio controls="controls">
 <source src="yourURL.mp3" />
 <source src="yourURL.ogg" />
 <!-- fallback -->
  <embed type="application/x-shockwave-flash"                                                         
    flashvars="audioUrl=yourURL.mp3"    
     src="http://www.google.com/reader/ui/3523697345-audio-player.swf"   
     width="650? height="0? quality="best"></embed>
</audio>`
  • Google reader is no longer supported. This method will not work. – user1522901 Oct 31 '13 at 19:59
  • This method works! [Here](http://stackoverflow.com/questions/4923136/why-doesnt-firefox-support-mp3-file-format-in-audio) is why. If the fallback is really needed you could still load it from other sources. – dkeck Jan 20 '15 at 15:57
1

Try this

type="audio/mpeg" 

OR

type="audio/midi"
Navnath Godse
  • 2,233
  • 2
  • 23
  • 32