Skip to content

fix(spf): implement preload IDL attribute on SpfMedia#1069

Merged
cjpillsbury merged 1 commit intomainfrom
fix/spf-preload
Mar 23, 2026
Merged

fix(spf): implement preload IDL attribute on SpfMedia#1069
cjpillsbury merged 1 commit intomainfrom
fix/spf-preload

Conversation

@cjpillsbury
Copy link
Copy Markdown
Collaborator

@cjpillsbury cjpillsbury commented Mar 20, 2026

Summary

SpfMedia lacked a preload getter/setter, so setting preload on a SimpleHlsVideo element had no effect and was silently dropped. This adds the full IDL attribute implementation — explicit values persist across src reassignments and take priority over element-inferred preload in syncPreloadAttribute.

Changes

  • Add preload getter/setter to SpfMedia that stores the explicit value and patches engine state immediately; the value is re-applied before owners.patch on every new engine (i.e., each src change) so it survives engine recreation
  • Guard syncPreloadAttribute to skip element inference when an explicit preload is already set in state, preventing the media element from overriding a user-set value
  • Handle preload attribute changes in SimpleHlsVideo.attributeChangedCallback (html + react packages), forwarding the attribute to the underlying SpfMedia instance
  • Remove stale TODO comment in the react SimpleHlsVideo that called out the missing preload support
  • Update and add tests to cover all new behaviors

Testing

pnpm -F @videojs/spf test src/dom/playback-engine
pnpm -F @videojs/spf test src/core/features

fixes #1056

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 20, 2026

Deploy Preview for vjs10-site ready!

Name Link
🔨 Latest commit cda7dd2
🔍 Latest deploy log https://app.netlify.com/projects/vjs10-site/deploys/69c14d834f770a00085b745e
😎 Deploy Preview https://deploy-preview-1069--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 Mar 20, 2026

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

Project Deployment Actions Updated (UTC)
v10-sandbox Ready Ready Preview, Comment Mar 23, 2026 2:26pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 20, 2026

📦 Bundle Size Report

🎨 @videojs/html — no changes
Presets (7)
Entry Size
/video (default) 23.37 kB
/video (default + hls) 153.84 kB
/video (minimal) 23.21 kB
/video (minimal + hls) 153.65 kB
/audio (default) 21.51 kB
/audio (minimal) 21.52 kB
/background 6.51 kB
Media (5)
Entry Size
/media/background-video 1.03 kB
/media/container 1.59 kB
/media/dash-video 236.04 kB
/media/hls-video 131.57 kB
/media/simple-hls-video 12.42 kB
Players (3)
Entry Size
/video/player 6.24 kB
/audio/player 6.23 kB
/background/player 6.22 kB
Skins (16)
Entry Type Size
/video/minimal-skin.css css 3.25 kB
/video/skin.css css 3.31 kB
/video/minimal-skin js 22.40 kB
/video/minimal-skin.tailwind js 22.82 kB
/video/skin js 22.57 kB
/video/skin.tailwind js 22.81 kB
/audio/minimal-skin.css css 2.37 kB
/audio/skin.css css 2.36 kB
/audio/minimal-skin js 20.77 kB
/audio/minimal-skin.tailwind js 21.10 kB
/audio/skin js 20.73 kB
/audio/skin.tailwind js 21.02 kB
/background/skin.css css 117 B
/background/skin js 1.13 kB
/base.css css 157 B
/shared.css css 86 B
UI Components (21)
Entry Size
/ui/alert-dialog 2.16 kB
/ui/alert-dialog-close 1.60 kB
/ui/alert-dialog-description 1.52 kB
/ui/alert-dialog-title 1.50 kB
/ui/buffering-indicator 1.79 kB
/ui/captions-button 1.83 kB
/ui/controls 1.60 kB
/ui/fullscreen-button 1.82 kB
/ui/mute-button 1.81 kB
/ui/pip-button 1.81 kB
/ui/play-button 1.81 kB
/ui/playback-rate-button 1.83 kB
/ui/popover 3.29 kB
/ui/poster 1.70 kB
/ui/seek-button 1.80 kB
/ui/slider 2.00 kB
/ui/thumbnail 2.14 kB
/ui/time 1.62 kB
/ui/time-slider 2.12 kB
/ui/tooltip 2.42 kB
/ui/volume-slider 2.20 kB

