feat(packages): add poster component to video skins#994
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for vjs10-site ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
CI Failure Diagnosis
|
📦 Bundle Size Report🎨 @videojs/html
Presets (7)
Media (5)
Players (3)
Skins (16)
UI Components (21)
Sizes are marginal over the root entry point. ⚛️ @videojs/react(no changes) Presets (7)
Media (4)
Skins (14)
UI Components (18)
Sizes are marginal over the root entry point. 🧩 @videojs/core(no changes) Entries (6)
🏷️ @videojs/element(no changes) Entries (2)
📦 @videojs/store(no changes) Entries (3)
🔧 @videojs/utils(no changes) Entries (10)
📦 @videojs/spf(no changes) Entries (3)
ℹ️ How to interpretAll sizes are standalone totals (minified + brotli).
Run |
There was a problem hiding this comment.
Pull request overview
This PR introduces a dedicated <media-poster> component and promotes “poster” to a first-class input across HTML and React video skin presets, replacing the previous “style an inline <img>” approach. It also refactors the sandbox to use centralized poster/storyboard URL helpers and simplifies setup/reset + Vite shell serving.
Changes:
- Add
<media-poster>+ slot wiring to HTML skin templates (CSS + Tailwind), and extract poster styling into dedicated skin component files. - Add
postersupport to React video skin presets (CSS + Tailwind variants) via a sharedBaseVideoSkinPropstype and anisRenderProphelper. - Sandbox refactor: centralize Mux-derived poster/storyboard URL generation, update templates, and improve setup/reset scripts + app shell serving.
Reviewed changes
Copilot reviewed 42 out of 42 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/skins/src/minimal/tailwind/video.tailwind.ts | Removes inline img poster styling; exports new poster + playback-rate components. |
| packages/skins/src/minimal/tailwind/components/poster.ts | Adds Tailwind poster class generator for minimal skin. |
| packages/skins/src/minimal/tailwind/components/playback-rate.ts | Adds minimal Tailwind playback-rate button styling config. |
| packages/skins/src/minimal/css/video.css | Imports new poster CSS component. |
| packages/skins/src/minimal/css/components/poster.css | Adds minimal skin poster CSS component. |
| packages/skins/src/default/tailwind/video.tailwind.ts | Removes inline img poster styling; exports new poster component. |
| packages/skins/src/default/tailwind/components/poster.ts | Adds Tailwind poster class generator for default skin. |
| packages/skins/src/default/css/video.css | Imports new poster CSS component. |
| packages/skins/src/default/css/components/poster.css | Adds default skin poster CSS component. |
| packages/skins/src/default/css/components/media.css | Removes legacy default skin > img poster styling block (migrated to poster.css). |
| packages/sandbox/vite.config.ts | Simplifies app shell serving and changes build input to app/index.html. |
| packages/sandbox/templates/react-video/main.tsx | Switches from Mux-specific components to poster prop + generic Storyboard. |
| packages/sandbox/templates/react-simple-hls-video/main.tsx | Same as above for simple HLS React template. |
| packages/sandbox/templates/react-hls-video/main.tsx | Same as above for HLS React template. |
| packages/sandbox/templates/html-video/main.ts | Adds storyboard rendering + poster slot image for HTML template. |
| packages/sandbox/templates/html-simple-hls-video/main.ts | Adds storyboard rendering + poster slot image for HTML template. |
| packages/sandbox/templates/html-hls-video/main.ts | Adds storyboard rendering + poster slot image for HTML template. |
| packages/sandbox/templates/html-dash-video/main.ts | Adds storyboard rendering + poster slot image for HTML DASH template. |
| packages/sandbox/scripts/shared.ts | Adds utilities to mirror templates to src and remove generated src files; filters generated files from diffs. |
| packages/sandbox/scripts/setup.ts | Refactors setup to use shared mirror/remove utilities. |
| packages/sandbox/scripts/reset.ts | Enhances reset behavior (restores missing files, removes generated), and tweaks diff printing. |
| packages/sandbox/app/shared/sources.ts | Adds getPosterSrc / getStoryboardSrc derived from Mux asset id. |
| packages/sandbox/app/shared/react/use-storyboard.ts | New hook for storyboard URL derived from current source. |
| packages/sandbox/app/shared/react/use-poster.ts | New hook for poster URL derived from current source. |
| packages/sandbox/app/shared/react/storyboard.tsx | New generic Storyboard <track> component. |
| packages/sandbox/app/shared/react/mux-storyboard.tsx | Removes Mux-specific storyboard React component. |
| packages/sandbox/app/shared/react/mux-poster.tsx | Removes Mux-specific poster React component. |
| packages/sandbox/app/shared/mux.ts | Removes Mux poster helper; keeps Mux asset id helper. |
| packages/sandbox/app/shared/html/storyboard.ts | Adds generic HTML storyboard renderer helper. |
| packages/sandbox/app/shared/html/sandbox-state.ts | Adds poster/storyboard fields to HTML sandbox state. |
| packages/sandbox/app/shared/html/mux-storyboard.ts | Removes Mux-specific HTML storyboard renderer. |
| packages/react/src/utils/use-render.tsx | Adds isRenderProp helper for render-prop detection. |
| packages/react/src/presets/video/skin.tsx | Adds poster prop handling to default React CSS skin preset. |
| packages/react/src/presets/video/skin.tailwind.tsx | Adds poster prop handling + Tailwind poster classes to default preset. |
| packages/react/src/presets/video/minimal-skin.tsx | Adds poster prop handling to minimal React CSS skin preset. |
| packages/react/src/presets/video/minimal-skin.tailwind.tsx | Adds poster prop handling + Tailwind poster classes to minimal preset. |
| packages/react/src/presets/types.ts | Introduces BaseVideoSkinProps with poster typing. |
| packages/html/src/define/video/skin.ts | Adds <media-poster> + poster slot to default HTML skin template. |
| packages/html/src/define/video/skin.tailwind.ts | Adds <media-poster> + Tailwind poster classes to default HTML skin template. |
| packages/html/src/define/video/minimal-skin.ts | Adds <media-poster> + poster slot to minimal HTML skin template. |
| packages/html/src/define/video/minimal-skin.tailwind.ts | Adds <media-poster> + Tailwind poster classes to minimal HTML skin template. |
| packages/html/src/define/base.css | Removes object-fit/position defaults from base video styling (delegated to skins). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Move poster styling from inline img rules into a dedicated media-poster component with its own CSS and Tailwind files for both default and minimal skins. Integrate poster prop into React video skin presets and HTML skin templates. Refactor sandbox to use centralized poster/storyboard helpers.
Summary
Add a dedicated
<media-poster>component with proper CSS and Tailwind styling for both default and minimal video skins, replacing the previous inlineimgselector approach. Poster is now a first-class prop on React video skin presets.Closes #992
Changes
<media-poster>element with<slot name="poster">to all HTML video skin templates (CSS and Tailwind variants)posterprop to React video skin presets (VideoSkin,MinimalVideoSkin, and their Tailwind variants)isRenderProputility andBaseVideoSkinPropstype for poster prop handlinggetPosterSrc/getStoryboardSrchelpers instead of Mux-specific componentsmirrorTemplatesToSrcandremoveGeneratedSrcFilesutilitiesTesting
pnpm devand verify poster images display correctly in all sandbox templates