fix(studio): support web-component refs in useTimelinePlayer - #245
Merged
Merged
Conversation
miguel-heygen
force-pushed
the
fix/timeline-seek-web-component
branch
6 times, most recently
from
April 13, 2026 15:12
4348e11 to
866abf0
Compare
The studio's `useTimelinePlayer` hook returns an `iframeRef` that consumers attach to an `<iframe>` element. When consumers wrap the iframe in a custom element (e.g. `<hyperframes-player>`) that puts the iframe inside its shadow DOM, every `iframeRef.current.contentWindow` access returned `null` and `getAdapter()` silently failed — meaning timeline seek, play, pause, and `refreshPlayer` all became no-ops. Changes: - Add `resolveIframe(el)` helper that returns the underlying iframe whether the host is the iframe itself, a custom element with a shadow-DOM iframe, or a wrapper with a descendant iframe. - Export `resolveIframe` from the studio so consumers can pre-resolve the iframe before assigning it to `iframeRef`. - Internal `useTimelinePlayer` keeps the strict `HTMLIFrameElement` ref type, so existing consumers attaching directly to an `<iframe>` are unaffected. Also adds: - JSDoc on the player's `iframeElement` getter. - "Advanced: iframe access" docs section in `packages/player/README.md` and `docs/packages/player.mdx`. - Type-safety lint rules in `.oxlintrc.json` and a "Type-safety conventions" section in `CONTRIBUTING.md`. Backward compatible — App.tsx and NLELayout.tsx continue to work unchanged.
miguel-heygen
force-pushed
the
fix/timeline-seek-web-component
branch
from
April 13, 2026 15:15
866abf0 to
04db9f0
Compare
The new rules added 37 errors across 32 existing files — mostly legitimate `window as any` casts at browser-global and test-mock boundaries. Enabling them without fixing all violations breaks CI. Revert the `.oxlintrc.json` additions and soften the CONTRIBUTING.md wording to describe the convention without claiming lint enforcement (that enforcement will come in a follow-up PR that fixes all sites).
Merged
dahans-msft2
pushed a commit
to dahans-msft2/hyperframes
that referenced
this pull request
Aug 6, 2026
…com#245) * fix(studio): support web-component refs in useTimelinePlayer The studio's `useTimelinePlayer` hook returns an `iframeRef` that consumers attach to an `<iframe>` element. When consumers wrap the iframe in a custom element (e.g. `<hyperframes-player>`) that puts the iframe inside its shadow DOM, every `iframeRef.current.contentWindow` access returned `null` and `getAdapter()` silently failed — meaning timeline seek, play, pause, and `refreshPlayer` all became no-ops. Changes: - Add `resolveIframe(el)` helper that returns the underlying iframe whether the host is the iframe itself, a custom element with a shadow-DOM iframe, or a wrapper with a descendant iframe. - Export `resolveIframe` from the studio so consumers can pre-resolve the iframe before assigning it to `iframeRef`. - Internal `useTimelinePlayer` keeps the strict `HTMLIFrameElement` ref type, so existing consumers attaching directly to an `<iframe>` are unaffected. Also adds: - JSDoc on the player's `iframeElement` getter. - "Advanced: iframe access" docs section in `packages/player/README.md` and `docs/packages/player.mdx`. - Type-safety lint rules in `.oxlintrc.json` and a "Type-safety conventions" section in `CONTRIBUTING.md`. Backward compatible — App.tsx and NLELayout.tsx continue to work unchanged. * chore(lint): defer no-explicit-any rule; it broke existing codebase The new rules added 37 errors across 32 existing files — mostly legitimate `window as any` casts at browser-global and test-mock boundaries. Enabling them without fixing all violations breaks CI. Revert the `.oxlintrc.json` additions and soften the CONTRIBUTING.md wording to describe the convention without claiming lint enforcement (that enforcement will come in a follow-up PR that fixes all sites).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The studio's
useTimelinePlayerhook returns aniframeRefthat consumers attach to an<iframe>element. When consumers wrap the iframe in a custom element (e.g.<hyperframes-player>) that puts the iframe inside its shadow DOM, everyiframeRef.current.contentWindowaccess returnednullandgetAdapter()silently failed — meaning timeline seek, play, pause, andrefreshPlayerall became no-ops.Solution
resolveIframe(el)helper that returns the underlying iframe whether the host is:resolveIframefrom the studio so consumers can pre-resolve the iframe before assigning toiframeRef.useTimelinePlayercode keeps the strictHTMLIFrameElementref type — no breaking change.Docs
docs/packages/player.mdx— new "Advanced: iframe access" section showing theresolveIframepattern + a<Warning>callout for the silent-no-op gotcha.packages/player/README.md— same content for the npm package page.packages/player/src/hyperframes-player.ts— JSDoc on theiframeElementgetter so IDE hover surfaces the correct vs incorrect usage.Type-safety housekeeping
.oxlintrc.json— enableno-explicit-any,no-unnecessary-type-assertion,prefer-as-const(error) andno-non-null-assertion,no-confusing-non-null-assertion(warn).CONTRIBUTING.md— new "Type-safety conventions" subsection codifying the project's stance onascasts and!non-null assertions.Backward compatibility
Fully backward compatible — existing code attaching the ref to a regular
<iframe>(App.tsx, NLELayout.tsx) continues to work unchanged.Test plan
pnpm buildsucceeds for studio packageoxlintpasses on the changed files<hyperframes-player>JSX ref