oEmbed YouTube videos becoming 404 with big_pipe enabled

Created on 4 March 2023, over 1 year ago
Updated 20 March 2023, over 1 year ago

Problem/Motivation

When using the oEmbed Lazy load module with Drupal, there is a susceptibility in Drupal's behavior where the intersection-observer script attached to Drupal removes the data-src attribute and copies its value to the src attribute of iFrame. This process works fine the first time but fails the second time as the data-src attribute has already been removed, causing the script to throw an error.

Steps to reproduce

  1. Install and enable the oEmbed Lazy load module in Drupal.
  2. In remote_media field add display setting as per module's instruction and use "Load third party assets when it enters the viewport" option.
  3. Embed a video using oEmbed code on a Drupal node.
  4. Refresh the page.
  5. Observe that the video loads fine.
  6. Refresh the page a few times
  7. Try a sevral times intermittently you will see the iFrame containing video showing 404 (Check network tab of Developer tools of your browser)
  8. Observe that the video fails to load, and the browser console throws an error.

Proposed resolution

To fix the issue, we have added a wrapping if condition in the intersection-observer script. This condition checks if the data-src attribute exists before swapping it with the src attribute. If the attribute does not exist, the script skips the swapping process and moves on to the next video.

Remaining tasks

Test the updated module thoroughly to ensure that the fix is working as intended.
Add patch

User interface changes

There are no user interface changes with this fix.

API changes

There are no API changes with this fix.

Data model changes

There are no data model changes with this fix.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia amjad1233 Brisbane

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024