Chrome blocks playing videos using autoplay unless they are muted.

Comments

Marty2081 created an issue. See original summary.

marty2081’s picture

Adding this preprocess seems to do the trick:

/**
 * Implements hook_preprocess_video_embed_iframe().
 */
function vefta_preprocess_video_embed_iframe(&$variables) {
  // Add an allow attribute to all Youtube iframes.
  if (strpos($variables['theme_hook_original'], 'youtube') !== FALSE) {
    $variables['attributes']->setAttribute('allow', 'autoplay; fullscreen');
  }
}

See https://developers.google.com/web/updates/2017/09/autoplay-policy-change...

marty2081’s picture

And here is a patch file.

scuba_fly’s picture

Assigned: Unassigned » scuba_fly
Status: Active » Needs review
scuba_fly’s picture

Looks good! Will make a new release soon!

  • scuba_fly committed 92bc239 on 8.x-1.x authored by Marty2081
    Issue #3005388 by Marty2081: Play video on click does not work in Chrome
    
scuba_fly’s picture

Assigned: scuba_fly » Unassigned
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.