Allow autoplay when media iframe domain is set

Created on 23 August 2024, 3 months ago
Updated 13 September 2024, 2 months ago

Problem/Motivation

In the Chrome browser, when the media iframe domain is set, the autoplay option on YouTube videos is not propagated to the inner iframe due the Permissions Policy. Here some documentation

Steps to reproduce

  • Set up OEmbed Lazyload for YouTube videos and set the autoplay option.
  • Set an iframe domain in the media settings /admin/config/media/media-settings
  • When browsing the node where the video is displayed with Firefox, autoplay will work, but not with Chrome based browsers.

Proposed resolution

Add the allow attribute to the iframe to enable autoplay for the configured domain in the media iframe setting.

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain frouco

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @frouco
  • Pipeline finished with Failed
    3 months ago
    Total: 202s
    #263105
  • Issue was unassigned.
  • Status changed to Needs review 3 months ago
  • πŸ‡ͺπŸ‡ΈSpain frouco

    MR created and ready for review

  • Pipeline finished with Failed
    3 months ago
    Total: 193s
    #264684
  • πŸ‡ͺπŸ‡ΈSpain frouco

    The patch has been modified to simply ensure that the allow tag with the features required by YouTube is set in the iframe.

    Allowed domains by feature should be managed by Drupal.

    Ready for review

  • Pipeline finished with Failed
    3 months ago
    Total: 206s
    #264689
  • πŸ‡ΊπŸ‡ΈUnited States luke.leber Pennsylvania

    This is actually a really tricky one I think...

    Correct me if I'm wrong, but if any allow attributes are specified, they act as an allow-list, meaning that if YouTube (for example) ever makes any changes to what's required, things could get pretty weird, right?

    I'll try to find some time to do some manual testing here. Something like this is really difficult, if not impossible to add real functional test coverage for.

Production build 0.71.5 2024