Wikipedia's new HTML5 video player

This article brought to you by LWN subscribers Subscribers to LWN.net made this article — and everything that surrounds it — possible. If you appreciate our content, please buy a subscription and make the next set of articles possible.

Wikimedia recently rolled out a new feature on Wikipedia and related sites: an HTML5-based media player. Although Wikimedia's version is implemented in an extension for the MediaWiki software, the player itself is based on an existing open source tool, which makes it potentially useful to a much wider audience.

The player is provided in MediaWiki's TimedMediaHandler extension, which is an adaptation of the HTML5 media player created by the Kaltura video platform. Although the HTML5 <video> element garners more attention, the player can handle <audio> content as well. Previously, Wikipedia and its sister sites had embedded multimedia content in pages via an Ogg-only player (Theora for video, Vorbis for audio), which came with its share of difficulties for users whose browsers lacked Ogg support. The new player handles the royalty-free WebM format as well (sporting VP8 video support), but its key features extend beyond codec coverage.

First, the extension is designed to allow page authors to embed video or audio directly into a MediaWiki site using the same syntax used for images. Displaying a video can be as simple as adding [[File:Foo.ogv]] to the page text; the extension handles the rest. As is the case with other MediaWiki markup elements, appending a vertical bar allows the author to access some optional features. The |start=mm:ss argument will start playing the media clip at the time specified; similarly |end=mm:ss indicates when to stop playing the clip. The |thumbtime=mm:ss argument uses the frame at time mm:ss as the thumbnail image for the video.

For site visitors, the player should appear as an embedded video with a strip of controls across the bottom, just like all of the Flash-based players so common today. The Wikimedia bug tracker includes some reports of difficulty with Safari on some versions of Mac OS X, but at the moment there is not a definitive browser compatibility list.

The extension is also designed to handle closed captioning, subtitles, and any other "timed text" associated with an audio or video file. MediaWiki supports the SRT captioning format for timed text, and the player displays a "CC" icon in the media toolbar from which users can activate any available text track. Subtitles can be in any language; after all, one of Wikimedia's goals is to provide translations into as many languages as possible. Consequently, the HTML5 media player integrates with MediaWiki's existing translation tools.

It is also tied in to MediaWiki's media upload system. In a blog post outlining the history of the player, Guillaume Paumier notes that the organization has put effort into re-engineering Wikimedia Commons, the content repository shared by all of Wikimedia's sites. The ability to start and end delivery of multimedia content at specific timestamps is, no doubt, one technique used to remove redundancy: there is no need to store multiple copies of a lengthy video so that specific segments can be played back on different pages.

Paumier also contrasts the playback extension with the services offered by commercial video hosting sites. The MediaWiki extension does not harvest end-user data or report it to anyone else, and it displays authorship information for the content, even when embedded in a third-party page.

Servers, fallback, and more

The server side of the TimedMediaHandler extension also allows the wiki to transcode content on the server side to deliver it at different quality levels and resolutions. It uses FFmpeg to perform the transcoding, from a pre-defined set of basic profiles (160p, 480p, 720p, etc.). Which transcoding profiles are active is configurable in the MediaWiki settings file. Transcoding jobs are not automatically run by the MediaWiki job queue due to their resource-intensive nature; they can be queued up, but the resulting webVideoTranscode queue must be started manually. In the player user interface, the available versions of a file are accessible in a pop-up menu.

On browsers that do not support the player widget (which would include any that have JavaScript switched off, as it uses jQuery), the extension falls back on the Java-based Cortado media player applet. Presumably those who switch off both JavaScript and Java are comfortable missing out on some audio and video content. Interestingly enough, although Vorbis remains the sole audio codec supported in the current release, the documentation notes that MP3 support is in the works, awaiting the expiration of the relevant patents. In fact, the documentation says the patents will expire in 2012, although there are plenty of other dates given in other locations (including Wikipedia itself).

Beyond MP3, there are other codec possibilities (such as WAV, Opus, and FLAC). Multiple codec support is hardly the mission-critical issue for Wikimedia, however. Integration with the existing page creation and editing tools is probably of more practical importance. On that front, there is still plenty of work remaining to be done. In September 2010, TimedMediaHandler developer Michael Dale wrote a blog entry about the Kaltura video "sequencer," an editing widget that Wikimedia was working to integrate into the MediaWiki page editing tools.

The Kaltura sequencer is not yet a full editor; rather than creating a single output file, it creates a tightly-orchestrated sequences of clips. This means there is still a gap in the workflow for open web video, much as there still is on the desktop. Nevertheless, the Wikimedia TimedMediaHandler player is still an important milestone, if for no other reason than because of the vast assortment of MediaWiki-based web sites.