Problem/Motivation

When iframe_consent is enabled, OrejimeResourceFetcher::changeUrl() unconditionally appends &autoplay=1 to YouTube and Vimeo iframe URLs after the user gives consent. This means videos always autoplay after consent, which is not always the desired behavior.

Steps to reproduce

  1. Enable the iframe_consent option in Orejime settings.
  2. Place a YouTube or Vimeo media on any page.
  3. Visit the page, accept consent for the video.
  4. The video plays automatically.

Proposed resolution

Add a dedicated checkbox in the Orejime administration settings to control whether autoplay is triggered after consent, independent of the iframe_consent toggle:

  • iframe_consent: enable/disable iframe blocking (existing)
  • iframe_consent_autoplay: autoplay video after consent (new, defaults to TRUE for backwards compatibility)

changeUrl() would only append &autoplay=1 when both iframe_consent and iframe_consent_autoplay are enabled.

Remaining tasks

  • Add iframe_consent_autoplay setting to the Orejime settings form
  • Update OrejimeResourceFetcher::changeUrl() to check the new setting
  • Add the setting to the config schema
  • Write tests

User interface changes

A new checkbox "Autoplay video after consent" is added to the Orejime administration settings page, visible only when iframe_consent is enabled.

API changes

None.

Data model changes

A new boolean key iframe_consent_autoplay is added to the orejime.settings config object.

Issue fork orejime-3608679

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

macsim created an issue. See original summary.

macsim’s picture

Status: Active » Needs review
Branch MR
2.0.x !26
3.0.x !25