Created
November 12, 2014 07:17
-
-
Save Irfan-Ansari/389864211d61d0490f16 to your computer and use it in GitHub Desktop.
Dailymotion videos - autoplay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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('&', $attributes); | |
return video_filter_iframe($video); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment