-
Notifications
You must be signed in to change notification settings - Fork 16
Add basic fullscreen support #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
christriants
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exciting to see! I left a few nitpicks / questions.
web/src/components/fullscreen.tsx
Outdated
| import { createEffect, createSignal, onCleanup } from "solid-js" | ||
|
|
||
| export const FullscreenButton = () => { | ||
| const [isActive, setIsActive] = createSignal(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit for descriptiveness:
const [isFullscreen, setIsFullscreen]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
| const handleFullscreenChange = () => { | ||
| setIsActive(!!document.fullscreenElement) | ||
| } | ||
|
|
||
| document.addEventListener("fullscreenchange", handleFullscreenChange) | ||
| onCleanup(() => document.removeEventListener("fullscreenchange", handleFullscreenChange)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One day, it would be awesome if we could set up these events and get fullscreen from a shared store. Long-term, we could want to use this is in other areas.
web/src/components/fullscreen.tsx
Outdated
| void videoElement?.requestFullscreen() | ||
| setIsActive(true) | ||
| } else { | ||
| void document.exitFullscreen() | ||
| setIsActive(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we catch and warn if this fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
| flex h-4 w-4 items-center justify-center rounded bg-transparent | ||
| p-4 text-white hover:bg-black/80 focus:outline-none | ||
| " | ||
| onClick={toggleFullscreen} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be cool to add a keyboard for toggling on/off this button, too! Maybe not in scope here, but f is generally the key used for going in and out of fullscreen when the player is focused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
| <> | ||
| <Fail error={error()} /> | ||
| <div class="relative aspect-video w-full"> | ||
| <div class="relative aspect-video w-full" id="video"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it doesn't preserve aspect ratio @christriants
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅ Setting the object-contain CSS property on the canvas did the trick
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome!
846badc to
3c34204
Compare
3c34204 to
c771d2d
Compare
|
Thanks for making those changes, even the nitpicks. Looks good to me. |


Simple fullscreen support
I tagged the canvas's parent div with a
ugly"video" id to handle UI controls in fullscreen. We should replace this once we have a custom web component for the entire element and use that instead.fullscreen1.mp4