Not applying to oEmbed videos

Created on 13 July 2020, over 4 years ago
Updated 11 May 2023, over 1 year ago

Problem/Motivation

There is an issue with FitVids not applying to some videos embedded with oEmbed. When a video is embedded with oEmbed, the <iframe>'s src is /media/oembed/?url=https...., and the current logic in fitvids.module that handles custom vendors sets the selector to look for src URLs starting with the specified values, rather than looking for them in any part of the URL: iframe[src^="' . trim($value) . '"]'.

As a result, since the src of oEmbed embedded videos start with /media/oembed, custom vendors specified do not get FitVids applied.

On a separate, but semi-related note, YouTube videos embedded with oEmbed get their URL converted from youtube.com to youtu.be, so adding youtu.be as a custom vendor should apply to those videos after this issue is resolved.

Proposed resolution

In fitvids.module, update the custom vendor selector to search for <iframe>s matching the custom vendors in any part of the URL, rather than limited it to just those that begin with it, which will allow oEmbed videos to have FitVids applied.

Additionally, the selectors for the default providers in jquery.fitvids.js already use iframe[src*= instead of iframe[src^= to search for iframes matching any part of the src URL, so this will keep it consistent.

๐Ÿ› Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States edwardchiapet New York, NY

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

Merge Requests

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.71.5 2024