You are here

README.txt in Video Filter 5

Same filename and directory in other branches
  1. 5.2 README.txt
  2. 6.3 README.txt
  3. 6 README.txt
  4. 6.2 README.txt
  5. 7.3 README.txt
/* $Id: */

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.

Installation

Enable the module on the modules page.

Go to admin/settings/filters and configure the input 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 input format. There you can change the default size and auto play settings.

Usage

Single video: [video:url]
This will output the video using the default settings.

Random video from multiple URL's: [video:url,url]
This will output one of the specified videos each time.

You can also set some parameters in the call:

[video:url width:X height:Y align:left/right autoplay:1/0]
This will override the default settings for this video.

Developers

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

File

README.txt
View source
  1. /* $Id: */
  2. 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.
  3. Installation
  4. Enable the module on the modules page.
  5. Go to admin/settings/filters and configure the input 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 input format. There you can change the default size and auto play settings.
  6. Usage
  7. Single video: [video:url]
  8. This will output the video using the default settings.
  9. Random video from multiple URL's: [video:url,url]
  10. This will output one of the specified videos each time.
  11. You can also set some parameters in the call:
  12. [video:url width:X height:Y align:left/right autoplay:1/0]
  13. This will override the default settings for this video.
  14. Developers
  15. This module calls hook_codec_info(), so you can add your own codecs.
  16. Example:
  17. function MODULE_codec_info() {
  18. $codecs = array();
  19. // You can offer multiple video formats in one module.
  20. $codecs['youtube'] = array(
  21. // Will be used some day in user information.
  22. 'name' => t('YouTube'),
  23. // The callback that will output the right embed code.
  24. 'callback' => 'MODULE_youtube',
  25. // Regexp can be an array. $video['codec']['delta'] will be set to the key.
  26. 'regexp' => '/youtube\.com\/watch\?v=([a-z0-9]+)/i',
  27. // Ratio for resizing within user-given width and height (ratio = width / height)
  28. 'ratio' => 425 / 355,
  29. );
  30. return $codecs;
  31. }
  32. And this will be your callback function:
  33. function MODULE_youtube($video) {
  34. // $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.
  35. $video['source'] = 'http://www.youtube.com/v/'.$video['codec']['matches'][1].($video['autoplay'] ? '&autoplay=1' : '');
  36. // Outputs a general for embedding flash players. Needs width, height, source and optionally align (left or right) and params (a list of attributes)
  37. return video_filter_flash($video);
  38. }