Skip to content

feat(player): add a fullscreen button to the preview player - #7726

Merged
jrusso1020 merged 2 commits into
heygen-com:mainfrom
robinebers:feat/player-fullscreen-button
Nov 16, 2026
Merged

jrusso1020 merged 2 commits into
heygen-com:mainfrom
robinebers:feat/player-fullscreen-button

Conversation

@robinebers

Copy link
Copy Markdown
Contributor

Why

A HyperFrames video embedded in a page plays at whatever size the page gives it. In a small preview, like a 512 × 268 side panel, the details are hard to see, and the player offers no way to make it bigger. People expect the fullscreen button they know from other video players, and it isn't there.

What changes

The control bar now ends with a fullscreen button.

  • Click it and the player fills the screen. The controls come with it, so play, pause, the timeline, volume and speed all still work.
  • Click it again or press Esc to put the player back in the page. Playback carries on.
  • The button always shows the right icon and name ("Full screen" or "Exit full screen"), however fullscreen ends.
  • It works from the keyboard like the other buttons.
  • It only appears where the page is allowed to go fullscreen. iPhone Safari has no fullscreen for page elements, and an iframe needs allow="fullscreen", so the button stays out of the bar there.
  • A page that doesn't want it adds disable-fullscreen (or sets player.disableFullscreen = true).
  • hyperframes play gets the button too, because its page uses the built-in controls.

Before

A player embedded at 512 × 268 with controls and sandbox-origin="opaque". The bar has play, timeline, time, volume and speed, and nothing that makes the video bigger.

Before: the control bar has no fullscreen button

After

The same embed. The bar ends with the fullscreen button.

After: the control bar ends with a fullscreen button

One click later the player fills the screen, controls included (Chrome, 1920 × 1080).

After: the player fills the screen with its controls

A 13-second screen recording shows a click into fullscreen, playback there, and Esc back to the page, where the video keeps playing.

Test plan

  • Unit tests added/updated. 10 new cases in controls.test.ts and hyperframes-player.test.ts cover where the button appears, its names and icons, changes it didn't cause, a refused request (no unhandled rejection, name unchanged), cleanup on destroy, and that its click doesn't play the video. bun run --cwd packages/player test passes all 589 tests.
  • Manual testing performed. Real fullscreen was checked by hand in a visible Chrome 157 window with real mouse and keyboard input, on the embed above. A click on the button fills the screen with the player, and play and pause work there. The Esc key brings the player back with its playback position, and the button reads "Full screen" again. Enter and Space on the focused button go in and out of fullscreen. The screen recording above shows the click, playback in fullscreen and Esc.
  • The existing player browser tests (test:browser-security, test:browser-box) and the Studio tests that turn on player controls still pass.
  • Player typecheck and build, oxlint, oxfmt, fallow, comment citations, comment ratchet, git diff --check and bun run verify:packed-manifests (with pnpm 10.17.1) pass.
  • Documentation updated. The README and docs/packages/player.mdx get the new controls wording, a disable-fullscreen row, one paragraph and the disableFullscreen property.
  • Comments follow CONTRIBUTING.md "Comments". The one new comment in source says why a refused request is safe to ignore.

Not checked: Safari, Firefox, and real iPhone and iPad devices.

How

  • The button calls requestFullscreen() on the <hyperframes-player> element, not on its iframe, so the controls in its shadow root stay on screen. When the player is already fullscreen it calls document.exitFullscreen().
  • It reads its state from player.matches(":fullscreen") on every fullscreenchange. That also covers a player inside another shadow root, where document.fullscreenElement names the outer host.
  • It is created only when document.fullscreenEnabled is true. A refused request still fires fullscreenerror on the player.
  • disable-fullscreen is one CSS rule (:host([disable-fullscreen]) .hfp-fullscreen-btn { display: none }), so it works at any time without a new observed attribute.
  • The icons are Material's fullscreen glyphs at 20 px, like the volume icons, and the names match the slideshow's fullscreen button in this package.
  • Raises the player's package size budget (packed 157,145 → 160,200, unpacked 541,601 → 549,500). With CI's pnpm 10.17.1, main packs to 158,705 bytes (544,891 unpacked) and this branch to 160,137 (549,402). The difference is about 1.3 KB in each of the three bundles and 575 bytes of README.

