Skip to content

feat(lab): add VideoPlayer and AudioPlayer media players - #9832

Merged
ernestt merged 27 commits into
mainfrom
lab-media-player
Nov 19, 2026
Merged

ernestt merged 27 commits into
mainfrom
lab-media-player

Conversation

@ernestt

@ernestt ernestt commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

User need

Products that play video or audio either use the browser's built-in controls, which can't be themed and look different in every browser, or build a player from scratch. Astryx has no player today: Lightbox shows video with the browser's own controls. Builders need video and audio controls that follow their theme, work with a mouse, touch, keyboard, and screen reader, and add no dependency.

This is a Lab prototype: it is meant to be reviewed, tried, and reshaped before anything graduates.

Problem and solution fit

  • The native <video> / <audio> element keeps playing the media with its controls off, and Astryx controls drive it. Decoding, buffering, caption rendering, picture-in-picture, and platform integration stay with the browser, and the family adds no runtime dependency.
  • VideoPlayer and AudioPlayer cover the common layouts. MediaPlayer, its parts, and the hooks cover custom layouts.

Current specification

This PR adds docs/specs/components/MediaPlayer/MediaPlayer.spec.md (component:MediaPlayer, draft). It records the product decisions already made (DEC-1 to DEC-16, DD1, DD2) and leaves the questions below open for the spec owners. No current record admits the API yet.

Public delta and caller burden

New @astryxdesign/lab exports; no existing export changes:

  • Presets: VideoPlayer, AudioPlayer
  • Root and media part: MediaPlayer, MediaPlayerElement (a <video> or an <audio>, by kind)
  • Control parts: MediaPlayButton, MediaSeekButton, MediaVolume (Mute with the volume slider it reveals, or Mute alone), MediaTimeSlider, MediaTime, MediaCaptionsButton, MediaFullscreenButton, MediaPlaybackRate (a speed button with a slider, or a speed menu)
  • 12 components and 2 hooks in all
  • Hooks: useMediaPlayer (state and actions), useMediaPlaybackTime (a playback position that advances every animation frame)
  • Types: MediaPlayerState, MediaPlayerActions, MediaPlayerError, MediaTextTrackInfo, MediaTimelineChapter, MediaTimelineMarker, MediaSliderPlacement, and a props type for every part
  • No new strings: the @astryx.mediaPlayer.* strings the family uses are already on main in packages/core/locales/en.json
  • No theme package changes: Lab draws the media glyphs from bundled Lucide drawings, and a theme can restyle each by its media:* icon-registry key. The CLI's official package list is regenerated
  • On the docsite, the family sits in one Media Player sidebar group; the overview shows VideoPlayer, AudioPlayer, and MediaPlayer, and the media part and controls keep their own pages
  • The docsite preview registry skips hook entries, because a hook renders nothing to preview; useMediaPlayer and useMediaPlaybackTime are the first Lab hooks in the docs
<VideoPlayer
  src="/media/tour.mp4"
  poster="/media/tour.jpg"
  label="Product tour"
  captions={[{src: '/media/tour.en.vtt', label: 'English', language: 'en', isDefault: true}]}
  chapters={[{start: 0, title: 'Intro'}, {start: 42, title: 'Setup'}]}
  markers={[{time: 30, label: 'Ana: Love this shot', content: <CommentThread comment={thread} />}]}
/>

<AudioPlayer
  src="/media/ep12.mp3"
  title="Designing for every screen"
  subtitle="The Interface Show"
  artworkSrc="/media/ep12.jpg"
  onPreviousTrack={playPrevious}
  onNextTrack={playNext}
/>

Caller decisions: a label; for video, a poster and caption tracks; optional chapters, markers, artwork, and queue handlers. Streaming formats the browser can't play (for example DASH) need an engine the product brings.

Behavior:

  • Keyboard shortcuts while focus is inside the player: Space or K play/pause, M mute, F fullscreen, C captions, ←/→ 5 s, J/L 10 s, ↑/↓ volume, 0–9 jump to that tenth, </> step through the speed list. Shortcuts never fire in a text field or from inside a marker's popover. Changes are announced through the shared announcement channel.
  • VideoPlayer controls float in a frosted bar 8px inside the video, with equal padding and no shadow. The video takes the theme's element radius and the bar the container radius. The bar shows on hover, pointer movement, and keyboard focus, and hides after 2 s idle while playing. It stays while paused, scrubbing, a menu or marker popover is open, or keyboard focus is inside; focus that a pointer gives, such as a click on the timeline, doesn't hold it. Before playback, the large play control takes its place, also on hover; keyboard focus inside the bar still shows it. After the end, the bar stays available beside the replay control. Its transition does not move under reduced motion.
  • On touch there is no idle timer: a tap on the video shows the controls and the next tap hides them. A mouse click plays and pauses.
  • The large play control is pointer-only: the bar's Play does the same job for keyboard and screen reader users. When it or Try again leaves, focus moves to the player. The loading spinner stays out of the accessibility tree.
  • The timeline draws the buffered range, chapter segments, and marker dots on its own track, and the playhead glides between the browser's time updates (it steps with them under reduced motion). A pointer over it previews the time, the chapter, and the nearest marker; its spoken value adds the chapter and every marker within 2.5 s, half an arrow step, so stepping through the media speaks each marker. A marker with content is a button that jumps to its time and opens the content, such as a CommentThread, in a popover in the page's theme. A marker takes no pointer while the video bar is hidden, and keys pressed in its popover, in a text field or on a button, never reach the player's shortcuts. The timeline reads its position once per hover, not on every pointer move.
  • Captions sit one inset above the bar as soon as their cues load, and keep that line when the bar hides.
  • Volume and speed sliders open beside their buttons on hover or focus, and stay open under a coarse primary pointer, as the container reveal does. In the presets they open toward the center of the row, so the button stays under the pointer; sliderPlacement picks the side in a custom layout. They animate their width briefly (still under reduced motion) and show their value in a tooltip. In a container narrower than 480px they stay closed. The speed button keeps one width at every speed.
  • The timeline, time readouts, and the row of playback controls stay left to right in every direction.
  • Controls a platform can't honor aren't rendered: volume where the browser ignores script volume changes, fullscreen where it's unavailable, captions without a track.
  • AudioPlayer sits in a Section container. It shows artwork in front of the title (square by default, any aspect ratio, any media, or a generic audio file icon), skips back 15 s and forward 30 s, pairs a speed button (switches between 1× and the last other speed) with a speed slider, shows previous and next track controls when the product passes handlers, and hands its title, artwork, and transport and track actions to the system media controls once it plays.
  • Glyphs resolve through media:* icon-registry keys, so a theme can restyle them; without a theme entry, Lab draws its bundled Lucide drawings.

Design and alternatives

Decided, and recorded in the spec's decision log:

  1. No runtime dependency; bound for Core after Lab (DEC-1).
  2. Astryx owns a small playback store instead of adopting an external player store (DEC-2).
  3. The timeline and playback controls stay left to right in every direction (DEC-3, DD2).
  4. The player owns playback state: callbacks plus hook actions, with no controlled isPlaying or volume props (DEC-4).
  5. A floating, frosted, inset bar that appears on hover (DEC-5, DD1).
  6. Audio stops at a podcast-grade player. Queues, shuffle, and repeat belong to products or templates (DEC-6).
  7. Web only (DEC-7).
  8. On touch, a tap shows the controls until the next tap (DEC-8).
  9. AudioPlayer uses a Section container instead of its own card (DEC-9).
  10. Speed is one part with a slider variant and a menu variant; both and the shortcuts share one speed list (DEC-10).
  11. Volume sliders open through the shared container reveal, toward the center of the row (DEC-11).
  12. Media glyphs come from the icon registry, with bundled Lucide drawings when a theme maps none (DEC-12).
  13. The timeline carries buffering, chapters, and markers itself, not separate progress bars (DEC-13).
  14. AudioPlayer shows artwork in front of the title (DEC-14).
  15. Previous and next track belong to the product's queue; the player keeps none (DEC-15).
  16. Paired controls are one part each: Mute and volume (MediaVolume), the speed controls (MediaPlaybackRate), and the video and audio elements (MediaPlayerElement). Play, seek, the timeline, time, captions, and fullscreen stay separate (DEC-16).

