I came up with a problem inserting a Dailymotion video with the autoplay option (see here #1934908) so i decided to add support for HTML5 player for Dailymotion to solve this issue.

The code probably needs some review.

Thanks in advance for your comments ;)

Files: 
CommentFileSizeAuthor
dailymotion-html5-initial.patch1.09 KBAnonymous (not verified)

Comments

mogtofu33’s picture

Thanks, this code works fine for me, if someone want this update without hacking module you can use hook :

<?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);
}
?>
Colin’s picture

Thanks for this mogtofu33, i need to try that next time i use video_filter with dailymotion videos !