Novell developer Aaron Bockover has created a clever Firefox plugin that uses Moonlight to play conventional Windows media streaming video content at websites like C-SPAN. The plugin takes advantage of the video codecs that Microsoft provides for Moonlight, Novell's open source implementation of Microsoft's Silverlight rich Internet application framework.

Moonlight 1.0, which was officially released Wednesday, automatically downloads a proprietary codec pack from Microsoft in order to provide Linux users with legally licensed support for Microsoft's video formats. Bockover's plugin uses the NPAPI to register itself as the default consumer of Windows Media content and then, when it is invoked by the browser, uses Moonlight to embed a Silverlight-based streaming video player—which he wrote entirely in XAML and JavaScript—in the page to handle WMV.

Linux users typically rely on embedded Totem or MPlayer plugins to view streaming WMV content in the browser. This can be problematic, because it requires the user to obtain the Microsoft codecs on their own, by buying them commercially from Fluendo or using unlicensed codecs obtained from servers outside of the United States. Moonshine eliminates that complexity and legal ambiguity by allowing users to watch WMV content with fully licensed codecs that are obtained directly from Microsoft with an automatic updater.

"Moonshine provides an NPAPI plugin that advertises it supports Windows Media to Firefox. When Firefox comes across said media, it loads the Moonshine plugin. Moonshine in turn loads Moonlight, and proxies NPAPI calls directly to Moonlight," Bockover explains in a blog entry. "Moonshine then injects the Silverlight JavaScript into the browser, and binds it to the Moonlight plugin instance. From the browser perspective, it's Windows Media, but the real stuff under the hood is just pure unadulterated Moonlight, driving a standard Silverlight application."

Like Moonlight, the Moonshine plugin is deployed as a Firefox extension that can be installed directly through the browser. After it is installed, WMV streams work out of the box on C-SPAN and other sites. The embedded player has a standard user interface with a volume control, full-screen playback support, and a tracking slider that shows playback progress and can be used to jump to a specific part of videos.

In addition to providing the browser plugin, Bockover has also released a desktop application that operates on the same principle. The desktop application leverages XULRunner and loads a Moonlight canvas into an HTML block within the XUL user interface. In order to use the desktop application, you have to compile the plugin from source. I had no difficulty getting it to work on my desktop computer with openSUSE 11.1 after I installed the mozilla-xulrunner190-devel package. The Moonshine desktop application is particularly intriguing because it demonstrates the potential of mixing XUL and Silverlight content.

Another interesting aspect of the Moonshine project is MTK, a very lightweight widget toolkit modeled after GTK+ that Bockover assembled to build the user interface for the media player. It is written in JavaScript and generates XAML code. Silverlight 2.0 introduces its own widgets, so MTK will not likely be used for the next major iteration of Moonshine, but Bockover believes that MTK could be repurposed and used to build an SVG widget toolkit that might be useful for rich Web application development with JavaScript and SVG.

Moonshine is a very practical and inventive use of Moonlight and it demonstrates the power and versatility of the Moonlight stack. It's a big improvement over struggling with embedded Totem and MPlayer plugins. To install Moonshine, visit the project's Web site.