Questions for the spec owners

  1. Timeline primitive (OQ1). The media timeline is its own part, so core Slider gets nothing media-specific. Today it keeps the core Slider for drag, keys, focus, and value text, clears the Slider's paint through its theme tokens, and draws the track, ranges, markers, and thumb under it. Recommendation: move Slider's behavior into a shared headless hook in core, so Slider and the media timeline each draw their own visuals on one engine. Another option is to keep the token approach.
  2. Who owns frost (OQ2). Should a theme token own the frosted surface, so a flat theme can turn frost off everywhere? The prototype hard-codes it inside the dark media context.
  3. Media icon keys (OQ3). The glyphs resolve through namespaced media:* keys, and Lab draws Lucide's glyphs when a theme maps none. Should they become core icon names that every icon set defines?
  4. Names and part set (OQ4). Are the preset, root, media-part, eight control-part, and two hook names right, and is that the right Lab surface?
  5. Where the RTL rule lives (OQ5). Does the timeline's left-to-right order stay a component exception to design:bidirectionality DR6, or should the design record state the media rule?
  6. Lightbox (OQ6). Should Lightbox video items adopt these controls?
  7. Graduation evidence (OQ7). The planned evidence is WebKit and Firefox runs, screen reader passes, and rendered review over light, dark, and mixed footage. Is anything else needed?
  8. Toolbar (OQ8). Should the video bar be a Toolbar (one tab stop, arrow keys between controls)? Its sliders and the player's shortcuts also use the arrow keys.
  9. Default speed variant (OQ9). AudioPlayer uses the slider variant of MediaPlaybackRate. Should the menu variant be the default instead?

The slider width animation uses the disclosure exception to transform-only motion on the inline axis (DEC-11); please confirm that reading of the motion rule. Each marker with content is its own tab stop today, which does not scale to many comments; next and previous marker keys would replace that.

Evidence

  • MediaPlayer.test.tsx, 45 tests:
    • the root is a named, focusable group; the native element renders without its controls;
    • play, pause, and replay; callbacks fire once per change;
    • shortcuts and their announcements through user-event; shortcuts are ignored in a text field;
    • the large play control is out of the tab order and moves focus to the player; the bar sits behind it before playback, out of the pointer's reach and in the keyboard's, and shows beside the replay control after the end; the spinner is hidden from assistive technology; Try again moves focus to the player;
    • the bar hides when idle, shows on pointer movement, and stays while paused; on touch a tap shows it and only the next tap hides it;
    • the captions toggle appears only with a track; an error shows a retry and is announced once, assertively;
    • in RTL, the timeline, control row, and time readout stay left to right; the timeline speaks its value, chapter, and marker, and its arrow keys skip 5 s and page keys 10 s; marker dots appear once the duration is known;
    • AudioPlayer naming, Section container, artwork and its placeholder, previous and next track controls, volume slider, 15/30 s skips, the speed button and slider, and the system media session claimed and released;
    • MediaPlaybackRate's menu variant checks the current speed and reflects its variant without a slider; MediaVolume puts its slider before Mute and renders Mute alone without it; MediaPlayerElement renders the element for its kind without the browser's controls; keys pressed in a marker's popover, in a text field or on a button, don't seek, change the volume, or toggle playback; markers are spoken within half an arrow step; the timeline reads its position once per hover;
    • a click that gives the timeline focus doesn't hold the controls, and keyboard focus does; the volume check runs once per player, not on every media event;
    • useMediaPlayer reads state and drives actions, useMediaPlaybackTime follows the reported time while paused and shows a seek in the same render while playing, and useMediaPlayer throws outside a player.
  • First-load cost, measured with esbuild (minified, code splitting, gzip level 9, React external): a page that renders only VideoPlayer loads 231.3 KB gzip up front, most of it Core's runtime that every Astryx page shares. The speed menu and marker popover imports add 30.7 KB gzip (89.5 KB minified) of that, even when the page shows neither. For AudioPlayer the numbers are 234.1 KB and 30.9 KB. Core's menu bottom sheet already loads on demand. Loading the speed menu and the marker popover on first use would move those 31 KB out of the first load.
  • Browser check after the part merge (headless Chromium): the speed button and Mute move 0px while their sliders open; the speed slider opens after its button and the volume slider before Mute in both presets; before playback a timeline marker takes no pointer, and it takes one once the bar shows; the menu variant lists 7 speeds; the feed clip's lone Mute draws in the dark media colors; no Slider prop warnings.
  • Storybook Lab/MediaPlayer: Video, VideoWithCaptions, MutedAutoplayLoop, RightToLeft, Audio, AudioWithArtwork, AudioWithWideArtwork, CustomLayout, Chapters, CommentMarkers, BufferedRange, ProgressTicker, FeedClip.
  • Lab docsite blocks: Video player, Muted autoplay loop, Podcast episode, Voice memo, Custom layout, Inline voice note.

Screenshots

Storybook rendered in headless Chromium (2× DPR) with locally generated test media. Frames 1–25 come from the head before the part merge, whose controls render the same way after it; frames 26 and 27 come from the current head. Frames from the main capture (1–6, 11–17, 22, 23, 26) have sensor receipts (story, theme, color mode, direction, viewport, pointer, media state, geometry, settled fonts, page errors) in receipts.json. Frames 7–10, 18–21, 24, and 25 come from focused runs without receipts: 7–9 use a 5-second clip, 10 stalls the download at 35%, and 19–20 use a generated stand-in image.

Before playback: the large play control takes the bar's place.
Before playback: the large play control takes the bar's place.
Hover before playback: the bar stays hidden behind the large play control.
Hover before playback: the bar stays hidden behind the large play control.
Paused after playback started: the bar shows. The video takes the theme's element radius and the bar its container radius (10px and 12px in neutral).
Paused after playback started: the bar shows. The video takes the theme's element radius and the bar its container radius (10px and 12px in neutral).
Paused, dark page.
Paused, dark page.
Hover on Mute: the volume slider opens to its left with a gap, so Mute stays under the pointer.
Hover on Mute: the volume slider opens to its left with a gap, so Mute stays under the pointer.
Captions sit one inset above the bar and keep that line when the bar hides.
Captions sit one inset above the bar and keep that line when the bar hides.
Chapters: segments with small gaps. The pointer preview shows the time and the chapter title.
Chapters: segments with small gaps. The pointer preview shows the time and the chapter title.
Comment markers: a pointer near a dot previews its comment.
Comment markers: a pointer near a dot previews its comment.
Pressing a marker jumps to its time and opens its CommentThread card in the page's theme.
Pressing a marker jumps to its time and opens its CommentThread card in the page's theme.
Buffered range: the lighter part of the track is media loaded ahead of the playhead.
Buffered range: the lighter part of the track is media loaded ahead of the playhead.
Playing, pointer gone: the bar hides after two seconds.
Playing, pointer gone: the bar hides after two seconds.
Touch: a tap shows the controls, and only the next tap hides them.
Touch: a tap shows the controls, and only the next tap hides them.
Keyboard before playback: Tab reaches the bar's Play, and focus inside the bar shows it. The large play control is pointer-only.
Keyboard before playback: Tab reaches the bar's Play, and focus inside the bar shows it. The large play control is pointer-only.
Media failed: message and Try again. Focus moves to the player when Try again leaves.
Media failed: message and Try again. Focus moves to the player when Try again leaves.
Square theme (Y2K): the player and the bar stay square.
Square theme (Y2K): the player and the bar stay square.
Right-to-left page: the timeline, the times, and the control row stay left to right.
Right-to-left page: the timeline, the times, and the control row stay left to right.
Forced colors, paused.
Forced colors, paused.
AudioPlayer in a Section: a generic audio file icon in the square artwork slot, and previous and next track controls beside rewind and fast-forward.
AudioPlayer in a Section: a generic audio file icon in the square artwork slot, and previous and next track controls beside rewind and fast-forward.
Square artwork in front of the title (a generated stand-in image).
Square artwork in front of the title (a generated stand-in image).
Wide artwork through artworkAspectRatio={16 / 9}.
Wide artwork through artworkAspectRatio={16 / 9}.
Hover on the speed button opens the speed slider; the speed shows in a tooltip, and the button keeps one width at every speed.
Hover on the speed button opens the speed slider; the speed shows in a tooltip, and the button keeps one width at every speed.
Hover on Mute opens the volume slider toward the center of the row.
Hover on Mute opens the volume slider toward the center of the row.
AudioPlayer, dark page.
AudioPlayer, dark page.
A video with no controls: hover shows only a 3px progress line.
A video with no controls: hover shows only a 3px progress line.
Feed clips with no control bar: a thin segment per clip, like stories.
Feed clips with no control bar: a thin segment per clip, like stories.
Custom layout from the parts: the speed control's menu variant, and MediaVolume beside it. useMediaPlayer drives the percent readout.
Custom layout from the parts: the speed control's menu variant, and MediaVolume beside it. useMediaPlayer drives the percent readout.
The menu variant open: every speed, with the current one checked.
The menu variant open: every speed, with the current one checked.

