Video Plays After OneTrust Cookies Rejected

Created on 23 July 2025, 7 days ago

Problem/Motivation

When using the youtube_cookies module, a YouTube video is played even after the user has explicitly rejected cookies, which is an unexpected and incorrect behavior. This suggests a potential issue where the cookie consent change event might not be properly triggered or the youtube_cookies module is not correctly capturing and acting upon it.

Steps to reproduce

  1. Open a website that uses the youtube_cookies module and has embedded YouTube videos.
  2. Approve the cookies when prompted by the cookie consent popup.
  3. Reload the page.
  4. Open the cookies popup again.
  5. Reject the cookies.
  6. Attempt to play a YouTube video on the page.

Expected behavior: The YouTube video should not play, as cookies have been rejected.
Actual behavior: The YouTube video is reproduced, despite cookies being rejected.

Proposed resolution

(To be determined)

Remaining tasks

Investigate if the cookie consent solution's event for changing consent is firing correctly after rejection.

Verify how the youtube_cookies module is listening for and reacting to cookie consent changes.

Debug the module's logic to ensure it correctly prevents video playback when cookies are rejected.

Implement a fix to ensure that YouTube videos respect the user's cookie rejection.

User interface changes

None initially, as this is a backend/logic issue.

API changes

None initially, unless a new API or hook is required to properly integrate with cookie consent events.

Data model changes

None.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇪🇸Spain eduardo morales alberti Spain, 🇪🇺

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

Comments & Activities

Production build 0.71.5 2024