You are here

function hook_codec_info in Video Filter 6.3

Same name and namespace in other branches
  1. 7.3 video_filter.api.php \hook_codec_info()

Defines video codecs and callbacks.

Return value

array A video codec described as an associative array that may contain the following key-value pairs:

  • name: Required. A name for the codec.
  • sample_url: Required. An example of a URL the codec can handle.
  • callback: The function to call to generate embed code for the codec. Either this or html5_callback must be specified.
  • html5_callback: The function to call to generate device agnostic, HTML5 embed code for the codec. Either this or callback must be specified.
  • instructions: Instructions for using the codec, to be displayed on the "Compse tips" page at filter/tips.
  • regexp: Required. A regular expression describing URLs the codec can handle. Multiple regular expressions may be supplied as an array. $video['codec']['delta'] will be set to the key of the match.
  • ratio: Required. A ratio for resizing the video within the dimensions optionally supplied in the token, expressed as height / width.
  • control_bar_height: The pixel height of the video player control bar, if applicable.
2 functions implement hook_codec_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

video_filter_codec_info in ./video_filter.codecs.inc
Implements hook_codec_info().
video_filter_get_codec_info in ./video_filter.module
Gets all defined codecs.
1 invocation of hook_codec_info()
video_filter_get_codec_info in ./video_filter.module
Gets all defined codecs.

File

./video_filter.api.php, line 30
Hooks provided by the Video Filter module.

Code

function hook_codec_info() {
  $codecs = array();
  $codecs['minimal_example'] = array(
    'name' => t('Minimal Example'),
    'sample_url' => 'http://minimal.example.com/uN1qUeId',
    'callback' => 'MODULE_minimal_example',
    'regexp' => '/minimal\\.example\\.com\\/([a-z0-9\\-_]+)/i',
    'ratio' => 4 / 3,
  );
  $codecs['complete_example'] = array(
    'name' => t('Complete Example'),
    'sample_url' => 'http://complete.example.com/username/uN1qUeId',
    'callback' => 'MODULE_complete_example',
    'html5_callback' => 'MODULE_complete_example_html5',
    'instructions' => t('Your Complete Example username can be the first URL argument or a sub-subdomain.'),
    'regexp' => array(
      '/complete\\.example\\.com\\/([a-z0-9\\-_]+)\\/([a-z0-9\\-_]+)/i',
      '/([a-z0-9\\-_]+)\\.complete\\.example\\.com\\/([a-z0-9\\-_]+)/i',
    ),
    'ratio' => 4 / 3,
    'control_bar_height' => 25,
  );
  return $codecs;
}