Skip to content

docs: update site for context-based media discovery#1018

Merged
decepulis merged 3 commits intomainfrom
docs/update-media-discovery-slot-removal
Mar 19, 2026
Merged

docs: update site for context-based media discovery#1018
decepulis merged 3 commits intomainfrom
docs/update-media-discovery-slot-removal

Conversation

@mihar-22
Copy link
Copy Markdown
Member

@mihar-22 mihar-22 commented Mar 19, 2026

Summary

Updates all docs, demos, and site components to reflect context-based media discovery from #997.

slot="media" removal (22 demo HTML files, 2 site components, 1 blog post)

All <video slot="media"><video> across demos, HTMLUsageCodeBlock.tsx, baseCode.ts, and the v10 beta blog post.

Prose rewrites

  • concepts/overview.mdx — Media section rewritten: elements discovered via context + querySelector fallback
  • reference/container-mixin.mdx — Full rewrite: registers via containerContext, provider owns discovery
  • reference/provider-mixin.mdx — Full rewrite: documents store.attach() ownership, three context values published, querySelector fallback
  • reference/player-container.mdx — Media attachment section rewritten for both React and HTML
  • reference/player-provider.mdx — Remove all slot="media" from examples

New reference pages

  • reference/media-attach-mixin.mdx — Documents MediaAttachMixin, createMediaAttachMixin, getMediaTarget() override
  • reference/use-container-attach.mdx — Documents useContainerAttach hook

Sidebar

Added media-attach-mixin (HTML Advanced) and use-container-attach (React Advanced)

Package cleanup split to #1026.

Closes #1017

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 19, 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 19, 2026 4:34pm

Request Review

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 19, 2026

Deploy Preview for vjs10-site ready!

Name Link
🔨 Latest commit b7f7665
🔍 Latest deploy log https://app.netlify.com/projects/vjs10-site/deploys/69bc255407f5060008d10661
😎 Deploy Preview https://deploy-preview-1018--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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 19, 2026

📦 Bundle Size Report

🎨 @videojs/html — no changes
Presets (7)
Entry Size
/video (default) 23.19 kB
/video (default + hls) 153.71 kB
/video (minimal) 23.06 kB
/video (minimal + hls) 153.59 kB
/audio (default) 21.48 kB
/audio (minimal) 21.43 kB
/background 6.38 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.33 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.12 kB
/video/skin.css css 3.15 kB
/video/minimal-skin js 22.25 kB
/video/minimal-skin.tailwind js 22.49 kB
/video/skin js 22.42 kB
/video/skin.tailwind js 22.73 kB
/audio/minimal-skin.css css 2.28 kB
/audio/skin.css css 2.30 kB
/audio/minimal-skin js 20.66 kB
/audio/minimal-skin.tailwind js 20.69 kB
/audio/skin js 20.66 kB
/audio/skin.tailwind js 20.93 kB
/background/skin.css css 117 B
/background/skin js 1003 B
/base.css css 157 B
/shared.css css 86 B
UI Components (21)
Entry Size
/ui/alert-dialog 2.08 kB
/ui/alert-dialog-close 1.63 kB
/ui/alert-dialog-description 1.52 kB
/ui/alert-dialog-title 1.55 kB
/ui/buffering-indicator 1.78 kB
/ui/captions-button 1.79 kB
/ui/controls 1.59 kB
/ui/fullscreen-button 1.81 kB
/ui/mute-button 1.78 kB
/ui/pip-button 1.80 kB
/ui/play-button 1.82 kB
/ui/playback-rate-button 1.81 kB
/ui/popover 3.27 kB
/ui/poster 1.75 kB
/ui/seek-button 1.80 kB
/ui/slider 2.02 kB
/ui/thumbnail 2.12 kB
/ui/time 1.68 kB
/ui/time-slider 2.12 kB
/ui/tooltip 2.40 kB
/ui/volume-slider 2.26 kB

Sizes are marginal over the root entry point.

