Using google Mp3 player to play music on your blog/site

Jotted by brajesh on April 23, 2009

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Well,there are times when you want to play audio on your blog/website.Recently in one of my project I had to do the same.The client was insisting on using google mp3 player to play mp3 audio on their blog.

well,it was easy and if you have not worked with google mp3 player, you can use the following syntax to play audio files.

<object width="289" height="28" data="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=YOUR_MP3_URL" type="application/x-shockwave-flash">
 
<param name="bgcolor" value="#ffffff" />
<param name="flashvars" value="playerMode=embedded" />
<param name="src" value="http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=YOUR_MP3_URL" />
<param name="wmode" value="window" />
<param name="quality" value="best" />
</object>

You will need to replace YOUR_MP3_URL with the url of your audio mp3 file.
It will make a tiny ,little and cute mp3 player which looks like the following image,available on your site.
Google Mp3 player

Now every thing goes well,until you check your site in IE.It works in firefox,safari,netscape and other browsers but not in IE.When you click on the play button in IE ,IE will show a download dialog for the MP3 file.well,that’s not something we will like to have as we have to keep our self fighting with IE’s quirks.
So,I looked all over the internet to find a solution,instead of finding a solution,I found that almost all web based audio player had same behavior in IE.
After a long battle with the IE ,I finally figured out(well,that was just presence of mind,nothing technical),how to make it work with IE(and the same applies for all other web based audio players to make work in IE).

In order to make the audio player work in IE, you need to rename your mp3 file to some file without extension.For example my-wonderfull-music.mp3 to “my-wonderful-music” [without any extension].Now use the new file url(the file without the extension as the value of audioURL) and it works like a charm.Oh! yes,In IE too.

here is a sample,click play and test in IE too.It will work.You may apply the same rule for other mp3 players too.
A Test music from http://www.sounddogs.com/[well I found it tiny enough to upload here]

So why It worked In IE and what was the reason btw?

IE thinks mp3 extension as something downloadable,so it starts downloading the file and shows file download dialog.To fool Ie ,we have renamed the file and made it with no extension,so now IE does not understands it and lets the player play the audio.that’s it
[blinklist] [Bloglines] [del.icio.us] [Digg] [dzone] [Facebook] [Ma.gnolia] [Mister Wong] [Reddit] [Sphere] [Sphinn] [StumbleUpon] [Technorati] [Email]



Get Adobe Flash playerPlugin by wpburn.com wordpress themes