VideoPress: resolve the inline player's poster in the browser when the server has none - #52574
Conversation
…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>
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
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:
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. |
Code Coverage SummaryCoverage changed in 3 files.
1 file is newly checked for coverage.
|
…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>
Fixes N/A — follow-up to #52011 (the poster facade) for Linear VIDP-412.
Proposed changes
posterattribute, the local attachment's metadata and the anonymousv1.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.metadata_tokenand 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.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 untilmount()replaces the facade, the placeholder carriesis-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.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.[videopress <guid>]shortcode and a pasted videopress.com URL.v1.1/videos/<guid>request per video, anadmin-ajax.php?action=videopress-get-playback-jwtrequest, then the poster withmetadata_token=; still novideopress.jsuntil a click.videopress.jsin DevTools and the play button comes back. Click while a lookup is still running: no poster is inserted over the mounted player.jp test js packages/videopress,jp test php packages/videopress.🤖 Generated with Claude Code