Repository navigation
VideoPress: add a playlist block - #51332
Conversation
|
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! |
Code Coverage SummaryCoverage changed in 5 files.
6 files are newly checked for coverage. Only the first 5 are listed here.
|
A fresh implementation of the Video Playlist block design: the editor canvas is a live, non-editable preview (player plus entry list), and all playlist management lives in the block settings sidebar — add videos by VideoPress URL/GUID or from the media library with metadata (title, thumbnail, duration, resolution) read from the video data, drag or arrow-key reordering, duplicate detection with Add anyway/Cancel, and a filter plus position numbers on long playlists. Three server-rendered front-end layouts (side rail, grid, strip) share one markup structure, with a dark surface option, per-entry display toggles, and a view script that swaps the player on click and advances on the player's ended event when Autoplay next is on. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
6b8b883 to
ac82b90
Compare
Cover the paths CI's coverage check flagged: block registration (the editor entry, the default build metadata path, nameless metadata, and the Jetpack-without-VideoPress-module gate), the editor's media library selection mapping and error, layout/playback/display option changes, drag-and-drop reordering, filtering, the busy add state, Enter-to-add, preview-index adjustments around reorders and removals, hour-long duration formatting in the PHP render, and the view script's guards for empty playlists and entries without an embed URL. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The module-gating test aliased stdClass as Jetpack, which throws on PHP < 8.3 and is rejected by Phan; use a user-defined anonymous class instead. Also align the side-rail header with the design (count and total duration as one right-aligned monospace meta line), give the sidebar notices breathing room above, and stop dropping resolution metadata: media-library picks now store the attachment height and numeric strings from the API are coerced, so 240p videos get their badge. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Fixed the CI failures and tightened the block against the design spec:
🤖 Generated with Claude Code |
The video count and total duration now sit to the right of the "Up next" label in the list header instead of in a block-level header row, which is removed from both the front-end render and the editor preview so the canvas keeps matching the page exactly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The count · duration line (side rail), the grid runtime, and the strip progress counter now use the design's ui-monospace stack at its sizes — 12px for the side-rail meta, 11.5px for the grid and strip counters — in the muted color, shared through a single font-stack variable. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The sidebar's library action sat flush against the help paragraph; give it its own row with breathing room so the two ways of adding a video read as distinct actions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The mini wireframes had a fixed height with fluid width, so they stretched as the sidebar resized; a fixed 66.664 / 39 aspect ratio keeps their proportions on every screen size. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The placeholder's flex column stretched every child, so the Media Library button spanned the full width; the button now keeps its natural width and the icon, title, instructions and form column are centered, matching the empty-state design. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Block attributes now persist only the video reference and the numeric metadata behind the server-rendered totals (duration, height). Titles and posters are read fresh from the video data everywhere: the editor keeps a per-session metadata cache filled from the videos API, and the front-end view script hydrates each entry's title, poster and the now-playing line the same way, so both always reflect the videos' current metadata. The server renders positional fallbacks and ignores any stored display fields. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Reworked metadata handling so display data is always live, per review feedback:
🤖 Generated with Claude Code |
An empty URL field previously let the button fire and answer with an error; the button is now disabled (but still focusable for assistive technology) until the field has content. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds a Typography panel with the block editor's own font-family control (fed by the theme's theme.json font presets) for the now-playing title and the entry titles. Attributes store the preset slug; both the editor preview and the PHP render expose the choice as a CSS custom property pointing at the theme's font-family preset variable, so the canvas and the page render identically. Slugs are validated server-side and anything else is dropped. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The font pickers rendered in the inspector's default group, which lands in the Settings tab; WordPress surfaces typography for core blocks in the Styles tab, so the panel now registers there via the styles inspector group. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The bare typography.fontFamilies settings path resolves to the raw origins object in the editor (it is not an override-merged path), so the flat-array guard never passed and the panel rendered nowhere. Query the custom/theme/default origins separately, as core's own typography hook does, and hand the flat list to the controls; the test mock now mirrors the real per-origin contract. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The font controls ship no outer margin, so the two pickers sat flush against each other; stacked controls now get the standard 16px separation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Layout is a style setting, so its panel now registers in the styles inspector group ahead of Typography instead of the Settings tab. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The control's className lands on the select button inside the component, not on an outer wrapper, so the sibling spacing rule never matched; each picker now sits in its own wrapper div that the rule reliably targets. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The rail no longer grows past the player column: the entry list scrolls internally, and while more entries hide below the scroll position a bottom fade (white, or the dark surface color) signals them — driven by a scroll listener in the view script and its mirror in the editor preview, so the canvas behaves like the page. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Extends the scroll hint to the horizontal axis: the strip layout now shows an inline-end fade (sticky inside the scroller, RTL-aware) while entries hide past the scroll position, cleared on reaching the end — in the editor preview and on the front end alike. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The VideoPress player renders its own title overlay, so the stage no longer repeats the current video's title and meta line in the side-rail and grid layouts. The stage row now only carries the grid layout's playlist runtime line (rendered only when a runtime is shown), and the view script and editor preview shed the code that kept the duplicate in sync. With no now-playing title element left anywhere, its font picker and attribute are removed too. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The preview no longer appends the explanatory footnote under the block; its styles and test assertion go with it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The one-liner said nothing about what powers the block or what can be customized; the description now covers the VideoPress source, the layout and surface choices, the per-entry display options, and the always-in-sync titles and thumbnails. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Autoplay next moves out of the Layout panel into a new Playback panel in the Settings tab, joined by Mute by default (playback starts muted via the embed URLs) and Loop playlist (the view script restarts from the first entry when the last one ends). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The rendered wrapper forces the autoplay-next flag on whenever looping is enabled, and the editor shows the Autoplay toggle as checked and locked while Loop playlist is on, so an ended final video always restarts the list. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Publishing a post or page containing the block records a jetpack_videopress_playlist_block_published Tracks event with the post type, layout, video count and playlist count. The first playlist block in the post is the designated reporter, so multi-playlist posts record exactly one event per publish. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fixes #17402
Fixes VIDP-370
Proposed changes
Adds a new dynamic block, Video Playlist (
videopress/playlist), to the videopress package (shipping through both the Jetpack and standalone VideoPress plugins): a VideoPress-powered list of videos in a single customizable player, built from your VideoPress library or video links.Features included
Editor
theme.jsonpresets (hidden on themes without font presets).Front end
videopress_endedmessage advances to the next entry, loops back to the first when looping is on, and "Mute by default" rides on every embed URL.guid,durationMs,height). Titles and posters are never stored — the editor caches them per session from the videos API and the view script hydrates each entry (and falls back to "Video N" for e.g. private videos), so editor and page always reflect the videos' current metadata. The player renders its own title overlay, so no duplicate now-playing text is rendered.--wp--preset--font-family--*variable, identically in the editor and the render.Covered by 62 Jest tests (editor flows, view-script playback/hydration/scroll behavior, formatting utilities, block registration) and 14 PHPUnit tests (registration, rendering, sanitization, escaping, playback flags).
Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
theme.jsonfonts required). In Settings → Playback, try Autoplay next, Mute by default, and Loop playlist (note it locks Autoplay on). In "Show on each entry", flip each display toggle.🤖 Generated with Claude Code