⚛️ @videojs/react — no changes
Presets (7)
Entry Size
/video (default) 19.00 kB
/video (default + hls) 149.82 kB
/video (minimal) 19.03 kB
/video (minimal + hls) 149.71 kB
/audio (default) 14.93 kB
/audio (minimal) 15.05 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.34 kB
Skins (14)
Entry Type Size
/video/minimal-skin.css css 3.12 kB
/video/skin.css css 3.15 kB
/video/minimal-skin js 18.93 kB
/video/minimal-skin.tailwind js 22.13 kB
/video/skin js 18.95 kB
/video/skin.tailwind js 22.14 kB
/audio/minimal-skin.css css 2.28 kB
/audio/skin.css css 2.30 kB
/audio/minimal-skin js 14.94 kB
/audio/minimal-skin.tailwind js 17.02 kB
/audio/skin js 14.88 kB
/audio/skin.tailwind js 17.25 kB
/background/skin.css css 90 B
/background/skin js 272 B
UI Components (18)
Entry Size
/ui/alert-dialog 2.24 kB
/ui/buffering-indicator 2.21 kB
/ui/captions-button 2.25 kB
/ui/controls 2.24 kB
/ui/fullscreen-button 2.27 kB
/ui/mute-button 2.26 kB
/ui/pip-button 2.27 kB
/ui/play-button 2.24 kB
/ui/playback-rate-button 2.27 kB
/ui/popover 2.87 kB
/ui/poster 2.08 kB
/ui/seek-button 2.27 kB
/ui/slider 3.17 kB
/ui/thumbnail 2.01 kB
/ui/time 1.93 kB
/ui/time-slider 2.65 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.85 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.04 kB
/playback-engine 9.94 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.

Remove slot="media" from all docs, demos, blog post, and site
components. Rewrite prose for context-based media discovery pattern.
Add MediaAttachMixin and useContainerAttach reference pages.

Closes #1017

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mihar-22 mihar-22 force-pushed the docs/update-media-discovery-slot-removal branch from cb9a2b9 to 46c8ce0 Compare March 19, 2026 09:02
@mihar-22 mihar-22 requested a review from decepulis March 19, 2026 09:12
@mihar-22 mihar-22 marked this pull request as ready for review March 19, 2026 09:12
Copilot AI review requested due to automatic review settings March 19, 2026 09:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the documentation site, demos, and key site code snippets to reflect the v10 “context-based media discovery” behavior (removing the need for slot="media" and documenting provider-owned attach/discovery).

Changes:

  • Removed slot="media" from HTML examples across docs pages, demos, installation snippet generator, and the v10 beta blog post.
  • Rewrote provider/container documentation to reflect provider-owned store.attach() and context-based registration with a querySelector fallback.
  • Added new reference pages for MediaAttachMixin (HTML) and useContainerAttach (React), and linked them in the sidebar.

Reviewed changes

