Browse - Programming Tips - What's the best way to embed an MP3 track in a page?
Date: 2010jan20
Language: html
Platform: web
Warning: Use the <audio> tag now
Keywords: music, song
Q. What's the best way to embed an MP3 track 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 ></a>
</object>
Replace $file with the path to you file - eg my_track.mp3
Replace $title with some text describing your track.