Media: YouTube (PHP Stream Wrapper)

The future of Drupal Multimedia is now!

The Media Sprint: 2009 is continuing to build up steam. I met with the folks at Zivtech in Philly yesterday, and we banged on the Media module some more. Jody Hamilton made improvements, fixing up a few things, ensuring the browser works with multiple fields, etc.

I continued backporting the Resource module (bundled with the module) to Drupal 6, to enable PHP Stream Wrappers. After that, I started work on the new Media: YouTube module and stream wrapper.

Here’s a hint of how difficult it will be to implement a new stream wrapper for another third party media provider. (Drum roll, please…)

// $Id:,v 1.1 2009/01/27 21:29:50 aaron Exp $

*  @file
*  Create a YouTube Stream Wrapper class for the Media/Resource module.

*  Base class for the YouTube PHP Stream Wrapper.
class ResourceYouTubeStreamWrapper extends ResourceReadOnlyStreamWrapper {
  private $base_url = ‘’;

Any questions?

Well, okay, so there will be a little more, such as parsing the URL of a passed media page. But really, it’s not going to be much more than that to tie in the basic functionality of Embedded Media Field into the new “File Browser of the Internet” that we’re creating with the Media Sprint.

(Next up for this particular wrapper: tie it into the YouTube API so we can save uploads to YouTube with the file system…)