Sizes are marginal over the root entry point.

⚛️ @videojs/react — no changes
Presets (7)
Entry Size
/video (default) 18.95 kB
/video (default + hls) 149.81 kB
/video (minimal) 18.98 kB
/video (minimal + hls) 149.77 kB
/audio (default) 15.80 kB
/audio (minimal) 15.85 kB
/background 3.13 kB
Media (4)
Entry Size
/media/background-video 476 B
/media/dash-video 236.19 kB
/media/hls-video 131.59 kB
/media/simple-hls-video 12.36 kB
Skins (14)
Entry Type Size
/video/minimal-skin.css css 3.25 kB
/video/skin.css css 3.31 kB
/video/minimal-skin js 18.91 kB
/video/minimal-skin.tailwind js 22.16 kB
/video/skin js 18.89 kB
/video/skin.tailwind js 22.13 kB
/audio/minimal-skin.css css 2.37 kB
/audio/skin.css css 2.36 kB
/audio/minimal-skin js 15.78 kB
/audio/minimal-skin.tailwind js 18.21 kB
/audio/skin js 15.75 kB
/audio/skin.tailwind js 18.12 kB
/background/skin.css css 90 B
/background/skin js 272 B
UI Components (18)
Entry Size
/ui/alert-dialog 2.21 kB
/ui/buffering-indicator 2.20 kB
/ui/captions-button 2.25 kB
/ui/controls 2.23 kB
/ui/fullscreen-button 2.25 kB
/ui/mute-button 2.26 kB
/ui/pip-button 2.22 kB
/ui/play-button 2.25 kB
/ui/playback-rate-button 2.25 kB
/ui/popover 2.85 kB
/ui/poster 2.05 kB
/ui/seek-button 2.30 kB
/ui/slider 3.16 kB
/ui/thumbnail 2.01 kB
/ui/time 1.92 kB
/ui/time-slider 2.66 kB
/ui/tooltip 2.69 kB
/ui/volume-slider 2.68 kB

Sizes are marginal over the root entry point.

🧩 @videojs/core — no changes
Entries (6)
Entry Size
. 4.81 kB
/dom 8.41 kB
/dom/media/custom-media-element 1.81 kB
/dom/media/dash 235.62 kB
/dom/media/hls 131.27 kB
/dom/media/simple-hls 11.89 kB
🏷️ @videojs/element — no changes
Entries (2)
Entry Size
. 999 B
/context 943 B
📦 @videojs/store — no changes
Entries (3)
Entry Size
. 1.32 kB
/html 700 B
/react 360 B
🔧 @videojs/utils — no changes
Entries (10)
Entry Size
/array 104 B
/dom 1.25 kB
/events 227 B
/function 261 B
/object 119 B
/predicate 265 B
/string 148 B
/style 190 B
/time 478 B
/number 158 B
📦 @videojs/spf — no changes
Entries (3)
Entry Size
. 40 B
/dom 10.12 kB
/playback-engine 9.99 kB

ℹ️ How to interpret

All sizes are standalone totals (minified + brotli).

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

Run pnpm size locally to check current sizes.

Add a `preload` getter/setter to `SpfMedia` that persists the explicit value
across `src` reassignments and takes priority over element-inferred preload in
`syncPreloadAttribute`. Also propagates the preload attribute change through
`SimpleHlsVideo.attributeChangedCallback` in the html and react packages.
@cjpillsbury cjpillsbury merged commit 04f81a2 into main Mar 23, 2026
20 checks passed
@cjpillsbury cjpillsbury deleted the fix/spf-preload branch March 23, 2026 14:30
@luwes luwes mentioned this pull request Mar 23, 2026
This was referenced Apr 11, 2026
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.

Bug: preload behaviors not working as expected for SPF-backed Media Renderer

1 participant