video_filter.api.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * @file
  4. * Hooks provided by the Video Filter module.
  5. */
  6. /**
  7. * Defines video codecs and callbacks.
  8. *
  9. * @return array
  10. * A video codec described as an associative array that may contain the
  11. * following key-value pairs:
  12. * - name: Required. A name for the codec.
  13. * - sample_url: Required. An example of a URL the codec can handle.
  14. * - callback: The function to call to generate embed code for the codec.
  15. * Either this or html5_callback must be specified.
  16. * - html5_callback: The function to call to generate device agnostic, HTML5
  17. * embed code for the codec. Either this or callback must be specified.
  18. * - instructions: Instructions for using the codec, to be displayed on the
  19. * "Compse tips" page at filter/tips.
  20. * - regexp: Required. A regular expression describing URLs the codec can
  21. * handle. Multiple regular expressions may be supplied as an array.
  22. * $video['codec']['delta'] will be set to the key of the match.
  23. * - ratio: Required. A ratio for resizing the video within the dimensions
  24. * optionally supplied in the token, expressed as height / width.
  25. * - control_bar_height: The pixel height of the video player control bar, if
  26. * applicable.
  27. */
  28. function hook_codec_info() {
  29. $codecs = array();
  30. $codecs['minimal_example'] = array(
  31. 'name' => t('Minimal Example'),
  32. 'sample_url' => 'http://minimal.example.com/uN1qUeId',
  33. 'callback' => 'MODULE_minimal_example',
  34. 'regexp' => '/minimal\.example\.com\/([a-z0-9\-_]+)/i',
  35. 'ratio' => 4 / 3,
  36. );
  37. $codecs['complete_example'] = array(
  38. 'name' => t('Complete Example'),
  39. 'sample_url' => 'http://complete.example.com/username/uN1qUeId',
  40. 'callback' => 'MODULE_complete_example',
  41. 'html5_callback' => 'MODULE_complete_example_html5',
  42. 'instructions' => t('Your Complete Example username can be the first URL argument or a sub-subdomain.'),
  43. 'regexp' => array(
  44. '/complete\.example\.com\/([a-z0-9\-_]+)\/([a-z0-9\-_]+)/i',
  45. '/([a-z0-9\-_]+)\.complete\.example\.com\/([a-z0-9\-_]+)/i',
  46. ),
  47. 'ratio' => 4 / 3,
  48. 'control_bar_height' => 25,
  49. );
  50. return $codecs;
  51. }
  52. /**
  53. * Alters the codecs available to Video Filter.
  54. *
  55. * @param array $codecs
  56. */
  57. function hook_video_filter_codec_info_alter(&$codecs) {}
  58. /**
  59. * Alters a video's attributes previous to rendering.
  60. *
  61. * @param array $video
  62. */
  63. function hook_video_filter_video_alter(&$video) {}