Video Filter

Video Filter 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.

Installation

Enable the module on the modules page. By default all codecs will work. You may enable/disable individual codecs on the text formats settings page.

Drupal 7, 8:

Go to admin/config/content/formats and configure the text format(s) that should be allowed to use this filter. Check the box to enable Video Filter and save. Some simple settings are available if you configure the text format. There you can change the default size and auto play settings.

All:

Make sure that Video Filter is processed before "Convert URLs to links". You can do this by dragging and dropping Video Filter to the top of the processing order list. Do this even if it's already on top, just to make sure!

If you're using the "Limit allowed HTML tags" filter, make sure Video Filter is processed after that filter.

To enable WYSIWYG support, go to the WYSIWYG settings for each input format and enable the Video Filter button. If you use CKeditor without the Wysiwyg module you need to take some extra steps. See the README in video_filter/editors/ckeditor.

Usage

Single video:

[video:url]

This will output the video using the default settings.

Random video from multiple URL's:

[video:url,url,url]

This will output one of the specified videos each time. This can be disable in each text format settings.

With parameters:

[video:url width:X height:Y align:left/right autoplay:1/0]

This will override the default settings for this video. More options provided by codecs and plugins (Drupal 8).

Included codecs

Developers

Drupal 8

See video_filter/modules/video_filter_example module to see how to add your own plugins and extend Video Filter module.

Drupal 7

This module calls hook_codec_info(), so you can add your own codecs.

Example:

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 embed 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;
}

And this will be your callback function:

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);
}

Embedding Slideshare Content

Inserting Slideshare presentations is not as easy as youtube content or other video content..

SSL Mixed Content Warnings Solution

If you have an SSL only site and are using the Video Filter module to embed YouTube videos, it's likely your users will get a mixed content

Guide maintainers

blackdog's picture