Media Code Sprint (2009)

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
You are viewing a wiki page. You are welcome to join the group and then edit it. Be bold!

Media Code Sprint and Media Module Specifications

Table of contents

  1. Introduction
  2. Road map and Time Line
  3. Use Cases
  4. API Description
  5. $item structure
  6. Wireframes
  7. Deliverables
  8. Timeline
  9. Risks
  10. Resources

Introduction
The situation with file and rich media management for the end user in Drupal leaves much to be desired. While there are many high quality modules which help implement management, storage, and display of files (and textual data), few integrate with one another and almost all use different interfaces and implementation methodologies. Historically, most of the rich media module development has happened in isolation- intentionally or not, modules have generally focused on solving a single facet of rich media issues rather than taking a more generalized approach. Though this may have made sense for the particular project, the size and scope of the Drupal community demands that the problem of rich media be addressed in a collective and integrated way with attention beyond individual immediate needs.

To this end, this project will center on several points:

  • consistent GUI for media management
  • can seamlessly degrade if GUI is disabled to stock behavior
  • is agnostic to the question of the files API
  • integrates rather than replaces current solutions for adoptibility and ease of transition
  • provides detailed documentation on the complete API

The bulk of the initial work on this project focuses on the integration of current rich media file modules with a GUI system. This will help with adoption as well as encouraging developers to work together on the facets of rich media issues. For this initial work, it is possible that the Asset module's GUI could provide the spring board toward this integration.

The end goal is a GUI for adding content to a site- including audio, images, video, embedded, and text based files (.ods, .doc, .pdf, etc). This GUI can present users with options for file conversions (for example, image resizing), previewing, and areas to insert the content into (CCK fields, attached to the node, etc). For end users, this process must be consistent, simple, and as intuitive as the highly complex process of media management can be.

Currently in dealing with media, either users face the duplication of the Asset or Image Assist insert link for each text area, or the user is restricted to the embedded media field insertion point. Though other modules (eg: TinyMCE) add additional options, the end user experience is not one interface, but many, with no clear indication of why embedding a video is different than inserting an image. The workflow and design of this module should present the end user with little to no difference between these two tasks. Finally, the options for the end user to format and insert should be able to be restricted by an administrator to simplify end user options.

Finally, there needs to be a mechanism for chaining operations once content has been added into the system. These chains should be defined by the administrator. This is likely 2.0 functionality.

Road map and Time Line

See the roadmap for development at Media Module Development Milestones.

Use Cases

API Description

<?php
/**
*  Implementation of hook_media_register
*
*  To plug into the Media API, a module must first register itself, using
*  hook_media_register. This function will return an array of items keyed
*  by a unique machine name, usually using the module's name for the name
*  space.
*
*  Note that there are two places a module may register itself, both through
*  this hook. The first, a 'resource', will be to return a listing of files,
*  and the second, 'format', is to format a listing of files. The first type
*  of item will be displayed as a vertical tab, and the second as a tab along
*  the top.
*
*  Each item is an array that will define the following keyed values:
*    'module' => $module,
*        // Where $module is the name of the module that will handle this
*        // item. This defaults to the registering module.
*    'kind' => 'resource|format',
*        // Where the value is either 'resource' or 'format'. If 'resource',
*        // then we expect the functions called from later hooks to filter
*        // our file listings. If 'format', we expect the module to format
*        // a file listing appropriately.
*    'name' => t('string'),
*        // Where 'string' is a human readable name that will be displayed as
*        // a tab or drawer.
*    'description' => t('string'),
*        // Where 'string' is a human readable description that may be
*        // displayed, describing the file listing or display format.
*    'uri' => 'scheme://',
*        // Where 'scheme://' defaults to 'public://'. If the uri is anything
*        // but the default, then that module should require the Resource
*        // module. (See that module for a further definition of schemes,
*        // which may include examples like 's3://' or 'youtube://'.)
*    'types' => '[mime-types]',
*        // Where '[mime-types]' defaults to '*', and denotes any mime types
*        // this module will handle, separated by spaces. '*' means all.
*    'callbacks' => array('[kind]' => '[callback]'),
*        // where [kind] is the kind of hook this item is, being either
*        // 'resource' or 'format' as described earlier, and 'callback' is the
*        // function that will be called to handle the functionality.
*        // A 'resource' callback should return a file listing, and 'format'
*        // will theme a file listing passed to it.
*    'fields' => array('[field type]', '[field type]'),
*        // Where '[field type]' is a CCK field type this hook will handle,
*        // such as 'filefield' or 'imagefield', or 'attachments' for the
*        // default Upload module.
*/

function hook_media_register() {
  return array(
   
'media_user_files' => array(
     
'name' => t('User files'),
     
'description' => t('Format Drupal uploaded files.'),
     
'uri' => 'public://',
     
'kind' => 'resource',
     
'types' => '*',
     
'callbacks' => array(
       
'resource' => 'media_display_user_files',
       ),
     
'description' => t("Displays all of current user's files."),
     
'fields' => array('attachments', 'filefield'),
    ),
  );
}
?>

$item structure

Wireframes

Deliverables

Timeline

* Media Module Development Milestones

Risks

Resources

File API
D7 file system wish list
Solution for media upload and distribution
File (hook_file) module
Drop hook_file_references() in favor of a table based approach

Inline & WYSIWYG:
Inline API
sun's vision for handling embedded/inline content and Wysiwyg in Drupal
Rewrite editor plugin API

File API

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week