Dave's Brain

Browse - programming tips - best way to embed mp3

Date: 2010jan20
Language: HTML

Q.  What's the best way to embed an MP3 song in a page?

A.  I like this code because its pretty simple and seems
to work on nearly every browser:

$title<br>
<object type="audio/x-mp3" data="$file" width="300" height="45">
  <param name="src" value="$file">
  <param name="autoplay" value="false">
  <param name="autoStart" value="0">
  <!- Fallback -> <a href="$file">Play &gt;</a>
</object>

Replace $file with the path to you file - eg my_song.mp3
Replace $title with some text describing your song.
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2012, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.