Negotiate max width/height of oEmbed assets more intelligently

Created on 27 April 2018, about 6 years ago
Updated 8 April 2024, 3 months ago

Problem/Motivation

Maximum width and maximum height can be set for various media types such as video and photo. These are legitimate oembed request parameters which have a specific function.

The height and width values returned by the provider take into account the maximum size settings and aspect ratio of the resource. For example, if both "max width" and "max height" are set to 500, the "width" and "height" returned might be 500 and 300.

Reference: https://oembed.com/

Duplicate issue with a longer explanation: #3310520: oEmbed videos should use returned height and width values β†’

Steps to reproduce

Current behaviour:

  • When set to zero, the provider determines width and height and returns them in the response
  • When set to non-zero, these are sent to the provider but the response is ignored. Instead, Drupal sets the dimensions to these exact values

Expected behaviour:

  • When set to zero, the provider determines width and height and provides them in the response. Drupal sets the dimensions to the "height" and "width" values returned by the provider.
  • When set to non-zero values, these are sent to the provider. Drupal sets the dimensions to the "height" and "width" values returned by the provider.

Proposed resolution

For height and width check resource width/height FIRST

Remaining tasks

NA

User interface changes

NA

API changes

NA

Data model changes

NA

Release notes snippet

When setting oEmbed width/height to 0, the provider width/height will be used.

Original report

From #2831944-227: Implement media source plugin for remote video via oEmbed β†’ :

Some oEmbed providers -- notably YouTube -- will completely ignore the max_width and max_height settings of the oEmbed formatter, which can result in a video overflowing a frame that is far too small for it, and that looks extremely weird. Therefore, given a max_width/height and the width/height of the resource, the formatter should choose whichever value is bigger.

Sounds like a pretty good idea, but it could introduce some weirdness and complexity under certain circumstances. This issue is to figure out if and how we should implement that.

✨ Feature request
Status

Fixed

Version

10.3 ✨

Component
MediaΒ  β†’

Last updated about 2 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

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