Repository navigation
feat(player): add a fullscreen button to the preview player - #7726
Open
robinebers wants to merge 1 commit into
Open
robinebers wants to merge 1 commit into
robinebers wants to merge 1 commit into
Conversation
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).
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
3 of 4 tasks
This branch has not been deployed
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.
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.
allow="fullscreen", so the button stays out of the bar there.disable-fullscreen(or setsplayer.disableFullscreen = true).hyperframes playgets the button too, because its page uses the built-in controls.Before
A player embedded at 512 × 268 with
controlsandsandbox-origin="opaque". The bar has play, timeline, time, volume and speed, and nothing that makes the video bigger.After
The same embed. The bar ends with the fullscreen button.
One click later the player fills the screen, controls included (Chrome, 1920 × 1080).
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
controls.test.tsandhyperframes-player.test.tscover 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 testpasses all 589 tests.test:browser-security,test:browser-box) and the Studio tests that turn on player controls still pass.git diff --checkandbun run verify:packed-manifests(with pnpm 10.17.1) pass.docs/packages/player.mdxget the newcontrolswording, adisable-fullscreenrow, one paragraph and thedisableFullscreenproperty.Not checked: Safari, Firefox, and real iPhone and iPad devices.
How
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 callsdocument.exitFullscreen().player.matches(":fullscreen")on everyfullscreenchange. That also covers a player inside another shadow root, wheredocument.fullscreenElementnames the outer host.document.fullscreenEnabledis true. A refused request still firesfullscreenerroron the player.disable-fullscreenis one CSS rule (:host([disable-fullscreen]) .hfp-fullscreen-btn { display: none }), so it works at any time without a new observed attribute.mainpacks 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).