refactor(core): move media predicates to core/media#1475
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for vjs10-site ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📦 Bundle Size Report🎨 @videojs/html — no changesPresets (7)
Media (8)
Players (3)
Skins (29)
UI Components (25)
Sizes are marginal over the root entry point. ⚛️ @videojs/react — no changesPresets (7)
Media (7)
Skins (26)
UI Components (20)
Sizes are marginal over the root entry point. 🧩 @videojs/core — no changesEntries (9)
🏷️ @videojs/element — no changesEntries (2)
📦 @videojs/store — no changesEntries (3)
🔧 @videojs/utils — no changesEntries (10)
📦 @videojs/spf — no changesEntries (3)
ℹ️ How to interpretAll sizes are standalone totals (minified + brotli).
Run |
…core/media Capability predicates (`isMediaPauseCapable`, `isMediaSeekCapable`, etc.) duck-type on the capability interfaces in `core/media/types` and don't depend on any DOM types, so they belong alongside the types they guard. DOM-side feature consumers now import these predicates directly from `core/media/predicate`. `dom/media/predicate.ts` keeps DOM-specific guards like `isQuerySelectorAllCapable`. This unblocks non-DOM consumers (e.g., react-native, future shims) from importing the predicates without pulling DOM types. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
`media.remotePlaybackAvailability` already resolves to `'unsupported'` when the remote-playback feature's `watchAvailability` rejects, so the extra `(globalThis as any).chrome` guard in CastButtonCore was both redundant and an `any` cast. Drop it and let the upstream availability state flow through unchanged. Tests no longer need to stub `globalThis.chrome`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
388ac38 to
3855729
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3855729. Configure here.
The replacement test added when removing the `globalThis.chrome` stub duplicated the existing "reflects unsupported availability" case. Drop it; the original test already covers the same code path now that the chrome global check is gone. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
||
| getState(): CastButtonState { | ||
| const media = this.#media!; | ||
| const castSupported = !!(globalThis as any).chrome; |
There was a problem hiding this comment.
where is this logic replaced? This is needed to prevent showing the cast button on Safari.
|
closed by #1705 |

Lifting predicates out of
dom/unblocks non-DOM consumers (react-native, future shims) from using them without pulling in DOM types. The cast button cleanup keeps a single source of truth for cast support detection (theremote-playbackfeature) and removes the onlyanycast incore/ui.Note
Low Risk
Primarily a refactor with import rewiring plus a small behavior change in cast availability reporting; risk is limited but could affect environments that previously relied on the
chromeheuristic.Overview
Moves the media capability/type-guard predicates (e.g.
isMediaPauseCapable,isMediaRemotePlaybackCapable,hasMetadata) fromdom/media/predicate.tsinto a newcore/media/predicate.ts, and updates DOM store features to import them from the core layer so non-DOM consumers can reuse the logic.Simplifies
CastButtonCoreto stop using a Chromium (globalThis.chrome) check and always surfaceremotePlaybackAvailabilityfrom media state; corresponding tests remove the chrome stubbing and the “unsupported outside Chromium” expectation.Reviewed by Cursor Bugbot for commit 66cb21c. Bugbot is set up for automated code reviews on this repo. Configure here.