Copilot reviewed 37 out of 37 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
site/src/docs.config.ts Adds new reference pages to the docs sidebar navigation.
site/src/content/docs/reference/use-container-attach.mdx New React reference page documenting useContainerAttach.
site/src/content/docs/reference/thumbnail.mdx Removes slot="media" from the thumbnail HTML example.
site/src/content/docs/reference/provider-mixin.mdx Rewrites ProviderMixin docs to describe provider-owned attach and discovery behavior.
site/src/content/docs/reference/player-provider.mdx Removes slot="media" from provider usage examples.
site/src/content/docs/reference/player-container.mdx Updates container docs to reflect provider-owned media discovery/attach and removes slot="media" examples.
site/src/content/docs/reference/media-attach-mixin.mdx New HTML reference page documenting MediaAttachMixin and customization via getMediaTarget() / createMediaAttachMixin.
site/src/content/docs/reference/container-mixin.mdx Rewrites ContainerMixin docs to reflect container registration (not media discovery).
site/src/content/docs/concepts/skins.mdx Removes slot="media" from skins concept example.
site/src/content/docs/concepts/presets.mdx Removes slot="media" from preset examples.
site/src/content/docs/concepts/overview.mdx Updates overview examples and prose to describe context-based discovery + fallback.
site/src/content/docs/concepts/features.mdx Removes slot="media" from features example.
site/src/content/blog/2026-03-10-videojs-v10-beta-hello-world-again.mdx Removes slot="media" from blog post examples.
site/src/components/installation/HTMLUsageCodeBlock.tsx Updates installation page HTML snippet generator to omit slot="media".
site/src/components/home/Demo/baseCode.ts Updates homepage demo HTML string to omit slot="media".
site/src/components/docs/demos/volume-slider/html/css/WithParts.html Removes slot="media" from demo markup.
site/src/components/docs/demos/time/html/css/Remaining.html Removes slot="media" from demo markup.
site/src/components/docs/demos/time/html/css/CustomSeparator.html Removes slot="media" from demo markup.
site/src/components/docs/demos/time/html/css/CustomNegativeSign.html Removes slot="media" from demo markup.
site/src/components/docs/demos/time/html/css/CurrentTime.html Removes slot="media" from demo markup.
site/src/components/docs/demos/time/html/css/CurrentDuration.html Removes slot="media" from demo markup.
site/src/components/docs/demos/time-slider/html/css/WithParts.html Removes slot="media" from demo markup.
site/src/components/docs/demos/thumbnail/html/css/BasicUsage.html Removes slot="media" from demo markup.
site/src/components/docs/demos/seek-button/html/css/BasicUsage.html Removes slot="media" from demo markup.
site/src/components/docs/demos/poster/html/css/BasicUsage.html Removes slot="media" from demo markup.
site/src/components/docs/demos/popover/html/css/BasicUsage.html Removes slot="media" from demo markup.
site/src/components/docs/demos/player-controller/html/css/BasicUsage.html Removes slot="media" from demo markup.
site/src/components/docs/demos/playback-rate-button/html/css/BasicUsage.html Removes slot="media" from demo markup.
site/src/components/docs/demos/play-button/html/css/BasicUsage.html Removes slot="media" from demo markup.
site/src/components/docs/demos/pip-button/html/css/BasicUsage.html Removes slot="media" from demo markup.
site/src/components/docs/demos/mute-button/html/css/VolumeLevels.html Removes slot="media" from demo markup.
site/src/components/docs/demos/mute-button/html/css/BasicUsage.html Removes slot="media" from demo markup.
site/src/components/docs/demos/html-create-player/html/css/BasicUsage.html Removes slot="media" from demo markup.
site/src/components/docs/demos/fullscreen-button/html/css/BasicUsage.html Removes slot="media" from demo markup.
site/src/components/docs/demos/controls/html/css/BasicUsage.html Removes slot="media" from demo markup.
site/src/components/docs/demos/captions-button/html/css/BasicUsage.html Removes slot="media" from demo markup.
site/src/components/docs/demos/buffering-indicator/html/css/BasicUsage.html Removes slot="media" from demo markup.

💡 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.

Comment on lines +13 to +21
The store is created lazily on first access. On `connectedCallback`, the mixin publishes three context values to its descendants:

Any <DocsLink slug="reference/player-controller">`PlayerController`</DocsLink> or <DocsLink slug="reference/container-mixin">`ContainerMixin`</DocsLink> element below the provider in the DOM tree receives the store automatically through context.
- **`playerContext`** — the store, consumed by <DocsLink slug="reference/player-controller">`PlayerController`</DocsLink> and other controllers
- **`mediaContext`** — a setter callback for media elements to register themselves
- **`containerContext`** — a setter callback for container elements to register themselves

When a media element and a container both register, the provider calls `store.attach({ media, container })`. If no media element registers via context within a microtask, the provider falls back to `querySelector('video, audio')` to support plain `<video>` and `<audio>` elements.

On `disconnectedCallback`, the mixin calls `store.destroy()` and cleans up all context subscriptions.
import DocsLink from "@/components/docs/DocsLink.astro";

