Media: YouTube (PHP Stream Wrapper)

Share this

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...)

<?php
// $Id: ResourceYouTubeStreamWrapper.inc,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 = 'http://youtube.com/watch';
}
?>

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...)

Comments

Anonymous's picture

I need to see how this script

I need to see how this script would be working. :/

aaron's picture

Media: YouTube

You can see this in action when you install the Media: YouTube module for Drupal 7, where the stream wrapper now resides.

Dragos's picture

WHen will this be available?

I need to see how this script would be working.
I can't figure it out how to download videos from YouTube with PHP,

aaron's picture

Stream Wrappers are now in

Stream Wrappers are now in core for Drupal 7. That means the hard part's been done. Getting the YouTube stream wrapper to work should be much easier now. Not sure when I'll get to it, but definitely sometime in the Fall.

imprezy integracyjne's picture

"I continued backporting the

"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."
Drupal 5 too ?

The Society for Venturism has chosen me as the recipient of its charity for this year, to hopefully offer me cryonic preservation when the time comes. And this month, Longecity, an excellent forum for the discussion of issues related to extending the lifespan of humans, has offered up a matching grant of up to a thousand dollars to help out! So help out! Please.