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 :

/**
 * 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);
}
Anonymous’s picture

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

DamienMcKenna’s picture

Version:7.x-3.1» 7.x-3.x-dev
Assigned:» Unassigned
Issue summary:View changes
Status:Needs review» Fixed

Committed.

DamienMcKenna’s picture

Version:7.x-3.x-dev» 8.x-1.x-dev
Status:Fixed» Patch (to be ported)

Needs to be ported to the 8.x-1.x branch.

  • minnur committed 3f68621 on 8.x-1.x
    Issue #1934942 by mogtofu33: Support for DailyMotion HTML5 support.
    
minnur’s picture

Status:Patch (to be ported)» Fixed
minnur’s picture

Status:Fixed» Closed (fixed)