-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
feat: Add breakpoints option to support toggling classes based on player width. #5471
Conversation
Updating that now. I had local changes that were not reflected there yet. |
Looks like stuff like caption buttons get removed in vjs-layout-small, I think it may be better to hide those buttons in x-small and less but still hide the time displays. |
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.
Would be good to add unit tests as well. Otherwise, this is great!
docs/guides/options.md
Outdated
`vjs-layout-x-large` | 1441-2560 | ||
`vjs-layout-huge` | 2561+ | ||
|
||
These can be overridden by passing an **ordered** array that looks like this: |
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.
would it be better to just have an object?
{
tiny: 210,
xmall: 320,
small: 425,
medium: 768.
large: 1140,
xlarge: 2560
}
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.
That is, instead of having custom class names as an option, only have the main ones we support
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.
Gotcha, that could make sense. We define the order by class name and then it can be configured via an object where ordering does not matter. I like it. 👍
<link href="../dist/video-js.css" rel="stylesheet" type="text/css"> | ||
<script src="../dist/video.js"></script> | ||
<script src="../node_modules/videojs-flash/dist/videojs-flash.js"></script> |
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.
We should leave flash here as it makes it easier to test with since it's already set up. At least for a bit longer still.
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.
Well, my thought was that we have a flash.html.example
so it would be confusing as to why it was identical to index.html.example
.
src/js/player.js
Outdated
* | ||
* @private | ||
*/ | ||
updateCurrentBreakpoint() { |
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.
if this should be a private method, it should get a postfixed _
Also, the fullscreen button in x-tiny moves right next to the play toggle, I'd expect it to stay pinned to the right |
Pffft, tests. 😛 (Yeah, I'll do that, got sidetracked) |
Some things I noticed:
|
This is a consequence of the class name highlighting being based on CSS media queries and the |
Looks like the issue with the second one was that of expectations and there's been an update to better explain it on the page. |
887f6cc
to
57f53c1
Compare
src/css/components/_control-bar.scss
Outdated
@@ -12,7 +12,7 @@ | |||
|
|||
// Video has started playing | |||
.vjs-has-started .vjs-control-bar { | |||
@include display-flex; | |||
@include display-flex(flex-start, space-between); |
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 change to the justification should be fine. For all sizes except tiny, the progress bar fills all available space, making the justification pretty much irrelevant. This seems like the right value for other use-cases (without a progress bar).
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.
I wonder if the issue is that the spacer has different settings applied to it in tiny mode:
.vjs-custom-control-spacer { @include flex(auto); }
&.vjs-no-flex .vjs-custom-control-spacer { width: auto; }
I'd be more comfortable fiddling with those properties over this one, at first at least.
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.
Ah, sure.
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.
Awesome, glad we finally have this!
Follow-up for #5471 This makes the breakpoints option and `breakpoints()` method clearer and introduces the responsive option and `responsive()` method, which will turn on the breakpoints. The return value of `currentBreakpoint()` was simplified to only ever return a string (empty if none). Also, added convenience methods: `responsive()`, `getBreakpointClass()`, and `currentBreakpointClass()`.
…yer width. (#5471) This adds a breakpoints option. By default, this option is false meaning this is an opt-in feature. When passing true, it will use a default set of breakpoints. Or custom breakpoints can be passed if users do not like our breakpoints (or previously-existing style decisions). - Add breakpoints option. - Adds some new (currently unused) classes: vjs-layout-medium, vjs-layout-large, vjs-layout-x-large, and vjs-layout-huge. - Add updateCurrentBreakpoint and currentBreakpoint methods to the player. - Update css/components/_adaptive.scss - Add sandbox/responsive.html.example Closes #4371
Follow-up for #5471 This makes the breakpoints option and `breakpoints()` method clearer and introduces the responsive option and `responsive()` method, which will turn on the breakpoints. The return value of `currentBreakpoint()` was simplified to only ever return a string (empty if none). Also, added convenience methods: `responsive()`, `getBreakpointClass()`, and `currentBreakpointClass()`.
Hey, great feature! |
@axten yes, I've just been lazy and not releasing 6.x. I'll make sure to get to it this week. |
@gkatsev cool, many thanks! |
It would be cool to have it this week :) |
Oops, totally forgot. I'll be working on this right now. |
@axten 6.13.0 is now out as pre-release with this feature. Please check it out. |
Closes #4371
Description
This adds a
breakpoints
option. By default, this option isfalse
meaning this is an opt-in feature.When passing
true
, it will use a default set of breakpoints. Or custom breakpoints can be passed if users do not like our breakpoints (or previously-existing style decisions).Specific Changes proposed
breakpoints
option.vjs-layout-medium
,vjs-layout-large
,vjs-layout-x-large
, andvjs-layout-huge
.updateCurrentBreakpoint
andcurrentBreakpoint
methods to the player.css/components/_adaptive.scss
vjs-default-skin
which was no longer used anywhere. Removed it everywhere.sandbox/responsive.html.example
Requirements Checklist