Monday 28 June 2010

Embedded Windows Media Player Plugin for Firefox/Chrome

Up to my VPO website only supported streaming for MS Internet Explorer. Users of Firefox and Google Chrome had to either right-click-and-save, or might be able to just click and hope that the audio plays. A few weeks ago this playing seemed actually to work fine for WMA files: there was no GUI, just a black screen with the words "waiting for video", and the music played. In case of an MP3 file there was even a volume control that appeared. When I tried this today, however, I noticed that the screen just remained black, and no audio did show. It might have been that I installed in recent weeks another plugin, or newer versions of existing plugins, which then disabled this functionality of simply playing the music through the web browser. Windows MS Internet Explorer did not have this problem, as the standard Media player plugin embedded as an object into the HTML page worked just fine and allowed streaming of the music. However, this same object did not show up when the page was shown in Google Chrome or Firefox, so these two browsers only had the option to download the music files and play them offline.

This means that the result of clicking on a simple link to an audio file is strongly depending on the installation history and the way the user's browser is configured - quite dissatisfying. After a bit of research I found a plugin which plays audio (WMA and MP3 files) straight through both Firefox and Google browsers. It looks very similar to the plugin in MS Internet Explorer, just the dimensions are slightly different. This plugin for Chrome and Firefox is actually better: it also shows the file info, and therefore has to be a bit larger.

The plugin is at http://port25.technet.com/pages/windows-media-player-firefox-plugin-download.aspx.

I rewrote the Javascript/PHP for embedding this plugin into the HTML code, now working on all three browsers fine. Since Chrome and Firefox do not by default come with this plugin, I had to make provisions for automatically check if the plugin is installed. This was achieved in Javascript by checking the variable array navigator.plugins[].name and comparing if the "Windows Media Player Firefox Plugin" was among those found. A slight complication was that in the name is the symbol
®. Since there appear to be different code pages to be used for encoding this non-standard symbol, I was not able to do a direct comparison and instead had to compare the string piecewise. It works, and now the site is able to see if the user has the plugin installed. If not, then a link is given from where this plugin can be downloaded.

During edits there was a site outage today, as some wrong temporary site configuration had mistakenly been uploaded. Apologies to those who tried to access the site today and got only a garbled text...!

1 comment:

  1. Great work! I like this post and i feel very happy to read this article...
    thanks for sharing...
    more info:- Mozilla Firefox Support

    ReplyDelete