`ContainerMixin` creates a class that consumes the player store from context and automatically attaches `<video>` or `<audio>` elements found within it. It uses a `MutationObserver` to watch for media element changes and calls `store.attach()` to keep the store's media target in sync.
`ContainerMixin` creates a class that consumes the player store from context and registers itself as the media container with the <DocsLink slug="reference/provider-mixin">provider</DocsLink>. The provider uses this reference to determine the fullscreen target and to scope media discovery.
Comment thread site/src/content/docs/reference/use-container-attach.mdx
Copy link
Copy Markdown
Collaborator

@decepulis decepulis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of comments. I'll take a pass at some of these and then merge in! Mostly cross-linking and clarifying.


<FrameworkCase frameworks={["html"]}>
Media elements are detected via a `slot="media"` attribute. Always include it on your `<video>`, `<audio>`, or custom media element.
Media elements are discovered automatically — plain `<video>` and `<audio>` elements are found via a `querySelector` fallback, while custom media elements like `<hls-video>` register themselves via context. No `slot="media"` attribute is needed.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless someone has a lot of experience with previous players, the detail of "no slot="media" attribute is needed" could be noise. Especially considering that users of those libraries can infer that from the previous sentences. I'm voting to remove it.

Suggested change
Media elements are discovered automatically — plain `<video>` and `<audio>` elements are found via a `querySelector` fallback, while custom media elements like `<hls-video>` register themselves via context. No `slot="media"` attribute is needed.
Media elements are discovered automatically — plain `<video>` and `<audio>` elements are found via a `querySelector` fallback, while custom media elements like `<hls-video>` register themselves.


`MediaAttachMixin` creates a class that registers itself with the player provider via `mediaContext`. Apply it to custom media elements so they're automatically wired to the store when they connect to the DOM.

The built-in `<hls-video>`, `<dash-video>`, `<simple-hls-video>`, and `<background-video>` elements all use this mixin internally.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggesting this change so that this guide is less likely to go stale over time

Suggested change
The built-in `<hls-video>`, `<dash-video>`, `<simple-hls-video>`, and `<background-video>` elements all use this mixin internally.
Built-in elements, like `<hls-video>`, `<dash-video>`, `<simple-hls-video>`, and `<background-video>`, all use this mixin internally.

import UtilReference from "@/components/docs/api-reference/UtilReference.astro";
import DocsLink from "@/components/docs/DocsLink.astro";

`MediaAttachMixin` creates a class that registers itself with the player provider via `mediaContext`. Apply it to custom media elements so they're automatically wired to the store when they connect to the DOM.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking for now, but I'd like us to define internal jargon like mediaContext somehow. Either inline or by linking to another reference that defines it better.


## Who needs this

You only need `MediaAttachMixin` when building a custom media element — one that wraps a third-party player, uses a canvas renderer, or extends a base class that isn't already a registered media element.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one that wraps a third-party player, uses a canvas renderer, or extends a base class that isn't already a registered media element

The specificity of this sentence confuses me. It feels like the first two are similar examples and the third is like... something a bit different, and that this isn't a comprehensive set. I might take a pass at refining it idk.

decepulis and others added 2 commits March 19, 2026 09:01
- Fix provider-mixin: store is created eagerly (not lazily),
  disconnectedCallback detaches (not destroys), destroy is in
  destroyCallback
- Fix container-mixin: remove false claim that container scopes media
  discovery
- Fix use-container-attach: clarify undefined ref behavior, remove
  contradictory guidance
- Improve media-attach-mixin: link provider, rewrite jargon-heavy
  sentences, make element list non-exhaustive
- Link "microtask" to MDN
- Add TODOs for context protocol (#1033) and ReactiveElement lifecycle
  (#1034) concept pages

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@decepulis decepulis merged commit b4746f7 into main Mar 19, 2026
21 checks passed
@decepulis decepulis deleted the docs/update-media-discovery-slot-removal branch March 19, 2026 17:21
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.

docs: update site for context-based media discovery and provider attach refactor

3 participants