Blogs

File API Panel and Follow-Up Media BOF

Wednesday afternoon/evening (starting at 5:15), Andrew Morton (drewish) and I will be co-presenting The Future of Files and Media in Drupal 7, where we'll talk about the big changes to the File API from 6 to 7, and efforts to backport some of the functionality into 6. Following this, we'll segue into a BOF with Arthur Foelsche (arthurf), where we'll discuss some of the exciting things coming from the Media Sprint 2009. (In fact, he and I worked on the Media module some tonight, putting in some exciting md5 hashing to allow jQuery to communicate indirectly with Drupal about uploaded files without compromising security or speed).

See you then!

Embedded Media Field Provider Tutorial

FYI, I'm planning to do a Dojo session (using DimDim) sometime hopefully early this week around Embedded Media Field, with the following goals:

* Create a provider file for Hulu.com: This will cover the basic steps to create an include file for emfield, with a basic video provider who provides an API. As Hulu.com implements oEmbed, this will also give a brief introduction to that standard. As Hulu.com will not be included as part of the package of emfield, this will also show the expected way to provide a file outside of the base module.
* Create a provider file for IMDB. This media provider does not offer an API, so it gives a basic introduction to the difficulties involved in accommodating such a provider. Even though IMDB uses Hulu for its videos, their TOS prohibits page scraping. So any techniques covered in this portion of the demonstration are for instructional purposes only.

This live session will be for intermediate developers. It assumes you know how to build a module, and that you understand Drupal's hook system. It will be recorded for later viewing.

Date/time and more info later.

(Cross-posted at the Drupal Dojo.)

Thumbnails Stored Locally with Embedded Media Field

As you can see here, thumbnails are now stored locally with Embedded Media Field. This opens the way to ImageCache integration and more.

This example also makes use of a new formatter, which uses jQuery to replace the thumbnail with an inline video, so that cookies aren't sent to the provider unless the user clicks to play.

Video: 
See video

Druplicon Play Button...

Here's a play button. Maybe for Embedded Media Field...

Cufón, an Alternative to sIFR for Image Replacement

I was struggling with sIFR yet again this morning, an odd WSOD in IE7 and other problems. John Haas showed me Cufón as a replacement, and I was quickly impressed with its potential. The project promises cross-browser compatibility with no plug-ins (bye, bye, Flash!), as well as being fast and easy.

Image Replacement with Cufon!

So I gave it a whirl. At first, I opened a feature request at the Dynamic Rendering module to add support, at the same time digging into the module to see what I would need to add for this new plugin.

However, in the end, I decided the approach was too heavy handed. All I needed to do was add a couple of (very small) scripts to the theme.

First, you need to download the cufon-yui.js script. Then you'll take your TTF or OTF font and run it through the provided generator, resulting in a small (<26kb) script that embeds your font (such as A_Charming_Font_400.font.js in this example).

I just dropped the required javascripts into the theme folder, and modified the theme's info file:

  scripts[] = cufon-yui.js
  scripts[] = A_Charming_Font_400.font.js
  scripts[] = mytheme.cufon.js

And finally drop something like the following in the new mytheme.cufon.js script referenced above. (Just use jQuery selectors for this part.) You can look in the generated javascript if you're not sure what fontFamily to replace.

  if (Drupal.jsEnabled) {
    $(document).ready(function() {
      Cufon.replace('h2.title', { fontFamily: 'A Charming Font' });
      Cufon.replace('#big-title', { fontFamily: 'A Charming Font' });
      // Note you can add other generated fonts as well, such as below...
      Cufon.replace('#fancy-title', { fontFamily: 'Some Other Font' });
    });
  }
That's it! No flash required, no "flash of screen" associated with sIFR. It just works. (And did I mention fast?)

Media Sprint TODO?

The Media Sprint 2009 Wiki has a rough outline, based on an earlier document started by arthurf, but needs some serious fleshing out. I plan to begin working in earnest again on the sprint later next week and the following (am trying to slot 3-4 solid working days towards it).

There are also several volunteers who have offered to help over the coming weeks as well. We need to try to build some organization.

I'm up against a couple of roadblocks with both the Media module and its included Resource module, and need some advice to go forward with those.

Particularly, I'm not sure what's intended during media_ahah_formatter_load(), which is what, I imagine, needs to both save the gathered resource into the file system, and make sure it adds to the field or attachment in the form. Arthur's also mentioned some difficulties in conceptualizing how we'll know what metadata to collect between submission and uploading.

I've also run into problems with the Resource module in my starts for Media: YouTube. For instance, we have to instantiate some classes during hook_boot, but don't have access to drupal_get_path() at that phase of the boot process. I've created a hackish work-around, where we store the module's path during installation, and check in hook_exit if the path has changed so we can set the new variable. I'm convinced it's not the best method, but haven't figured another yet.

So I'm opening this thread (at gdo) for questions of this nature, hoping people can help out, or at least take a closer look at the modules to help flesh out a TODO list for myself and other interested developers. I personally will have a lot more questions as I go along.

Thanks,
Aaron

(Cross-posted at Groups.Drupal.org.)

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

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

Media Sprint at Zivtech!

Tomorrow (January 27, 2009) we'll be continuing the Media Sprint 2009, at the Zivtech office in Philly. Our stated goals: document the heck out of the Media module, and get a new PHP Stream Wrapper ready for it. And afterwards, at 3:30 PM EST, we'll meet with the Drupal Dojo to teach interested folks how to write their own!

Zivtech

For more information, see Media Sprint Wiki at http://groups.drupal.org/node/18063, Documentation at http://drupal.org/node/356802, and Media Module at http://drupal.org/project/media. You can also view a Proof of Concept video at http://www.24b6.net/2009/01/09/media-sprint-prototyping.

Media Sprint 2009 Panel at DCDC

New panel at DrupalCon DC: Media Sprint 2009!

This January, several developers met in NYC and virtually to launch an effort to overhaul media and file handling in Drupal. The ongoing work is now coming to fruition, and this panel will present the changes and their implications to the community. Using the Media module, it's now possible for a user to use a single GUI to manage all files, including external sources such as a CDN, Amazon S3, and YouTube. We will examine the underlying PHP Stream Wrappers and Media API that makes this possible.

I will join Arthur Foelsche and Darrel O'Pry to help present this topic.

Drupal Dojo: Media Sprint Recap

Here's the DimDim recap of the first Drupal Dojo session of the year, where Arthur Foelsche (arthurf) and I recapped the initial push in the ongoing Media Sprint! You can skip the first few minutes; the action doesn't really begin until 3:50.

See the recap...

Syndicate content

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.