Scope

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

vitest run --project ui packages/lab/src/MediaPlayer          # 45 passed
vitest run --project ui packages/lab                          # 1363 passed (100 files)
tsc -p packages/lab/tsconfig.json --noEmit
tsc -p packages/lab/tsconfig.docs.json
tsc -p apps/storybook/tsconfig.json --noEmit             # no errors in the media stories
eslint (strict) packages/lab/src/MediaPlayer packages/lab/blocks/{Video,Audio,Media}Player*.tsx apps/storybook/stories/MediaPlayer.stories.tsx packages/lab/src/index.ts
vitest run --project node scripts/check-cli-theme-bundle.test.mjs scripts/check-cli-official-packages.test.mjs internal/lab-readiness   # 54 passed
vitest run apps/docsite/src/__tests__/{data-extraction,mcp-server,docs-nav}.test.ts  # 149 passed
vitest run --project node scripts/shared-identity.test.mjs   # 7 passed
SWIZZLE_PROOF_BASE=<main> vitest run --project node packages/cli/test/swizzle-proof/   # 8 slices passed, every target
pnpm check:knowledge && pnpm check:changesets && node scripts/check-i18n-catalog.mjs && pnpm check:i18n-runtime
UPDATE_SHADCN_ROUTE_LOCK=1 node apps/docsite/scripts/generate-data.mjs   # lock current

Run after the part merge: the axe audit for Lab/MediaPlayer (0 violations, no baseline entries), and the disabled-hover and disabled-cursor audits (pass). The Lab build passes on this head.

Not yet done: WebKit and Firefox runs, screen reader passes, a real iOS or Android device (headless touch emulation drops the coarse-pointer state after the first tap), and pnpm review:pre, which has not been run on this head.

Writing rubric results

R1 narration: no proposal, history, or "now/previously" phrasing in the record. The decision log states each boundary in the present tense.
R2 research: none in the record. The player survey stays outside the repository, and its conclusions are one or two sentences inside DEC-1 and DEC-2.
R3 evidence: basis cells cite decisions, records, platform constraints, and conventions; none cites a pull request or commit.
R4 rejected alternatives: three, one line each, in DEC-2, DEC-12, and DEC-16.
R5 change references: none.
R6 open questions: OQ1 to OQ9 are unanswered. OQ1, OQ2, OQ5, OQ8, and OQ9 keep their options side by side.

Lab prototype of video and audio players whose themed controls drive the
browser's native media element, with no new runtime dependency.

- VideoPlayer: controls float in a frosted bar inset over the video; the
  bar shows on hover, pointer movement, and keyboard focus and hides after
  two idle seconds while the video plays.
- AudioPlayer: title and artwork, timeline, skip back and forward, speed,
  mute, and system media controls.
- MediaPlayer, the media and control parts, and useMediaPlayer for custom
  layouts.
- Draft component spec with the owner decisions and open questions.
@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 17, 2026 9:52pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Nov 17, 2026, 10:08 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · a87456e

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
lab/AudioPlayer 232.0 kB (new) · 1.8 kB CSS (new) — — · ✓ · ✗
lab/MediaCaptionsButton 222.3 kB (new) · 1.5 kB CSS (new) — — · ✓ · ✗
lab/MediaFullscreenButton 222.3 kB (new) · 1.5 kB CSS (new) — — · ✓ · ✗
9 more components
Component Size LoC Visual · A11y · RTL
lab/MediaPlaybackRate 222.3 kB (new) · 1.5 kB CSS (new) — — · ✓ · ✗
lab/MediaPlayButton 222.3 kB (new) · 1.5 kB CSS (new) — — · ✓ · ✗
lab/MediaPlayer 30.9 kB (new) · 165 B CSS (new) — — · ✓ · ✗
lab/MediaPlayerElement 6.9 kB (new) · 177 B CSS (new) — — · ✓ · ✗
lab/MediaSeekButton 222.3 kB (new) · 1.5 kB CSS (new) — — · ✓ · ✗
lab/MediaTime 222.3 kB (new) · 1.5 kB CSS (new) — — · ✓ · ✗
lab/MediaTimeSlider 222.3 kB (new) · 1.5 kB CSS (new) — — · ✓ · ✗
lab/MediaVolume 222.3 kB (new) · 1.5 kB CSS (new) — — · ✓ · ✗
lab/VideoPlayer 228.9 kB (new) · 2.0 kB CSS (new) — — · ✓ · ✗

Package size: @astryxdesign/cli 5.37 MB packed (+197 B); no new dependencies.

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This pull request needs an engineering owner's spec decision before it can be approved, and it also needs changes.

