Video Filter

fokke - November 21, 2007 - 16:10

This is a highly flexible and easy extendable filter module to embed any type of video in your site using a simple tag. Other modules can add video sites/formats (called codecs) using an easy plug-in architecture.

Included codecs

  • YouTube
    Accepts URLs like http://www.youtube.com/watch?v=uN1qUeId
  • Google Video
    Accepts URLs like http://video.google.com/videoplay?docid=-uN1qUeId
  • Tangle (prev. Godtube)
    Accepts URLs like http://www.tangle.com/view_video.php?viewkey=uN1qUeId
  • DailyMotion
    Accepts URLs like http://www.dailymotion.com/us/featured/video/x59guz_iron-man-addictive-tv-remix_shortfilms
  • Eyespot
    Accepts URLs like http://eyespot.com/share?cmd=permalink&r=0XCzIG2UEx9hoXiEJW07IWpUtT
  • Jumpcut
    Accepts URLs like http://jumpcut.com/view?id=31410FA4169E11DDB25E000423CF385C
  • Revver
    Accepts URLs like http://revver.com/video/856351/the-next-levelwith-nike/
  • Vimeo
    Accepts URLs like http://www.vimeo.com/319782
  • Flickr Slideshows
    Accepts URLs like http://www.flickr.com/photos/username/sets/123456789/
  • Flickr Video
    Accepts URLs like http://www.flickr.com/photos/username/123456789/
  • Gamevideos
    Accepts URLs like http://gamevideos.1up.com/video/id/12345
  • Metacafe
    Accepts URLs like http://www.metacafe.com/watch/12345/some_title
  • Gametrailers
    Accepts URLs like http://www.gametrailers.com/player/12345.html
  • College Humor
    Accepts URLs like http://www.collegehumor.com/video:123456
  • Myspace
    Accepts URLs like vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=123456789

Features:

  • Quick syntax: [video:url]
  • Setting default width, height and autoplay setting per input filter using filter settings.
  • Overriding default width, height and autoplay setting in the filtered code.
  • Show random video from comma sepparated list of urls
  • Aligning the embedded video left or right.
  • Extensions may use additional attributes, e.g. the YouTube extension has a playlist attribute to load a random video from a playlist.

Roadmap:

  • Add special regexps to included codecs to allow random picks from playlists, userlists etc.
  • Add codecs for Windows Media Player, Quicktime, Flash and other formats.

About (upgrading from) version 1.x

The 5.x-1.x and 6.x-1.x versions of the module have a less flexible plug-in architecture and leave almost all the work to the video format plug-ins. They are not supported anymore, and no bugs will be fixed. In upgrading, the only but important thing to know is that (for now) the 2.x versions need the full video (page) url in order to automaticly detect the right video format.

Adding a format

Simply write a module (or send me a file) like the following example code:

<?php
function MODULE_codec_info()
{
   
$codecs = array();

   
// You can offer multiple video formats in one module.
   
$codecs['youtube'] = array(

       
// Will be used some day in user information.
       
'name' => t('YouTube'),

       
// The callback that will output the right embedded code.
       
'callback' => 'MODULE_youtube',

       
// Regexp can be an array. $video['codec']['delta'] will be set to the key.
       
'regexp' => '/youtube\.com\/watch\?v=([a-z0-9]+)/i',

       
// Ratio for resizing within user-given width and height (ratio = width / height)
       
'ratio' => 425 / 355,
    );   

    return
$codecs;
}

function
MODULE_youtube($video) {

   
// $video contains the video URL in source, the codec (as above) and also [code][matches] with the result of the regexp and [codec][delta] with the key of the matched regexp.
   
$video['source'] = 'http://www.youtube.com/v/'.$video['codec']['matches'][1].($video['autoplay'] ? '&autoplay=1' : '');

   
// Outputs a general <object...> for embedding flash players. Needs width, height, source and optionally align (left or right) and params (a list of <param...> attributes)
   
return video_filter_flash($video);
}
?>

Releases

Official releasesDateSizeLinksStatus
6.x-2.52009-Mar-2911.46 KBRecommended for 6.xThis is currently the recommended release for 6.x.
5.x-2.52009-Mar-2910.11 KBRecommended for 5.xThis is currently the recommended release for 5.x.
Development snapshotsDateSizeLinksStatus
6.x-2.x-dev2009-May-2711.7 KBDevelopment snapshotDevelopment snapshots are automatically regenerated and their contents can frequently change, so they are not recommended for production use.
5.x-2.x-dev2009-May-2710.37 KBDevelopment snapshotDevelopment snapshots are automatically regenerated and their contents can frequently change, so they are not recommended for production use.


 
 

Drupal is a registered trademark of Dries Buytaert.