Skip to content

VideoPress: size host wrappers from intrinsic dimensions - #52860

Open
vianasw wants to merge 5 commits into
trunkfrom
fix/videopress-host-orientation
Open

vianasw wants to merge 5 commits into
trunkfrom
fix/videopress-host-orientation

Conversation

@vianasw

@vianasw vianasw commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Proposed changes

Portrait VideoPress videos can be rendered inside a landscape box because the host uses cached oEmbed dimensions or a 16:9 fallback. Use the saved videoRatio when rendering iframe markup, and update inline and editor wrappers when the player reports its intrinsic dimensions.

  • Subscribe to the inline dimensions API and read its current value to recover an event emitted before mounting finishes. Ignore stale reads and remove editor subscriptions on unmount.
  • Accept dimension messages only from the matching editor iframe, allowed origin, and GUID; request the current dimensions on attachment and load.
  • Let live player dimensions take precedence over cached preview dimensions, and allow the dimensions message/query through the player bridge.
  • Retain the existing fallback for older player bundles without the dimensions API.

Related product discussion/links

VIDP-383. Requires a player bundle exposing api.info.dimensions, api.info.onDimensionsChanged, and the corresponding iframe protocol for live corrections. Saved-ratio rendering works independently.

Does this pull request change what data or activity we track or use?

No. Uses dimensions already available to the player; no additional metadata request or tracking.

Testing instructions

  1. Build the VideoPress package and enable the inline player with a compatible player bundle. Insert a portrait VideoPress block, save it, and check both the editor and the published page. Its wrapper should adopt the portrait shape when video info arrives, before playback.
  2. Resize the parent and play the video. The wrapper should keep the correct ratio. Test a landscape video and two instances of one GUID as well.
  3. Disable inline playback and repeat with iframe embeds. Check that the editor stores the reported ratio and that rendered iframe height uses the saved ratio even if oEmbed dimensions are stale. Exercise the fallback for a newly uploaded video whose oEmbed response is unavailable.
  4. Verify preview-on-hover and the player bridge still work, and that messages from another iframe or with invalid dimensions do not change this block.

Validation completed:

  • Full package Jest suite: 167 suites, 1,724 tests passed on the branch updated with current trunk. Six editor regression tests cover preview fallback, live dimensions taking precedence over stale previews, duplicate reports, subsequent ratio changes, and video replacement.
  • Focused coverage: all statements and branches in the editor ratio-selection logic are covered; edit.tsx line coverage rises from 0% to 42.38%.
  • Full package PHPUnit suite: 452 tests, 1,367 assertions, one skip on the branch updated with current trunk.
  • TypeScript, ESLint, Prettier, PHPCS, and the inline/player-bridge Webpack build passed.
  • Real Chrome with the rebuilt inline boot script: 2BlxnlwP changed from a 16:9 wrapper to 270×480 before media loaded (readyState: 0, time zero), and remained correct through playback. Two instances both received the portrait ratio. ChV25VLR remained landscape at 270×152.
  • The duplicate inline player produced a Video.js xhr error, also reproduced with the unchanged boot script. Wrapper sizing was verified; duplicate playback is a separate existing issue.
  • Fixed the five reported Phan issues: convert calculated iframe heights to strings at the WordPress API boundary and make shortcode test array keys explicit.
  • CI static analysis passed for the PHP fixes (94da644b3d0). Local Phan requires the unavailable PHP ast extension.
  • Player message tests use distinct sandbox and nested video iframe windows, validating the source-window check against the current trunk fixture. Reproduced the prior CI failure locally before confirming the corrected tests pass.

This changes host sizing only; it does not rotate served media or repair stored source metadata.

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the fix/videopress-host-orientation branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack fix/videopress-host-orientation

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added [Package] VideoPress [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] VideoPress A standalone plugin to add high-quality VideoPress videos to your site. [Status] In Progress [Tests] Includes Tests labels Sep 28, 2026
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: October 6, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Videopress plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Sep 28, 2026
@jp-launch-control

jp-launch-control Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 6 files. Only the first 5 are listed here.

File Coverage Δ% Δ Uncovered
projects/packages/videopress/src/class-initializer.php 502/559 (89.80%) 0.19% 0 💚
projects/packages/videopress/src/client/block-editor/blocks/video/components/player/index.tsx 72/97 (74.23%) 3.64% 0 💚
projects/packages/videopress/src/client/block-editor/hooks/use-inline-player/index.ts 79/82 (96.34%) 0.29% 0 💚
projects/packages/videopress/src/client/lib/inline-player/index.ts 87/92 (94.57%) 0.12% 0 💚
projects/packages/videopress/src/class-block-editor-content.php 122/142 (85.92%) 9.10% -12 💚

1 file is newly checked for coverage.

File Coverage
projects/packages/videopress/src/client/lib/inline-player/dimensions.ts 23/23 (100.00%) 💚

Full summary · PHP report · JS report

@vianasw
vianasw marked this pull request as ready for review September 30, 2026 12:53
@vianasw
vianasw requested a review from a team as a code owner September 30, 2026 12:53
@vianasw vianasw added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Sep 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] VideoPress [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] VideoPress A standalone plugin to add high-quality VideoPress videos to your site. [Status] In Progress [Status] Needs Review This PR is ready for review. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant