Skip to main content

Media solutions for Drupal

One of my first projects at Arts & Sciences Computing Services was to work on the Video project. This project was, most basically, a YouTube clone that would allow the college to encode, store, and serve up public and private (copyrighted) video content thereby having complete control of its use, availability, etc. The current implementation was in C# in ASP.Net using FFMPEG to do encoding and some other libraries to handle authentication and file management.

Since I this was my first experience with C#, and more so ASP.Net, I didn't get to make a large impact (or even a tiny dent) on the Video project before a separate project took precedence and I started working with Drupal (Hint: you’re currently looking at said project). It wasn’t long I was wrapped up in writing modules and tweaking Drupal to do our bidding. The Video project was almost out of mind, in fact, until I started researching Drupal's Media module for use on yet another project.

Media module

First a little history: the solution for supporting media in Drupal 5 and 6 had been the Embedded Media Field (emfield) module, along with a hand full of extension modules providing support for 3rd party media providers like YouTube and Flickr. This, of course, wasn’t the only way to skin the cat and there were many more modules with overlapping goals and implementations. Beginning with the development of Drupal 7, the Media module project was created as certain features were added to Drupal Core and the roadmap for a media framework in Drupal changed. Currently, the Media module is in its fourth beta and is racing to a final release. (For an overview from the maintainers at DrupalCon Chicago in early March '10 see this presentation)

The Media module adds a field type "Multimedia asset" that can be used for audio, image, video or other. These types can then be configured with the Style module (a dependency for Media) to display the media assets in different sizes and encapsulations depending on context. For example, video could be delivered via Flash, or HTML 5 depending on browser user agent or show different image sizes when displaying nodes in different contexts. Each type of media asset can also have its own additional fields such as description, copyright.

However, the goals of Media module are not to be an all-in-one bloated heap, rendering all file types and resources. Instead, it is simply providing a framework to store and describe media resources to other Drupal modules. Already, there are modules supporting YouTube, Flickr, and a Media Gallery to show images in groups (check out Drupal Gardens for demos). Support for actual video files are still in between, since browser support for HTML5, Silverlight and Flash is volatile. Player modules such as MediaElement, VidoJS and Flowplayer currently work with other implementations for media such as the Video, and AudioField modules, but sometimes have difficulty when coupled with the Media module.

Arts & Sciences

Media and Drupal are exciting for the projects we’re working on at Arts & Sciences because almost all of them involve large catalogs of audio and video.  For example, one of the research projects I’ve been working on is a library of religious folklore captured in audio, video, and imagery along with translations, commentary and footnotes. The research is impressive and storing, displaying, cross referencing, and making it navigable and useable is an excellent challenge for Drupal and its newest features.

After delving into Drupal and different media solutions, I began to think back to the Video project: uploading large files, encoding, managing collections. Perhaps Drupal could be used to do all of this: using SWFUpload or FTP to handle large uploads, a FFMPEG wrapper module to encode videos, Media to store and manage the elements and Style to display the content in different contexts. This led me to a few Google Summer of Code project for Drupal: "Derivates API for Media ecosystem (D7)" and "Extend functionalities of and add new features to Media module". With the blessing and mentorship of the Media module maintainers, these projects could add features to Media enabling it to store and display Media assets more fluently and across many devices.