Skip to content

feat(core): add thumbnail component and text track store feature#643

Merged
mihar-22 merged 3 commits intomainfrom
opencode/lucky-wolf
Feb 27, 2026
Merged

feat(core): add thumbnail component and text track store feature#643
mihar-22 merged 3 commits intomainfrom
opencode/lucky-wolf

Conversation

@mihar-22
Copy link
Copy Markdown
Member

@mihar-22 mihar-22 commented Feb 27, 2026

Ref: #501
Ref: #496

Summary

Thumbnail preview core logic and text track store feature. Platform components (HTML, React) follow in stacked PRs.

  • ThumbnailCore — runtime-agnostic class: binary search for active thumbnail by time, CSS constraint-based scaling (uniform scale factor from min/max-width/height), resize computation for sprite sheets via overflow: hidden + transform: translate().
  • createThumbnail factory (core/dom) — manages ResizeObserver, img load/error tracking, natural dimension caching, and CSS constraint reading. Lazy binding via connect() for frameworks with deferred element availability (React refs).
  • textTrackFeature + selectTextTrack — store feature that monitors TextTrackList for thumbnail/chapter tracks, producing cue arrays and the thumbnail track's base URL.
  • mapCuesToThumbnails — parses VTT cues with #xywh= media fragments into ThumbnailImage[].
  • findTrackElement (utils/dom) — finds the <track> element backing a TextTrack.

Sizing contract

Consumer controls size via CSS max-width/max-height on the container. ThumbnailCore.resize() reads constraints from getComputedStyle, computes a uniform scale factor, and returns container + image dimensions + sprite offsets. No constraints = native tile dimensions.

Testing

54 core tests + 7 text track feature tests, all passing.

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 27, 2026

Deploy Preview for vjs10-site ready!

Name Link
🔨 Latest commit f0eae6a
🔍 Latest deploy log https://app.netlify.com/projects/vjs10-site/deploys/69a2247fe52e1400088f5a03
😎 Deploy Preview https://deploy-preview-643--vjs10-site.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
vjs-10-demo-react Ignored Ignored Preview Feb 27, 2026 11:10pm

Request Review

@mihar-22 mihar-22 changed the title feat(packages): add thumbnail component with CSS constraint-based sizing feat(core): add thumbnail component Feb 27, 2026
@mihar-22 mihar-22 force-pushed the opencode/lucky-wolf branch from f8104f8 to e3cd923 Compare February 27, 2026 20:54
@mihar-22 mihar-22 changed the title feat(core): add thumbnail component feat(core): add thumbnail core and text track store feature Feb 27, 2026
Add ThumbnailCore with CSS constraint-based resize logic, text track
store feature for reactive thumbnail/chapter cue data, and supporting
utilities. Platform components (HTML/React) follow in separate PRs.
@mihar-22 mihar-22 force-pushed the opencode/lucky-wolf branch from f745af9 to 2666ebb Compare February 27, 2026 21:18
@mihar-22 mihar-22 changed the title feat(core): add thumbnail core and text track store feature feat(core): add thumbnail component and text track store feature Feb 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 27, 2026

📦 Bundle Size Report

Package Size Diff %
@videojs/core 8.21 kB +1.35 kB ████████ +19.6% 🔴
@videojs/element 1.60 kB 0 B ░░░░░░░░ 0%
@videojs/html 10.63 kB +939 B ████░░░░ +9.4% 🔺
@videojs/icons 3.79 kB 0 B ░░░░░░░░ 0%
@videojs/react 9.69 kB +928 B ████░░░░ +10.3% 🔴
@videojs/store 1.94 kB 0 B ░░░░░░░░ 0%
@videojs/utils 2.54 kB +35 B █░░░░░░░ +1.4% 🔺

Total: 38.41 kB · +3.20 kB · +9.1%


Entry Breakdown

Subpath sizes are the additional bytes on top of the root entry point, measured by bundling root + subpath together and subtracting the root-only size.

@videojs/core
Entry Base PR Diff %
. 3.21 kB 3.86 kB +659 B +20.0% 🔴
./dom 3.65 kB 4.36 kB +720 B +19.3% 🔴
total 6.87 kB 8.21 kB +1.35 kB +19.6%
@videojs/element
Entry Base PR Diff %
. 817 B 817 B 0 B 0%
./context 823 B 823 B 0 B 0%
total 1.60 kB 1.60 kB 0 B 0%
@videojs/icons
Entry Base PR Diff %
./react 2.27 kB 2.27 kB 0 B 0%
./html 1.52 kB 1.52 kB 0 B 0%
total 3.79 kB 3.79 kB 0 B 0%
@videojs/store
Entry Base PR Diff %
. 1.29 kB 1.29 kB 0 B 0%
./html 468 B 468 B 0 B 0%
./react 199 B 199 B 0 B 0%
total 1.94 kB 1.94 kB 0 B 0%
@videojs/utils
Entry Base PR Diff %
./array 104 B 104 B 0 B 0%
./dom 725 B 760 B +35 B +4.8% 🔺
./events 227 B 227 B 0 B 0%
./function 197 B 197 B 0 B 0%
./object 119 B 119 B 0 B 0%
./predicate 265 B 265 B 0 B 0%
./string 110 B 110 B 0 B 0%
./style 185 B 185 B 0 B 0%
./time 478 B 478 B 0 B 0%
./number 158 B 158 B 0 B 0%
total 2.51 kB 2.54 kB +35 B +1.4%

ℹ️ How to interpret

Sizes are minified + brotli, measured with esbuild.
Package totals are computed as root size + marginal subpath costs.
Subpath marginal cost = (root + subpath bundled together) − root alone.

Icon Meaning
No change
🔺 Increased ≤ 10%
🔴 Increased > 10%
🔽 Decreased
🆕 New (no baseline)

Run pnpm size locally to check current sizes.

@mihar-22 mihar-22 force-pushed the opencode/lucky-wolf branch 4 times, most recently from 41d0881 to c94a108 Compare February 27, 2026 23:07
@mihar-22 mihar-22 force-pushed the opencode/lucky-wolf branch from c94a108 to f0eae6a Compare February 27, 2026 23:10
@mihar-22 mihar-22 merged commit 7bae887 into main Feb 27, 2026
12 checks passed
@mihar-22 mihar-22 deleted the opencode/lucky-wolf branch February 27, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant