A Simple Way to Embed MP3s

Yahoo! has released an API that allow you to easily embed a media play that will automatically attach itself to MP3 links.  They had one that just linked to their own music library, but that's boring.

 

Here is a sample HTML page that has some MP3 links and an embedded audio player:

<!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> <title>My MP3 Page</title> <script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script> </head> <body> <a href="http://podcastdownload.npr.org/anon.npr-podcasts/podcast/510008/17999726/npr_17999726.mp3?dl=1">NPR Podcast</a>
</body> </html>

 

Here's how it will render (Click the play icon):

NPR Podcast

When the play button is clicked, a media player will appear and the file will play in a pop-in media player.  It's nice because you have a good deal of control over the player just by changing the hyperlink.  It uses semantic HTML and an independent JavaScript file.

I wouldn't mind seeing more APIs that follow this type of implementation.  I know it puts a 3rd party in between you and the client, but so do things like PDFs and Flash.


Wednesday, 9 January 2008 15:08

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading