-
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: allow progress controls to be disabled #4649
Conversation
Here's what I used: if (this.player.options_.controls) {
// progress control isn't used by this plugin
this.player.controlBar.progressControl.hide();
} |
Hm... I'm not sure we want this. Disabling built-ins like this seems really weird to me. Since I can see cases where you'd want the progress control but just disable seeking but right now this disables it completely, if I understand it correctly. |
Well the real issue here is @gkatsev there isn't a good way to disable dragging on the progress bar when you want to. Disabling clicks is easy enough. All that this PR does is disable interacting with the progress bar. It is still there and works as intended, you just cant use it to seek. |
Yeah, maybe this isn't that bad. We should either keep listening to Also, probably should just be called |
Maybe just hiding the mouse time display is best as another indicator that this is a "read-only" control would be better. |
All good ideas, I will implement them when I get some time. |
@@ -8,6 +8,10 @@ | |||
min-width: 4em; | |||
} | |||
|
|||
.video-js .vjs-progress-control.disabled { | |||
cursor: default; |
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 don't really want a pointer when its disabled
src/css/components/_progress.scss
Outdated
@@ -36,7 +40,7 @@ | |||
|
|||
// This increases the size of the progress holder so there is an increased | |||
// hit area for clicks/touches. | |||
.video-js .vjs-progress-control:hover .vjs-progress-holder { | |||
.video-js .vjs-progress-control:hover .vjs-progress-holder.enabled { | |||
font-size: 1.666666666666666666em; |
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 only want to increase the size on hover when enabled
this.off(doc, 'mouseup', this.handleMouseUp); | ||
this.off(doc, 'touchmove', this.handleMouseMove); | ||
this.off(doc, 'touchend', this.handleMouseUp); | ||
this.removeAttribute('tabindex'); |
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.
Don't allow tabbing to the slider when it is disabled
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.
Good call.
src/css/components/_progress.scss
Outdated
@@ -36,7 +40,7 @@ | |||
|
|||
// This increases the size of the progress holder so there is an increased | |||
// hit area for clicks/touches. | |||
.video-js .vjs-progress-control:hover .vjs-progress-holder { | |||
.video-js .vjs-progress-control:hover .vjs-progress-holder.enabled { |
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.
do we need an enabled
class? Can that just be the default and also have a disabled
class?
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.
sure we can do that
src/js/slider/slider.js
Outdated
} | ||
|
||
this.removeClass('disabled'); | ||
this.addClass('enabled'); |
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 don't think we need an enabled class, like mentioned earlier
this.off(doc, 'mouseup', this.handleMouseUp); | ||
this.off(doc, 'touchmove', this.handleMouseMove); | ||
this.off(doc, 'touchend', this.handleMouseUp); | ||
this.removeAttribute('tabindex'); |
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.
Good call.
@@ -40,6 +44,10 @@ | |||
font-size: 1.666666666666666666em; | |||
} | |||
|
|||
.video-js .vjs-progress-control:hover .vjs-progress-holder.disabled { |
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.
LGTM
Didn't want to open a new issue since this one seems to be quite close. Basically based on Slider.js:78 I should be able to call Although the method is called and all the events are set I'm currently trying to adapt danielcebrian/rangeslider-videojs to my needs so it will take some time to come up with some jsfiddle that shows this in action. |
Description
Sometimes you do not want the user to be able to use the progress controls, such as during an ad. It would be quite difficult to do this outside of video.js due to the complexity of it. I think that we should allow this within video.js.
Specific Changes proposed
Add functions to disable/enable progress controls
Requirements Checklist