Spec decision: no current spec governs the MediaPlayer family. Its only record, component:MediaPlayer, is a draft with seven open questions. An engineering owner records the decision on its requirements (FR1–FR10, AR1–AR7, DEC-1–DEC-7, DD1–DD2, including the timeline's left-to-right exception in OQ5) by commenting /approve-spec bfb5931d626aeb20bf6afc83a64fa9acffcc17fe; the author may do so if they are an engineering owner.

Required changes:

  • AudioPlayer claims the system media session only on a player's first playback and releases it on unmount even after another player took it, so with two players the lock screen keeps the other episode and unmounting one clears the other's controls (AudioPlayer.tsx:199, :208).
  • The buffering Spinner in VideoPlayer is a live role="status" inside the player, which the announcement spec (AST-086 FR8) rules out for an indicator inside its owner, so render it with aria-hidden="true" (VideoPlayer.tsx:223).
  • MediaVolumeSlider passes className and style to Slider, which ignores them and warns on every render, so pass them as containerClassName and containerStyle (MediaPlayerControls.tsx:235).
  • The root hands its element to the store from a layout Effect, so move that into a callback ref merged through useMergedRefs, as the media parts already do (MediaPlayer.tsx:249).
  • A layout Effect only copies the playback callbacks into a ref, so list them as dependencies of the store-subscription Effect instead (MediaPlayer.tsx:244).
  • The docs promise iOS Safari and iPhone behavior that no iOS run has shown, so attach that evidence or describe only the capability (MediaPlayer.doc.mjs:375, :419).
  • At 4,386 authored lines with no size exemption, the change needs splitting, for example into the draft record, then the store and parts, then the presets, docs and stories.

[Automated review]

}}
onClick={() => {
// A tap shows or hides the controls, the way native players do.
// A mouse click plays or pauses.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking: this line narrates the else branch. The line above already gives the reason.

try {
session.setActionHandler(action, null);
} catch {
// See above.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking: "See above." is vague. Suggest: "Browsers that do not support an action throw."

The player's radius is now the bar's radius plus the bar's inset, so the
two curves stay parallel in every theme. A square theme keeps both square.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This pull request needs an engineering owner's spec decision before it can be approved, and it also needs changes.

Spec decision: no current spec governs the MediaPlayer family; its only record, component:MediaPlayer, is a draft with seven open questions. An engineering owner approves or rejects its requirements (FR1–FR10, including FR6's new rule that the player's corner radius equals the control bar's radius plus its inset, AR1–AR7, DEC-1–DEC-7, DD1–DD2, and the timeline's left-to-right exception that OQ5 leaves open) by commenting /approve-spec ce2afa9f231b0fdca8251ca221a9b5343bb9206a; the author may do so if they are an engineering owner.

Required changes:

  • Miss: the docsite no longer builds, because the generated preview registry casts the useMediaPlayer entry in MediaPlayer.doc.mjs:438 to a component and next build fails type check with TS2352, so skip hook entries in generateComponentPreviewRegistry (apps/docsite/scripts/generate-data.mjs:1241) or keep the hook out of the doc's components until it does.
  • AudioPlayer claims the system media session only on a player's first playback and releases it on unmount even after another player took it, so with two players the lock screen keeps the other episode and unmounting one clears the other's controls (AudioPlayer.tsx:199, :208).
  • The buffering Spinner in VideoPlayer is a live role="status" inside the player, which the announcement spec (AST-086 FR8) rules out for an indicator inside its owner, so render it with aria-hidden="true" (VideoPlayer.tsx:228).
  • MediaVolumeSlider passes className and style to Slider, which ignores them and warns on every render, so pass them as containerClassName and containerStyle (MediaPlayerControls.tsx:235).
  • The root hands its element to the store from a layout Effect, so move that into a callback ref merged through useMergedRefs, as the media parts already do (MediaPlayer.tsx:248).
  • A layout Effect only copies the playback callbacks into a ref, so list them as dependencies of the store-subscription Effect instead (MediaPlayer.tsx:243).
  • The docs promise iOS Safari and iPhone behavior that no iOS run has shown, so attach that evidence or describe only the capability (MediaPlayer.doc.mjs:319, :375, :419).
  • At 4,391 authored lines with no size exemption, the change needs splitting, for example into the draft record, then the store and parts, then the presets, docs and story.

The other seven items were raised in the previous review and are unchanged; the new corner nesting renders as the record describes in the default, a rounder and a square theme.

[Automated review]

The bar now has the same padding on every side, so the buttons' corners
nest inside the bar's. The frosted surfaces drop the low shadow, whose
dark-mode inset ring read as an outline over video. The spec asks whether
the bar should be a Toolbar.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This pull request needs an engineering owner's spec decision before it can be approved, and it also needs changes.

Spec decision: no current spec governs the MediaPlayer family; its only record, component:MediaPlayer, is a draft with eight open questions. An engineering owner approves or rejects its requirements (FR1–FR10, AR1–AR7, PR1–PR2, DEC-1–DEC-7, DD1–DD2, including the timeline's left-to-right exception that OQ5 leaves open) by commenting /approve-spec 56c07e75fde26bc56087607c28da4450851d6e1b; the author may do so if they are an engineering owner.

Required changes:

  • Miss: the docsite no longer builds, because the generated preview registry casts the useMediaPlayer entry in MediaPlayer.doc.mjs:438 to a component and next build fails type check with TS2352, so skip hook entries in generateComponentPreviewRegistry (apps/docsite/scripts/generate-data.mjs:1241) or keep the hook out of the doc's components until it does.
  • AudioPlayer claims the system media session only on a player's first playback and releases it on unmount even after another player took it, so with two players the lock screen keeps the other episode and unmounting one clears the other's controls (AudioPlayer.tsx:199, :208).
  • The buffering Spinner in VideoPlayer is a live role="status" inside the player, which the announcement spec (AST-086 FR8) rules out for an indicator inside its owner, so render it with aria-hidden="true" (VideoPlayer.tsx:225).
  • MediaVolumeSlider passes className and style to Slider, which ignores them and warns on every render, so pass them as containerClassName and containerStyle (MediaPlayerControls.tsx:235).
  • The root hands its element to the store from a layout Effect, so move that into a callback ref merged through useMergedRefs, as the media parts already do (MediaPlayer.tsx:248).
  • A layout Effect only copies the playback callbacks into a ref, so list them as dependencies of the store-subscription Effect instead (MediaPlayer.tsx:243).
  • The docs promise iOS Safari and iPhone behavior that no iOS run has shown, so attach that evidence or describe only the capability (MediaPlayer.doc.mjs:319, :375, :419).
  • At 4,394 authored lines with no size exemption, the change needs splitting, for example into the draft record, then the store and parts, then the presets, docs and story.

Every item above was raised in the previous review and is unchanged at this head; the new commit's even bar padding and dropped shadow render as described.

[Automated review]

… reveal

Fixes from the component audit:
- Focus moves to the player when the large play control or Try again
  leaves; the large play control is pointer-only.
- The loading spinner stays out of the accessibility tree.
- The bar's transition does not move under reduced motion.
- VideoPlayer fills its container instead of collapsing to zero width.
- Every part extends the base props and forwards DOM props; all theme
  targets are documented and the timeline's target is on its slider.
- Docs name the APG patterns; every export has an example; Lab blocks
  give the docsite a showcase and examples; tests cover the callbacks,
  the hook, and keyboard use through user-event.

Design changes:
- The bar sits 8px from the edges, so the video's radius drops to 20px.
- On touch, a tap shows the controls and the next tap hides them.
- AudioPlayer uses a Section container instead of a card.
- Playback speed is a menu; it shares one speed list with the shortcuts.
- Both presets reveal the volume slider on hover or focus of Mute.
- Glyphs resolve through media:* icon-registry keys; the neutral theme
  maps them to Lucide, and the bundled fallbacks are Lucide drawings.
- Captions sit above the control bar whether it shows or hides, so the
  bar never covers them and they do not jump.
- The volume slider opens to the left of Mute with a gap, animates open
  and closed, and shows the volume in a tooltip; Mute stays under the
  pointer.
- Skip controls use the rewind and fast-forward glyphs.
- AudioPlayer pairs a speed button with a speed slider, revealed like
  volume. The button switches between normal speed and the last other
  speed. The speed menu stays available as a part.
…sual

Five review stories: a ticker that replaces the control bar while it hides, the same ticker while buffering, chapter segments, comment pins over progress marks, and a feed clip whose only timeline is a ticker.
…e spec

The volume group no longer shrinks in a tight bar, so the timeline gives up the space. The spec records that the slider's column opens with a short width transition under the disclosure exception, and stays still under reduced motion.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This pull request needs an engineering owner's spec decision before it can be approved, and it also needs changes.

Spec decision: no current spec governs the MediaPlayer family. Its only record, component:MediaPlayer, is a draft, and the published neutral theme's new media:* glyph entries and widened neutralIconRegistry type have no record that covers them. An engineering owner (the author too, if they are one) records the decision by commenting /approve-spec 015f29540f8ae5ef2e134fc9d87199393e391667, or rejects it; that covers FR1–FR11, AR1–AR7, DEC-1–DEC-12, DD1–DD2, the timeline's relationship to the bidirectionality design record's DR6 (OQ5), and whether theme glyphs use media:* registry keys or typed component icon slots.

Required changes, whatever the decision:

  • The docsite build fails because the generated preview registry casts the useMediaPlayer doc entry to a component (TS2352); skip hook entries in that registry or keep the hook out of the doc's components.
  • Miss: after a mouse click or drag on the timeline the video controls never hide during playback, because the focused Slider thumb matches :focus-visible; hold the controls for focus only after keyboard input.
  • MediaVolumeSlider, MediaTimeSlider and MediaPlaybackRateSlider drop className, style and their documented theme class, because Slider ignores root styling; pass them as containerClassName and containerStyle.
  • The Effect at MediaPlayer.tsx:279 only copies callbacks into a ref; list the callbacks as dependencies of the subscription Effect and call them directly.
  • The caption-layout Effect in VideoPlayer.tsx sets up listeners when the video and bar attach and never re-runs; move it to a callback ref or the store's track-list listener.
  • The volume and speed reveals repeat the container reveal's hover, focus and touch rules in their own grids; extend useContainerReveal with a collapsing width reveal and delete the copies.
  • The description and docs describe behavior the code does not have (a speed cycle, "no existing export changes", locally drawn icons, nine parts, 18 tests, seconds shown on the seek icon, a Menu Button speed control); correct those sentences.
  • The docs promise iOS Safari and iPhone behavior with no iOS run; add iOS evidence or describe only the capability.
  • MediaTimelineExperiments.stories.tsx is an unrequested experiment; move it to its own pull request or drop it.
  • At 6,009 authored lines the change needs a split: the draft record, then the store, root and parts, then the presets with their docs and blocks, then the neutral theme glyphs.

The earlier Spinner, media-session and container-ref findings are fixed. The full review lists four non-blocking comment suggestions.

[Automated review]

}}
onClick={() => {
// A tap shows or hides the controls, the way native players do.
// A mouse click plays or pauses.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking: this line narrates the else branch; the line above already gives the reason.

try {
session.setActionHandler(action, null);
} catch {
// See above.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking: "See above." is vague. Suggest: "Browsers that do not support an action throw."

Comment thread packages/themes/neutral/src/icons.tsx Resolved
…twork and track controls

- The timeline draws the buffered range, chapter segments, and marker dots
  on its own track. A pointer over it previews the time, the chapter, and
  the nearest marker, and its spoken value adds the chapter and a marker it
  reaches. The core Slider keeps the interaction and the focus ring.
- VideoPlayer and AudioPlayer pass `chapters` and `markers` to it.
- Mute and the speed button hold still while their sliders animate.
- AudioPlayer shows artwork in front of the title: square by default, any
  aspect ratio, any media, or a generic audio file icon.
- AudioPlayer offers previous and next track controls when the product
  passes handlers, and hands them to the system media controls.
- Zero time is spoken as "0 seconds".
- The timeline stories join the main media player group.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This pull request needs an engineering owner's spec decision before it can be approved, and it also needs changes.

Spec decision: no current spec governs the MediaPlayer family. Its only record, component:MediaPlayer, is a draft, and the published neutral theme's new media:* glyph entries and widened neutralIconRegistry type have no record that covers them. An engineering owner (the author too, if they are one) records the decision by commenting /approve-spec efae0215a6fe294bfe23a92352114069fd0adcd1, or rejects it; that covers FR1–FR12 (including the new buffered range, chapters and markers), AR1–AR7, DEC-1–DEC-15, DD1–DD2, the timeline's relationship to the bidirectionality design record's DR6 (OQ5), and whether theme glyphs use media:* registry keys or typed component icon slots.

Required changes, whatever the decision:

  • The timeline's markers prop with {time, label} items names what Core's ProgressBar and Slider already call marks with {value, label} items; use marks.
  • Keyboard and screen-reader users hear a timeline comment only when a 5-second step lands within 6 px of it, so on the story's own clip no comment is ever spoken; name the markers a step passes, or stop steps at markers.
  • After autoplay, a mouse click on the timeline keeps the video controls up for the rest of playback, because the script-focused slider matches :focus-visible; hold the controls for focus only after keyboard input.
  • MediaVolumeSlider, MediaTimeSlider and MediaPlaybackRateSlider drop className, style and their theme class and log a Slider warning on every preset render; pass them as containerClassName and containerStyle.
  • The docsite build fails because the generated preview registry casts the useMediaPlayer doc entry to a component (TS2352); skip hook entries there or keep the hook out of the doc's components.
  • The Effects at MediaPlayer.tsx:279 and AudioPlayer.tsx:273 only copy props into refs; call the playback callbacks from the subscription Effect and set the media session's track handlers from an Effect keyed on them.
  • The caption-layout Effect in VideoPlayer.tsx and the timeline-width Effect in MediaPlayerControls.tsx observe elements from mount-only Effects; move each to a callback ref on its element.
  • The volume and speed reveals repeat the container reveal's hover, focus and touch rules; extend useContainerReveal with a collapsing width reveal and delete the copies.
  • The description, record and docs describe what the code does not do ("no existing export changes", chapters and markers as "no API" experiments, "nine control parts", seconds "shown on its icon", a Menu Button speed control) and give stale counts; correct those sentences.
  • The docs promise iOS Safari and iPhone behavior with no iOS run; add iOS evidence or describe only the capability.
  • At 6,580 authored lines the change needs a split: the draft record, then the store, root and parts, then the presets with their docs and blocks, then the timeline's chapters and markers, then the neutral theme glyphs.

The separate timeline experiments story file is gone. The full review lists five non-blocking comment suggestions.

[Automated review]

/** Chapters, drawn as segments of the track with a small gap between them. */
chapters?: readonly MediaTimelineChapter[];
/** Points of interest, such as timestamped comments, drawn as dots. */
markers?: readonly MediaTimelineMarker[];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

markers with {time, label} items names what Core already calls marks: ProgressBar takes marks?: ReadonlyArray<ProgressBarMark> ({value, label}) and Slider, which this timeline wraps, takes marks?: {value, label?}[]. Use marks with {value, label} items (or ProgressBarMark) so callers keep one word and shape.

] as const;

/**
* Hands the title, artwork, and transport actions to the system media

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking: this JSDoc describes useMediaSession but now sits on interface TrackHandlers. Move it below the interface.

hasNextTrack ? () => trackHandlersRef.current.onNextTrack?.() : null,
);
} catch {
// See above.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking: "See above." is vague. Suggest: "Browsers that do not support an action throw."

- useMediaPlaybackTime advances the playback position on every animation
  frame while media plays, and snaps back on each time update, seek,
  pause, and stall; it follows the time updates only under reduced
  motion. The timeline uses it, so the playhead and fill glide.
- A marker with `content` is a button: it jumps to its time and opens its
  content, such as a CommentThread, in a popover above the timeline.
- The speed button and the speed menu keep one width at every speed.
- Stories: comment markers open their comment threads, a controlless
  video shows only a thin progress line on hover, and feed clips show a
  thin segment per clip.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This pull request needs an engineering owner's spec decision before it can be approved, and it also needs changes.

Spec decision: no current spec governs the MediaPlayer family. Its only record, component:MediaPlayer, is a draft that does not yet state this head's useMediaPlaybackTime hook or markers that open a popover, and the published neutral theme's new media:* glyph entries and widened neutralIconRegistry type have no record that covers them. An engineering owner (the author too, if they are one) records the decision by commenting /approve-spec 989aaa97adfabf231120c846e84174e5b770e836, or rejects it; that covers FR1–FR12, AR1–AR7, DEC-1–DEC-15, DD1–DD2, the timeline's relationship to the bidirectionality design record's DR6 (OQ5), whether the hook and pressable markers go into the record, and whether theme glyphs use media:* registry keys or typed component icon slots.

Required changes, whatever the decision:

  • Arrow and Page keys typed in a timeline marker's popover seek the video instead of moving the caret, because the popover renders inside the wrapper that captures those keys; render the popovers outside it, or capture keys only on the slider thumb.
  • The docsite does not build: the route lock lacks the new useMediaPlaybackTime route, and the preview registry's cast of useMediaPlayer to a component fails with TS2352; refresh the lock and skip hook entries in the preview registry.
  • Keyboard and screen-reader users hear a marker without content only when a 5-second step lands within 6 px of it; name the markers a step passes, or make every marker focusable.
  • After autoplay, a mouse click on the timeline keeps the video controls up for the rest of playback; hold the controls for focus only after keyboard input.
  • MediaVolumeSlider, MediaTimeSlider and MediaPlaybackRateSlider drop className, style and their theme class and log a Slider warning on every preset render; pass them as containerClassName and containerStyle.
  • The timeline's markers prop with {time, label} items names what Core's ProgressBar and Slider already call marks with {value, label} items; use marks.
  • useMediaPlaybackTime copies the reported time into state in an Effect, so after a seek it renders the old position before repairing it; start the anchor in the frame Effect and derive the returned time during render.
  • useMediaPlaybackTime reads the reduced-motion setting once with matchMedia instead of Core's useMediaQuery, so a change during playback is ignored; use useMediaQuery.
  • The Effects at MediaPlayer.tsx:279 and AudioPlayer.tsx:273 only copy props into refs; call the playback callbacks from the subscription Effect and set the media session's track handlers from an Effect keyed on them.
  • The caption-layout Effect in VideoPlayer.tsx and the timeline-width Effect in MediaPlayerControls.tsx observe elements from mount-only Effects; move each to a callback ref on its element.
  • The volume and speed reveals repeat the container reveal's hover, focus and touch rules; extend useContainerReveal with a collapsing width reveal and delete the copies.
  • The description, record and docs describe what the code does not do ("no existing export changes", chapters and comment pins as "no API" experiments, "nine control parts", seconds "shown on its icon", a Menu Button speed control) and give stale counts; correct those sentences.
  • The docs promise iPhone and iOS Safari behavior with no iOS run; add iOS evidence or describe only the capability.
  • At 6,842 authored lines the change needs a split: the draft record, then the store, root and parts, then the presets with their docs and blocks, then the timeline's chapters, markers and popovers, then the neutral theme glyphs.

[Automated review]

return String(value).padStart(2, '0');
}

/** Formats seconds as m:ss, or h:mm:ss when `hasHours` is true. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking: this is formatClock's JSDoc, now stranded above useMediaPlaybackTime's. Move it back above formatClock.

…element radius

- Captions move above the control bar as soon as their cues load, not
  only after playback starts: the player also listens for each track
  element's load event.
- Marker dots sit on the center of the track.
- A marker's popover takes the page's theme, so a comment thread keeps its
  usual card instead of the dark media surface.
- The video takes the theme's element radius; the bar keeps the container
  radius.
@ernestt
ernestt marked this pull request as ready for review November 4, 2026 23:36
…check

- The swizzle proof renders each media part inside a player from the same
  copy, as it does for Tour steps and navigation screens.
- Each media store probes once whether script can set the volume, so no
  module state outlives a store.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approval of this pull request waits on an engineering owner's spec decision at this head, and changes are required either way.

Spec decision: the draft component:MediaPlayer record (FR1–FR12, AR1–AR7, PR1–PR2, DEC-1–DEC-16, DD1–DD2) is the only record for this family, and the last /approve-spec names an earlier head. An engineering owner records the decision for this head by commenting /approve-spec 86a7bcc808603c6c28f539e07cdd64ec0c1120d7 on this pull request, which also settles whether MediaPlaybackRate keeps its variant name; the author may do so if they are an engineering owner.

Required changes:

  • With focus on a button inside a comment marker's popover, ArrowRight, L and digits still seek the video and ArrowDown lowers the volume, because the root's shortcut handler skips only text fields (MediaPlayer.tsx:338-345).
  • After autoplay, one mouse click on the timeline keeps the video controls visible for the rest of playback, because the root holds them for any :focus-visible focus instead of asking Core's shared interaction modality (MediaPlayer.tsx:508-510).
  • Markers without content are spoken only when a 5 s or 10 s key step lands within 6 px of them, so keyboard and screen-reader users skip most of them (MediaPlayerControls.tsx:94).
  • canScriptSetVolume() now runs inside readAll, so every media event (about four timeupdates a second while playing) builds a throwaway <audio> element; probe once per store and reuse the result (mediaStore.ts:311).
  • markers with {time, label} names what Core's Slider already calls marks with {value, label}.
  • useMediaPlaybackTime renders the old time after a jump and repairs it in an Effect (MediaPlayerContext.ts:158-162).
  • Two element observers live in mount-only Effects instead of callback refs, so a replaced node is never observed (VideoPlayer.tsx:306-394, MediaPlayerControls.tsx:774-782).
  • Reduced motion is read once through matchMedia instead of Core's useMediaQuery, and the slider reveal copies the container reveal's rules, already drifting from them (any-pointer: coarse against the shared pointer: coarse), instead of extending useContainerReveal.
  • MediaPlayerContext is still a plain createContext, so a swizzled part inside the package's MediaPlayer cannot read it; create it with createSharedContext from @astryxdesign/core/internal/shared-context (MediaPlayerContext.ts:62).
  • MediaTime builds -0:30 and 0:12 / 1:00 from literals, so no locale can change the minus sign or separator (MediaPlayerControls.tsx:1066-1068).
  • The timeline calls getBoundingClientRect() on every pointer move (MediaPlayerControls.tsx:829); read the wrapper's position once at pointer enter and keep it until a resize or scroll.
  • Two Effects only copy callbacks into refs (MediaPlayer.tsx:277-281, AudioPlayer.tsx:206-212); use useCommittedRef from @astryxdesign/core/internal/committed-ref.
  • MediaPlayButton's JSDoc example renders the removed MediaPlayerAudio, and the docs type markers without content.
  • The docs promise iPhone and iOS Safari behavior that no iOS run has checked; attach that evidence or describe only the capability.
  • The merge of main adds an unrelated brace-only edit to apps/sandbox/perf/scenes.perf.spec.ts, and the description still lists the 28 Core strings, which come from main, and checks that unrelated changes were removed; drop the edit and update the description.

Fixed since the last review: the swizzle proof renders each media part inside its player, and the identity guard no longer flags module state in the store.

Claims and files checked
  • Claim: no runtime dependency; verified, no manifest or lockfile changes.
  • Claim: 12 components and 2 hooks are exported; verified in the MediaPlayer and Lab indexes.
  • Claim: 28 Core catalog strings are part of this change; false, the base already has all 28.
  • Claim: no theme package changes, glyphs resolve through media:* keys with bundled Lucide drawings; verified in mediaIcons.tsx.
  • Claim: the CLI package list is regenerated and discovery lists the players (changeset); verified for the 12 components and 6 blocks, and its generator check reports it current; the hooks have no discovery kind and ship in the MediaPlayer docs.
  • Claim: the docsite preview registry skips hook entries; verified in generate-data.mjs and its test.
  • Claim: shortcuts work while focus is inside the player and never fire in a text field; verified by the tests.
  • Claim: the bar shows for keyboard focus and hides after 2 s idle while playing; false after a mouse click on the timeline, which holds it like keyboard focus.
  • Claim: a touch tap shows the controls and the next tap hides them; verified by the tests.
  • Claim: the large play control is pointer-only, focus moves to the player, the spinner is hidden; verified by the tests.
  • Claim: a marker with content is a button that opens a popover and takes no pointer while the bar is hidden; verified in Chromium and the source.
  • Claim: keys typed in a marker popover don't seek; false for a button in the popover, in Chromium and a unit test.
  • Claim: the timeline, readouts and control row stay left to right; verified by the tests.
  • Claim: AudioPlayer sits in a Section with artwork, 15/30 s skips, track controls and the system media session; verified by the tests.
  • Claim: 38 tests pass; verified.
  • Claim: unrelated changes were removed or split; false, a perf-spec edit rides along.
  • Claim: each media store probes the volume once (commit message); false, it probes on every media event.
  • Files with findings: MediaPlayer.tsx, MediaPlayerContext.ts, MediaPlayerControls.tsx, VideoPlayer.tsx, AudioPlayer.tsx, mediaStore.ts, MediaPlayer.doc.mjs, MediaPlayer.spec.md (awaiting a decision), apps/sandbox/perf/scenes.perf.spec.ts.
  • Files clear: MediaPlayerElement.tsx, mediaIcons.tsx, the MediaPlayer and Lab indexes, MediaPlayer.test.tsx, MediaPlayer.stories.tsx, the six blocks and their docs, generate-data.mjs, data-extraction.test.ts, routes.lock.json, official-packages.json, the swizzle-proof samples, the CLI changeset.

Automated review (maintainer link)

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 86a7bcc

astracat-bot[bot]
astracat-bot Bot previously requested changes Nov 14, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested. The engineering owner's /approve-spec for this head settles the component:MediaPlayer record, so what remains is implementation: thirteen blocking fixes and two pieces of evidence.

Blocking

  • Keys pressed on a button inside a comment marker's popover still seek the video and change the volume (MediaPlayer.tsx:338-345), which FR12 forbids.
  • After autoplay, a first mouse press on the timeline keeps the control bar up during playback, because the root holds it on :focus-visible instead of the shared keyboard modality (MediaPlayer.tsx:117-123, :508-510).
  • The volume probe builds a new <audio> element on every media event, about four times a second while playing (mediaStore.ts:311).
  • useMediaPlaybackTime renders the old time after each jump and repairs it in an Effect (MediaPlayerContext.ts:158-162).
  • Two Effects only copy callbacks into refs and should use useCommittedRef (MediaPlayer.tsx:277-281, AudioPlayer.tsx:206-212).
  • Two observers attach in mount-only Effects instead of callback refs (VideoPlayer.tsx:306-394, MediaPlayerControls.tsx:774-782).
  • The timeline calls getBoundingClientRect() on every pointer move (MediaPlayerControls.tsx:829).
  • useMediaPlaybackTime reads matchMedia once instead of Core's useMediaQuery, and the slider reveal copies the shared container reveal and has drifted from it (MediaPlayerContext.ts:164-171, MediaPlayerControls.tsx:274-296).
  • The parts share a plain createContext, so a swizzled part cannot read the package's MediaPlayer (MediaPlayerContext.ts:62-64).
  • MediaTime builds -0:30 and 0:12 / 1:00 from string literals instead of catalog messages (MediaPlayerControls.tsx:1066, :1068).
  • The MediaPlayButton example uses the removed MediaPlayerAudio, and the markers doc type leaves out content (MediaPlayerControls.tsx:335, MediaPlayer.doc.mjs:47-50).
  • Miss: the CLI changeset says discovery lists the useMediaPlayer hook, but the generated list has no hook entry (.changeset/lab-media-player-cli-discover.md:5).
  • The unrelated brace edit to apps/sandbox/perf/scenes.perf.spec.ts should leave this pull request, and the description should say the 28 media strings already come from main.

Evidence needed

  • iOS Safari results for the documented iOS volume and fullscreen behavior, or docs that describe only the capability.
  • Newly live check: the first-load gzip cost of the speed menu and marker popover code on a page that renders the players without them.
Claims and files checked

Claims:

  • 12 new Lab components and 2 hooks, with no existing export changed: verified (packages/lab/src/index.ts).
  • 28 media strings in en.json as part of this change: false; the base already has them.
  • No theme package changes, and a regenerated CLI discovery list: verified (its --check reports it current).
  • The docsite groups the family and skips hook entries in the preview registry: verified (MediaPlayer.doc.mjs, generate-data.mjs).
  • Shortcuts skip text fields and are announced: verified (MediaPlayer.tsx:91-115, tests).
  • Keys typed in a marker popover do not seek: false for buttons in the popover.
  • The bar sits 8px inside with the element and container radii, hides after 2 s idle, and stays while paused, scrubbing or a menu is open: verified, except the hold after a first mouse press above.
  • A tap shows the controls and the next tap hides them; the large play control is pointer-only; the spinner is hidden from assistive technology: verified (tests).
  • Markers take no pointer while the bar is hidden: verified (VideoPlayer.tsx:120-148).
  • The timeline, times and control row stay left to right: verified (right-to-left tests).
  • AudioPlayer sits in a Section with artwork, 15 and 30 s skips, a speed toggle and slider, track controls and the system media controls: verified (tests, source).
  • Glyphs resolve through media:* keys with bundled Lucide fallbacks: verified (mediaIcons.tsx).
  • 38 family tests: verified; all pass.
  • Changeset: discovery lists the players and parts: verified; the useMediaPlayer hook: false.

Files (33):

  • MediaPlayer.tsx, MediaPlayerContext.ts, mediaStore.ts, MediaPlayerControls.tsx, VideoPlayer.tsx, AudioPlayer.tsx, MediaPlayer.doc.mjs: findings above.
  • .changeset/lab-media-player-cli-discover.md, apps/sandbox/perf/scenes.perf.spec.ts: findings above.
  • MediaPlayerElement.tsx, mediaIcons.tsx, the folder index.ts, MediaPlayer.test.tsx, packages/lab/src/index.ts: clear.
  • docs/specs/components/MediaPlayer/MediaPlayer.spec.md: approved for this head; clear.
  • The six packages/lab/blocks players and their six docs: clear.
  • apps/storybook/stories/MediaPlayer.stories.tsx, apps/docsite/scripts/generate-data.mjs, apps/docsite/src/__tests__/data-extraction.test.ts, packages/cli/test/swizzle-proof/samples.mjs: clear.
  • packages/cli/assets/discover/official-packages.json, internal/shadcn-registry/routes.lock.json: generated and current; clear.

Automated review (maintainer link)

Comment on lines +30 to +37
import {
DropdownMenu,
DropdownMenuRadioGroup,
DropdownMenuRadioItem,
} from '@astryxdesign/core/DropdownMenu';
import {useContainerReveal} from '@astryxdesign/core/hooks';
import {IconButton, type IconButtonProps} from '@astryxdesign/core/IconButton';
import {Popover} from '@astryxdesign/core/Popover';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Newly live check: DropdownMenu serves only variant="menu" and Popover only markers with content, both off by default, but this module holds every part, so a page with only AudioPlayer or MediaPlayButton loads both. architecture:component-import-boundaries INV10 allows an unused optional feature 0.3 KB gzip of first-load JavaScript and asks the pull request to report that delta; please report it for a page that renders AudioPlayer without either feature, and move a feature behind its own import if it is over.

…ayer

- Keys pressed in a timeline marker's popover, also on a button, no longer
  reach the player's shortcuts, so they never seek, change the volume,
  mute, or toggle playback.
- Focus that a pointer gives, such as a click on the timeline after
  autoplay, no longer holds the video controls, so a mouse that leaves
  the player hides them. The player reads Core's shared interaction
  modality; keyboard focus still holds the controls.
- The timeline speaks every marker within 2.5 seconds of its value, half
  an arrow key step, so stepping through the media speaks each marker.
- useMediaPlaybackTime shows a seek in the same render, and reads reduced
  motion through Core's useMediaQuery.
- The caption layout and the timeline observe their current elements, so
  a replaced element stays observed.
- The timeline reads its position once per hover instead of on every
  pointer move. A resize or a scroll drops the stored position.
- MediaTime builds its readouts from catalog messages, so a locale can
  change the minus sign and the separator.
- The docs describe the volume and fullscreen checks by capability, give
  a marker's `content` in its type, and the play button's example uses
  MediaPlayerElement.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approval waits on an engineering owner's decision: the draft component:MediaPlayer record is unchanged since it was approved, but an approval counts only for the exact head it names, so an engineering owner records the decision for this head by commenting /approve-spec 9769d7f52d1b49e7b9c3c323a744c2ce080feb1f (the author may do so if they are an engineering owner). The popover-key and pointer-focus fixes check out in Chromium, and eight fixes are still required either way.

Required either way

  • VideoPlayer keeps its video and bar elements in React state, which the React runtime rules forbid, so own them through callback refs instead (VideoPlayer.tsx:413, :468).
  • useMediaPlaybackTime's remaining Effect only copies the reported time into a ref, so start the anchor inside the frame Effect (MediaPlayerContext.ts:169-172).
  • The volume probe still builds a new <audio> element on every media event, about four times a second while playing (mediaStore.ts:311).
  • Two Effects only copy callbacks into refs and should use useCommittedRef (MediaPlayer.tsx:297-301, AudioPlayer.tsx:209-212).
  • The slider reveal copies the shared container reveal and opens on a different pointer query, leaving an empty column beside Mute on touchscreen laptops used with a mouse (MediaPlayerControls.tsx:264-307).
  • The parts share a plain createContext, so a swizzled part cannot read the package's MediaPlayer (MediaPlayerContext.ts:70-72).
  • The CLI changeset says discovery lists the useMediaPlayer hook, but the generated list has no hook entry (.changeset/lab-media-player-cli-discover.md:5).
  • The unrelated brace edit to apps/sandbox/perf/scenes.perf.spec.ts should leave this pull request, and the description should say the 28 media strings already come from main.

Evidence needed

  • The first-load gzip cost of the speed menu and marker popover code on a page that renders the players without them.
  • Miss: the public canSetVolume JSDoc still names iOS Safari without an iOS run, so describe the capability as the docs now do (mediaStore.ts:48).
Claims and files checked

Review mode: full; reason: author-not-engowner

Claims:

  • 12 new Lab components and 2 hooks, with no existing export changed: verified (packages/lab/src/index.ts).
  • 28 media strings in en.json as part of the public delta: false; the base already has them.
  • No theme package changes, and a regenerated CLI discovery list: verified (its check test passes).
  • One docsite group, and hook entries skipped in the preview registry: verified (MediaPlayer.doc.mjs, generate-data.mjs).
  • Shortcuts are announced and never fire in a text field or from a marker popover: verified (MediaPlayer.tsx:353-506, Chromium, tests).
  • The bar sits 8px inside with the element and container radii, hides after 2 s idle, and holds for keyboard focus but not pointer focus: verified (VideoPlayer.tsx, MediaPlayer.tsx:530-535, Chromium, tests).
  • A tap shows the controls and the next tap hides them, and a mouse click plays and pauses: verified (tests, VideoPlayer.tsx:225-238).
  • The large play control is pointer-only, focus moves to the player, and the spinner is hidden from assistive technology: verified (tests).
  • The timeline draws buffering, chapters and dots, glides between time updates, speaks markers within 2.5 s, opens marker popovers in the page theme, ignores the pointer while the bar is hidden, and reads its position once per hover: verified (source, tests, Chromium).
  • Captions sit one inset above the bar: verified (VideoPlayer.tsx:302-394), with the element-state finding above.
  • The volume and speed sliders open beside their buttons, stay closed under 480px, and the speed button keeps one width: verified (source).
  • The timeline, times and control row stay left to right: verified (right-to-left tests).
  • Controls a platform cannot honor are not rendered: verified (source).
  • AudioPlayer sits in a Section with artwork, 15 and 30 s skips, a speed toggle and slider, track controls and the system media controls: verified (tests, source).
  • Glyphs resolve through media:* keys with bundled Lucide drawings: verified (mediaIcons.tsx).
  • 44 family tests pass: verified.
  • Changeset: discovery lists the players and parts: verified; the useMediaPlayer hook: false.

Files (33):

  • VideoPlayer.tsx, MediaPlayerContext.ts, mediaStore.ts, MediaPlayer.tsx, AudioPlayer.tsx, MediaPlayerControls.tsx: findings above.
  • .changeset/lab-media-player-cli-discover.md, apps/sandbox/perf/scenes.perf.spec.ts: findings above.
  • MediaPlayerElement.tsx, mediaIcons.tsx, the folder index.ts, MediaPlayer.test.tsx, MediaPlayer.doc.mjs, packages/lab/src/index.ts: clear.
  • docs/specs/components/MediaPlayer/MediaPlayer.spec.md: unchanged since the owner's approval; waits on approval at this head.
  • The six packages/lab/blocks players and their six docs: clear.
  • apps/storybook/stories/MediaPlayer.stories.tsx, apps/docsite/scripts/generate-data.mjs, apps/docsite/src/__tests__/data-extraction.test.ts, packages/cli/test/swizzle-proof/samples.mjs: clear.
  • packages/cli/assets/discover/official-packages.json (generated; its check test passes) and internal/shadcn-registry/routes.lock.json (generated; one entry per new page): clear.

Automated review (maintainer link)

- VideoPlayer lays out caption cues through callback refs on the video
  and the bar, so no element sits in React state.
- Each media store checks once whether script can set the volume, not on
  every media event.
- useMediaPlaybackTime starts its frames from each reported time inside
  the frame Effect, with no Effect that only copies a value.
- The latest playback callbacks and track handlers reach their listeners
  through useCommittedRef.
- A slider reveal opens under a coarse primary pointer, as the container
  reveal does, so no empty column shows beside Mute when a touchscreen
  laptop is used with a mouse.
- The parts read a shared context, so a swizzled part reads the
  package's MediaPlayer.
- The CLI changeset no longer says discovery lists the useMediaPlayer
  hook, and an unrelated formatting change to a sandbox spec leaves this
  pull request.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approval waits on an engineering owner's decision: the draft component:MediaPlayer record is unchanged since it was approved, but an approval counts only for the exact head it names, so an engineering owner records the decision for this head by commenting /approve-spec a87456ee3e036b5a9237a5c7d2f56afd78a20539 (the author may do so if they are an engineering owner). This round fixes eight of the ten earlier items, and two fixes are still required either way.

Required either way

  • The speed menu and marker popover load on every page with a media part, 30.7 KB gzip of first-load JavaScript by the description's own measurement against the 0.3 KB an unused optional feature may cost, so load them on first use or behind their own import (MediaPlayerControls.tsx:30-37).
  • The slider column still repeats the shared container reveal's hover, focus and coarse-pointer conditions by hand, so extend useContainerReveal with a collapsing width reveal and drop the copy (MediaPlayerControls.tsx:264-308).

Smaller comment cleanups (two stranded JSDoc blocks and two "See above." comments) are optional.

Claims and files checked

Review mode: full; reason: author-not-engowner

Claims:

  • 12 new Lab components and 2 hooks, with no existing export changed: verified (packages/lab/src/index.ts).
  • No new strings, since the media strings already exist on main: verified (the base catalog has them; the diff does not touch it).
  • No theme package changes, glyphs through media:* keys with bundled drawings, and a regenerated CLI discovery list: verified (mediaIcons.tsx, the official-packages check passes).
  • One docsite group, and hook entries skipped in the preview registry: verified (MediaPlayer.doc.mjs, generate-data.mjs).
  • Shortcuts are announced and never fire in a text field or from a marker popover: verified (tests).
  • The bar sits 8px inside with the element and container radii, hides after 2 s idle, and holds for keyboard focus but not pointer focus: verified (VideoPlayer.tsx, tests, Chromium).
  • A tap shows the controls and the next tap hides them, and a mouse click plays and pauses: verified (tests, VideoPlayer.tsx:225-243).
  • The large play control is pointer-only and the spinner is hidden from assistive technology: verified (VideoPlayer.tsx:264-281, tests).
  • The timeline draws buffering, chapters and markers, speaks markers within 2.5 s, opens marker popovers, ignores the pointer while the bar is hidden, and reads its position once per hover: verified (source, tests, Chromium).
  • Captions sit one inset above the bar and keep that line when it hides: verified (Chromium).
  • The sliders open beside their buttons under the shared reveal's conditions, stay closed under 480px, and the speed button keeps one width: verified (source, Chromium).
  • The timeline, times and control row stay left to right: verified (right-to-left tests).
  • Controls a platform cannot honor are not rendered: verified (source).
  • AudioPlayer sits in a Section with artwork, 15 and 30 s skips, a speed button and slider, track controls and the system media controls: verified (tests, source).
  • 45 family tests pass: verified.
  • First-load cost of the speed menu and marker popover: verified as reported; it is the first required fix above.
  • Changeset: discovery lists the players and parts: verified (official-packages.json).

Files (32):

  • MediaPlayerControls.tsx: findings above.
  • VideoPlayer.tsx, MediaPlayer.tsx, MediaPlayerContext.ts, mediaStore.ts, AudioPlayer.tsx, MediaPlayerElement.tsx, mediaIcons.tsx, the folder index.ts, MediaPlayer.test.tsx, MediaPlayer.doc.mjs, packages/lab/src/index.ts: clear (the optional comment cleanups above sit in MediaPlayerContext.ts and AudioPlayer.tsx).
  • docs/specs/components/MediaPlayer/MediaPlayer.spec.md: unchanged since the owner's approval; waits on approval at this head.
  • The six packages/lab/blocks players and their six docs: clear.
  • apps/storybook/stories/MediaPlayer.stories.tsx, apps/docsite/scripts/generate-data.mjs, apps/docsite/src/__tests__/data-extraction.test.ts, packages/cli/test/swizzle-proof/samples.mjs, .changeset/lab-media-player-cli-discover.md: clear.
  • packages/cli/assets/discover/official-packages.json and internal/shadcn-registry/routes.lock.json (generated): clear.

Automated review (maintainer link)

@ernestt
ernestt merged commit e2b63ae into main Nov 19, 2026
378 of 435 checks passed
cixzhang added a commit that referenced this pull request Nov 19, 2026
… own new components

A new Lab component without a swizzle sample now fails its own pull request instead of main (the #9832 case: main unit tests red for 34 min until #12991).
cixzhang added a commit that referenced this pull request Nov 19, 2026
…est.mjs)

Per CI&R: the guard that fired on #9832 is the by-name samples.test.mjs check; the Lab lane always runs it, reading the Lab package samples. The full render stays on release checks.
@github-actions
github-actions Bot deleted the lab-media-player branch November 20, 2026 06:06

This branch was successfully deployed

1 active deployment
Preview — a87456ee Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants