Aggregator multimedia

I was not very happy about the existing implementation for displaying multimedia content in the aggregator. It only supported a few media formats and was pretty much hard-coded. I decided it deserved something better.

I was already using the browser widget to present the article content.
Since this would in practice be an embedded XUL runner, Firefox or MSIE it should already be capable of presenting a variety of media formats as long as a suitable plug-in has been installed. The problem is that RSS feeds with multimedia content typically look something like this:

Notice that there is no code to format the media element in the browser and there is no guarantee that the browser could figure out what to do simply on the basis of the URL.

The solution I ended up with is quite simple: Detect the media type of the content, match it against a database of content handlers and generate suitable HTML code to wrap around. Now, this database must be easily maintainable and it must use a flexible, open format. What could be better than the Eclipse extension point mechanism?

The following is an example of a content-handler declaration that handles the example shown above.

Note that the “<” and “>” characters inside code are normally escaped. They are shown here for readability

Basically you declare a handler with a name, MIME type and file name suffix followed by the HTML code required to embed the player inside a web page. The ${content} string will in this case be replaced with the enclosure URL.

This feature is now used to the full. All content shown in the aggregator is rendered in this way. The Eclipse extension point mechanism has once again shown it’s value.

Leave a Reply