docs(design): draft composable media features design#1447
Open
docs(design): draft composable media features design#1447
Conversation
Lay out options for making media features composable the same way store features are (defineSlice / feature arrays). Captures nine approaches from a `defineMediaFeature` primitive to global side-effect imports, with worked examples for the live feature on HlsMedia, the `<hls-video>` custom element, and the `<HlsVideo />` React component, plus a comparison table and a recommended rollout. Made-with: Cursor
|
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. |
Contributor
📦 Bundle Size Report🎨 @videojs/html — no changesPresets (7)
Media (8)
Players (5)
Skins (30)
UI Components (33)
Sizes are marginal over the root entry point. ⚛️ @videojs/react — no changesPresets (7)
Media (7)
Skins (27)
UI Components (26)
Sizes are marginal over the root entry point. 🧩 @videojs/core — no changesEntries (9)
🏷️ @videojs/element — no changesEntries (2)
📦 @videojs/store — no changesEntries (3)
🔧 @videojs/utils — no changesEntries (10)
📦 @videojs/spf — no changesEntries (3)
ℹ️ How to interpretAll sizes are standalone totals (minified + brotli).
Run |
Made-with: Cursor
Made-with: Cursor
…nctions Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Design doc for bringing store-style composable features to the media
layer. Each media class binds an engine to a flat list of features —
mirroring
createPlayer({ features }). Multi-engine playback (hls.jswith native-HLS fallback) falls out of the same factory function
called with multiple variants, with no separate router primitive.
Changes
createVideo/createAudio— variadic factories. One variantyields a single-engine class; two or more yields a class that picks
at runtime based on
src/type/preferPlayback.createAudioextends
HTMLAudioElementHostand resolves themux/index.ts:20-21audio TODO.hlsJs(...)andnativeHls(...)take anoptions object (
config,debug,features) and return a variantdescriptor. The engine mixin closes over its config;
supports()is part of the descriptor.
(
hlsJs), engine-specific features (live,streamType,errors),and engine-agnostic features (
googleCast,muxDatare-exported fromgoogle-cast/,mux-data/) all live under@videojs/core/dom/media/hls. Same shape under…/native-hls.Tree-shake by import path.
#privatefields, precise types, zero runtime overhead. Only thecomposition surface changes.
mixin chains onto
createVideocalls. Open questions cover varianttype surface (intersection vs union),
MediaSupportContextshape,mixin ordering, and whether to add trailing-options sugar for
cross-cutting features.
Scope & status
status: draftunderinternal/design/— this lands therecommended shape after iterating through earlier options
(HTML/React child components,
defineMediaFeatureprimitive,delegateMixinsmap, separatecreateMediaRouter). Once theshape is stable, the public-API pieces graduate to an RFC.
packages/core/src/dom/store/features/presets.ts(the shape we'remirroring),
packages/core/src/dom/media/hls/hlsjs.ts(today'sstatic mixin chain),
packages/core/src/dom/media/hls/index.ts(today's hand-coded delegate selection), and
packages/core/src/dom/media/google-cast/index.ts(the heaviestengine-agnostic mixin).
Testing
Docs-only — no code paths touched.