Skip to content

VideoPress: resolve the inline player's poster in the browser when the server has none - #52574

Merged
heydemoura merged 2 commits into
trunkfrom
fix/videopress-inline-player-facade-poster
Sep 23, 2026
Merged

heydemoura merged 2 commits into
trunkfrom
fix/videopress-inline-player-facade-poster

Conversation

@heydemoura

@heydemoura heydemoura commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes N/A — follow-up to #52011 (the poster facade) for Linear VIDP-412.

Proposed changes

  • Bug: with the inline player setting on, video embeds render as a black box until play. VideoPress: poster facade for the inline player, load the player on play #52011 moved poster resolution from the player, which fetches video info in the browser with a playback token, to PHP, which only knows the block's poster attribute, the local attachment's metadata and the anonymous v1.1/videos/{guid} lookup. So private videos, videos on a private-by-default site, and videos the anonymous API refuses (unknown_media) reach the page with no poster, and the facade shows only its dark background. The block, both shortcodes and oEmbed are all affected.
  • Poster resolved in the browser when the server had none. The boot script now gives a facade without a poster image one before it is played: it fetches the video info anonymously, and when that fails or reports the video private it asks for the playback token through the same admin-ajax endpoint the token bridge uses, refetches with metadata_token and tokenizes the poster URL the way the player does. Facades that already carry a server-rendered poster are untouched (that stays the LCP fast path); a poster image that fails to load is replaced the same way. Lookups wait until the facade is within 200px of the viewport and are shared between facades of one video, so a long page does not fire a request per video on load.
  • Play button and spinner like the player's. The facade's play glyph is now the player's own large play icon at the player's size (min(max(100vw / 8, 60px), 90px), 40px under 200px) with its hover scale and the chrome v2 pre-play vignette behind it. From the click until mount() replaces the facade, the placeholder carries is-loading, which swaps the glyph for the player's waiting spinner (48px glass pill with the rotating arc, 40px in containers under 250px). So nothing visibly jumps when the player takes over.
  • [wpvideo] in the Jetpack plugin passes the poster frame already present in the video data it fetched, rather than looking it up again.
  • Tests: a Jest suite for the resolver (public video, private via token, private fallback, retry after a miss, shared lookup) and boot-script cases (fill before play, replace on error, bare facade when nothing is found, no poster added after a click mounted the player, viewport gating).

Related product discussion/links

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

No. The browser makes the same video-info and playback-token requests the player itself makes on play; they now happen before play for videos the server could not resolve a poster for.

Testing instructions

Setup as in #52011: a Jetpack-connected site with VideoPress, jp build packages/videopress plugins/jetpack, Jetpack → VideoPress → Settings → "Load the player once per page instead of once per video" switched on.

  • Make a video private (or turn on "Private videos by default" in the VideoPress settings) and put it on a page as a video block, a [videopress <guid>] shortcode and a pasted videopress.com URL.
  • Before: each embed is a black box with a play button until clicked. After: each shows its poster shortly after load. DevTools → Network: one v1.1/videos/<guid> request per video, an admin-ajax.php?action=videopress-get-playback-jwt request, then the poster with metadata_token=; still no videopress.js until a click.
  • A public video whose poster PHP could render keeps its poster in the HTML and triggers no request before play.
  • Scroll a long page of videos: posters below the fold are only looked up as they approach the viewport.
  • The play button looks like the player's own (compare with a video block that has Autoplay on, which mounts the player at once). Click a facade: the glyph gives way to the player's spinner until the player appears, then playback starts as before. Throttle the network to see the spinner longer; block videopress.js in DevTools and the play button comes back. Click while a lookup is still running: no poster is inserted over the mounted player.
  • Automated: jp test js packages/videopress, jp test php packages/videopress.

🤖 Generated with Claude Code

…e server has none

The poster facade (#52011) moved poster resolution from the player, which
fetches video info with a playback token, to PHP, which only knows the
block's poster, the local attachment and the anonymous video lookup. Private
videos, private-by-default sites and videos the anonymous API refuses reach
the page with no poster and show a black box until play.

The boot script now gives such a facade a poster before it is played: it
fetches the video info anonymously, then with the playback token from the
token bridge's admin-ajax endpoint when the video is private, tokenizing the
poster URL the way the player does. Lookups wait for the facade to near the
viewport, are shared per video, and also replace a poster that fails to
load. The Jetpack plugin's [wpvideo] path passes the poster frame it already
fetched.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@heydemoura
heydemoura requested a review from a team as a code owner September 21, 2026 19:20
@heydemoura heydemoura added [Feature] VideoPress A feature to help you upload and insert videos on your site. [Status] Needs Review This PR is ready for review. [Type] Bug labels Sep 21, 2026
@heydemoura heydemoura self-assigned this Sep 21, 2026
@github-actions

github-actions Bot commented Sep 21, 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-inline-player-facade-poster branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack fix/videopress-inline-player-facade-poster

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. [Tests] Includes Tests labels Sep 21, 2026
@github-actions

github-actions Bot commented Sep 21, 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.

@jp-launch-control

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

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/packages/videopress/src/client/lib/inline-player/index.ts 85/90 (94.44%) 1.59% 1 ❤️‍🩹
projects/plugins/jetpack/modules/videopress/class.videopress-player.php 87/474 (18.35%) 0.31% 1 ❤️‍🩹
projects/packages/videopress/src/class-inline-player.php 212/215 (98.60%) 0.08% 0 💚

1 file is newly checked for coverage.

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

Full summary · PHP report · JS report

…e player's

The facade's play glyph, its pre-play scrim and the spinner shown from the
click until the player mounts now copy the player's chrome v2 styles: the
large play icon at the player's size and hover scale, the centered vignette,
and the glass-pill arc spinner. The loading state moves from the button to
the placeholder so the spinner outlives the button and comes down with it in
mount().

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@heydemoura
heydemoura merged commit 31a5d53 into trunk Sep 23, 2026
82 checks passed
@heydemoura
heydemoura deleted the fix/videopress-inline-player-facade-poster branch September 23, 2026 16:39
@github-actions github-actions Bot added [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. and removed [Status] Needs Review This PR is ready for review. labels Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] VideoPress A feature to help you upload and insert videos on your site. [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] UI Changes Add this to PRs that change the UI so documentation can be updated. [Tests] Includes Tests [Type] Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant