Skip to content

Fix YouTube embeds in plugin descriptions - #26327

Merged
crazytonyli merged 4 commits into
trunkfrom
bugfix/cmm-2524-plugin-description-youtube-embeds
Nov 2, 2026
Merged

crazytonyli merged 4 commits into
trunkfrom
bugfix/cmm-2524-plugin-description-youtube-embeds

Conversation

@crazytonyli

Copy link
Copy Markdown
Contributor

Description

Fixes https://linear.app/a8c/issue/CMM-2524

To reproduce the issue: On a self-hosted site, go to Plugins, open a plugin that has a YouTube video in its description (Page Generator or Elementor), and tap Description. The video shows "Video player configuration error, Error 153", and the player is wider than the screen.

These are two separate problems. The HTML was loaded without a base URL, so the embed sent no HTTP referrer, which YouTube requires. And the stylesheet limits the width of images but not iframes, while WordPress.org embeds are 750x422. Setting only the base URL fixes the error and leaves the player too wide.

The base URL is the plugin's WordPress.org page, because that's where the content comes from. It's the same approach as #25929, which uses https://wordpress.com/reader for Reader comments. Google's terms actually ask for the app ID as the referrer domain, and neither value follows that. The videos play, and the terms only mention possible reduced functionality, so I'd look into that separately for all the web views.

The iframe rule forces 16:9, because iframes don't get an aspect ratio from their size attributes. All 15 embeds I found across 7 plugins are 750x422, but an embed in another shape would be letterboxed.

Videos play fullscreen on iPhone, which is the web view's default. I didn't change that.

Note

I recommend reviewing this PR commit by commit. The first commit only moves the HTML into a method a test can call, and swift-format re-indents it.

Before After

What I ran

  • I built this change and ran the affected tests locally

WordPressTest/PluginInfoSectionContentTests: Test run with 2 tests in 1 suite passed

Testing instructions

  1. Follow the steps above and play the video.
  2. Tap a link in the description and check it opens in the browser.

Load plugin information sections with the plugin's WordPress.org page as
the base URL. YouTube needs the referrer this provides and otherwise shows
Error 153. Also fit iframes to the screen width, keeping their 16:9 shape.
@crazytonyli
crazytonyli marked this pull request as ready for review November 2, 2026 02:51
@crazytonyli
crazytonyli requested a review from jkmassel November 2, 2026 02:51
@crazytonyli crazytonyli added this to the 27.5 milestone Nov 2, 2026
@jkmassel jkmassel mentioned this pull request Nov 2, 2026
4 tasks done

@jkmassel jkmassel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked in Jetpack on an iOS 27.0 simulator: no Error 153, the player fits the screen in both orientations, and the video plays fullscreen. Follow-up fixes for "Watch on YouTube" and dark mode text are in #26330.

@crazytonyli
crazytonyli enabled auto-merge November 2, 2026 20:49
@crazytonyli
crazytonyli added this pull request to the merge queue Nov 2, 2026
Merged via the queue into trunk with commit cc45300 Nov 2, 2026
21 checks passed
@crazytonyli
crazytonyli deleted the bugfix/cmm-2524-plugin-description-youtube-embeds branch November 2, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants