Skip to content

Instantly share code, notes, and snippets.

@Irfan-Ansari
Created November 12, 2014 07:17
Show Gist options
  • Save Irfan-Ansari/389864211d61d0490f16 to your computer and use it in GitHub Desktop.
Save Irfan-Ansari/389864211d61d0490f16 to your computer and use it in GitHub Desktop.
Dailymotion videos - autoplay
<?php
/**
* Implements hook_video_filter_codec_info_alter().
* Add video filter html5 support for dailymotion.
*/
function MY_MODULE_video_filter_codec_info_alter(&$codecs) {
if (!isset($codecs['dailymotion']['html5_callback'])) {
$codecs['dailymotion']['html5_callback'] = 'MY_MODULE_video_filter_dailymotion_html5';
}
}
/**
* Add video filter html5 support for dailymotion.
*/
function MY_MODULE_video_filter_dailymotion_html5($video) {
$attributes = array(
'autoplay' => $video['autoplay'] ? 'autoplay=1' : 'autoplay=0',
);
$video['source'] = 'http://www.dailymotion.com/embed/video/' . $video['codec']['matches'][1] . '?' . implode('&amp;', $attributes);
return video_filter_iframe($video);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment