-
Notifications
You must be signed in to change notification settings - Fork 7.5k
feat: add enableResponsiveFullscreen option for aspect-ratio-aware fullscreen #9143
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
base: main
Are you sure you want to change the base?
Conversation
Add responsive fullscreen support and log options
|
Hi @mister-ben and @amtins, I’d appreciate your review on this feature. |
|
@mister-ben I noticed you run a workflow for and it cancelled please can you try again and see ?. |
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.
- "Videos taller than wide open fullscreen in portrait orientation" won't always be true. Some tablets' default orientation is landscape. If a phone or tablet is already landscape when going to fullscreen, default or not, this won't lock to portrait. Would you want the device to lock to portrait orientation in that case, or not, or should that be a separate option?
- I don't love calling this "responsive" because it's such an overloaded term. It's already used within Video.js to refer to conditional layouts based on player size, so it could be confusing.
- Use
targetPlayer.videoHeight()rather thantargetPlayer.el_.querySelector('video').videoHeight. Although it's less common now, there are playback techs that don't use a video element. Same forvideoWidth. - Run
npm lintand resolve the errors. The tests won't run if this doesn't pass. One of the problems isconsole.warn()- you can usevideojs.log.warn()instead. - Can a test be added?
- fullscreen.html shouldn't be checked in. It will be generated from fullscreen.html.example.
- Introduced a check for responsive fullscreen capability in the Player class. - Added logic to lock screen orientation to landscape if the video is in portrait mode and responsive fullscreen is enabled. - Included a console log to output the options during player initialization for debugging purposes.
… class. Added logic to lock screen orientation to landscape if the video is in portrait mode and responsive fullscreen is enabled. Included a console log to output the options during player initialization for debugging purposes. Description Please describe the change as necessary. If it's a feature or enhancement please be as detailed as possible. If it's a bug fix, please link the issue that it fixes or describe the bug in as much detail. Specific Changes proposed Please list the specific changes involved in this pull request. Requirements Checklist Feature implemented / Bug fixed If necessary, more likely in a feature request than a bug fix Change has been verified in an actual browser (Chrome, Firefox, IE) Unit Tests updated or fixed Docs/guides updated Example created (starter template on JSBin) Has no DOM changes which impact accessiblilty or trigger warnings (e.g. Chrome issues tab) Has no changes to JSDoc which cause npm run docs:api to error Reviewed by Two Core Contributors
Fix/fullscreen error
|
Hello @mister-ben This feature does not lock or force OS-level orientation. If a phone or tablet is already in landscape when entering fullscreen (whether that’s the device’s natural orientation or due to rotation lock), fullscreen remains landscape. Portrait fullscreen is only applied as a layout preference on devices that support rotation and are already in (or rotate into) portrait. On desktops/laptops and other non-rotatable environments, fullscreen always remains landscape regardless of video aspect ratio; portrait videos are simply letterboxed or scaled to fit, similar to VLC’s behavior. On naming: I agree that “responsive” is overloaded in Video.js. I’m happy to rename the and for the and i have resolved all the errors with |
|
Hi @mister-ben and @amtins, I’d appreciate your review on this feature. |
|
@mister-ben here is the video on how it works. Screen_Recording_20260109_165336.mp4 |
This PR introduces a new optional player configuration flag:
enableResponsiveFullscreen.When enabled, the player automatically adjusts fullscreen orientation
based on the video’s dimensions:
This improves the fullscreen experience for portrait videos (e.g. mobile
recordings, shorts, social media content) without affecting existing
behavior by default.
Usage Example
Key Points
Motivation
Many modern platforms host both landscape and portrait videos.
Forcing all videos into landscape fullscreen can lead to poor UX,
letterboxing, or awkward scaling.
This feature allows Video.js to adapt fullscreen orientation
intelligently while remaining backward compatible.
Checklist