Related work

No issue or PR covers fullscreen for the embeddable player. #997 added a fullscreen preview to Studio's own player controls, and the slideshow in this package already has a fullscreen button. Like the speed menu (#241) and the volume control (#651), the button is on by default, and the opt-out attribute follows disable-click-to-play (#4505).

The button puts the whole player, controls included, in fullscreen and follows every
fullscreen change. Set disable-fullscreen to hide it.

It raises the player's package size budget. With pnpm 10.17.1, main packs to 158,705 bytes
(544,891 unpacked) and this branch to 160,137 (549,402).
@mintlify

mintlify Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit dfff1e4.

Approve preview

Bring the branch up to date with upstream main (b54f207).

The only conflict was the player line in scripts/package-size-budgets.json.
Upstream raised the player's packed budget to 159000 for the slideshow
island scan. The line now comes from a pnpm 10.17.1 measurement of the
merged tree, 160299 bytes packed and 549865 unpacked, rounded up to the
next 100.

@jrusso1020 jrusso1020 left a comment

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.

Thanks, this is clean and small.

  • Fullscreen behavior. createFullscreenButton (packages/player/src/controls.ts:55-78) calls requestFullscreen() on the host, so the shadow-root controls stay on screen. It re-reads :fullscreen on every fullscreenchange, so Esc, or any exit the button didn't start, keeps the icon and label right. The listener is removed in destroy() (:451); deleting that line fails your "removes its fullscreenchange listener on destroy" test.
  • Accessibility. It's a real <button type="button"> whose aria-label switches between "Full screen" and "Exit full screen", so Enter and Space work. disable-fullscreen uses display:none, which also takes it out of the tab order and the accessibility tree. stopPropagation keeps the click from also triggering click-to-play.
  • Safari. The button appears only when document.fullscreenEnabled is true. Safari 16.4+ has the unprefixed API and :fullscreen. Older Safari, with only the webkit prefix, gets no button rather than a broken one. That's a reasonable trade.
  • Callers. Studio doesn't use these controls. The other caller, cli play.ts:336, gets the button as described.
  • Tests and CI. The two test files pass (262), and CI is green (75 pass).

Nit: the body says the budget rises to 160,200 packed and 549,500 unpacked, but scripts/package-size-budgets.json:35-36 sets 160,300 and 549,900. Worth syncing one or the other.

Need ✅ · Size ✅ · Reuse ✅ (mute-button styles, slideshow labels) · Simpler ✅ · Structure ✅
Risk: low. It's additive, stays off where fullscreen isn't allowed, and has an opt-out attribute.

— Rames

@jrusso1020
jrusso1020 added this pull request to the merge queue Nov 16, 2026
Merged via the queue into heygen-com:main with commit 5be6c15 Nov 16, 2026
90 checks passed
robinebers added a commit to robinebers/hyperframes that referenced this pull request Nov 16, 2026
Keep both sides where heygen-com#7726 (fullscreen button) and this branch both
changed the player controls: the icon slot helper and the fullscreen
button helper sit side by side in controls.ts, and controls.test.ts
keeps both the glyph slot tests and the fullscreen tests.

Resolve the scripts/package-size-budgets.json conflict on the
@hyperframes/player line from a measurement of this merged tree with
pnpm 10.17.1, the version CI uses: the player packs to 161371 bytes
packed and 553009 unpacked, so its budget is 162000 and 554000.
robinebers added a commit to robinebers/hyperframes that referenced this pull request Nov 16, 2026
Brings the branch up to date with upstream main at 95e4e7f, which
adds the fullscreen button (heygen-com#7726) and the preview-freeze fix (heygen-com#7795).

Two files conflicted, both by appending to the same place:
- packages/player/src/controls.test.ts: this branch's scrubbing tests
  and main's fullscreen tests each added a describe block at the end.
  Both are kept.
- scripts/package-size-budgets.json: the player budget. Packed with
  pnpm 10.17.1 as CI packs it, the merged player is 160733 bytes packed
  and 550893 unpacked; main's own player is 160355 and 550015. The
  packed budget is the merged size rounded up to the next hundred,
  160800. The unpacked size stays inside its budget's 1% allowance.
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.

2 participants