-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
fix: reset to a play/pause button when seeking after ended #4614
Conversation
src/js/control-bar/play-toggle.js
Outdated
// depending on the current state | ||
this.removeClass('vjs-ended'); | ||
|
||
if (this.player_.paused()) { |
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 we're ended, we should already be paused, so, I think we can probably simply this. Maybe we can just call the handlePause
handler so we don't duplicate work?
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 was thinking about it, but it seemed a bit weird to be calling a function made for being called by events manually. If you don't see a problem with it. I can go ahead and do it though.
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.
probably ok? Can always pull it out into a separate function that both methods can call.
c40307e
to
97ac11c
Compare
97ac11c
to
4aad07d
Compare
@gkatsev updated |
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.
Code LGTM.
Needs to be tested, though.
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.
Tried it out and looks good to me but I think we should update the conditional.
src/js/control-bar/play-toggle.js
Outdated
*/ | ||
handleSeeked(event) { | ||
// check to see if the video has ended yet | ||
if (!this.hasClass('vjs-ended')) { |
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.
oh, we probably should use this.ended()
instead of checking the 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.
Yeah I guess that will work, should be this.player_.ended()
right?
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.
oops, yes, it's on the player
// remove the ended class | ||
this.removeClass('vjs-ended'); | ||
|
||
if (this.player_.paused()) { |
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.
why would we not be paused when we're ended?
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.
Without this check clicking the button (which causes a play and then a seek to 0) would cause the button to show up as a play button, even when the player is playing.
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, I see.
src/js/control-bar/play-toggle.js
Outdated
this.removeClass('vjs-paused'); | ||
this.addClass('vjs-playing'); | ||
|
||
if (!this.hasClass('vjs-playing')) { |
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.
why not just keep this as unconditional?
src/js/control-bar/play-toggle.js
Outdated
*/ | ||
handleEnded(event) { | ||
this.removeClass('vjs-playing'); | ||
this.addClass('vjs-ended'); | ||
|
||
if (!this.hasClass('vjs-ended')) { |
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.
why not just keep this as unconditional?
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.
moved them back to unconditional as this is already a check in addClass.
src/js/control-bar/play-toggle.js
Outdated
@@ -83,20 +105,33 @@ class PlayToggle extends Button { | |||
*/ | |||
handlePause(event) { | |||
this.removeClass('vjs-playing'); | |||
this.addClass('vjs-paused'); | |||
|
|||
if (!this.hasClass('vjs-paused')) { |
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.
why not just keep this as unconditional?
53daff5
to
777157c
Compare
777157c
to
d5b512f
Compare
Description
When seeking backwards after the video has ended, the
vjs-ended
class will remain on the video until play is pushed. This means the the play button will still show as a replay button, which seems incorrect to me.Specific Changes proposed
This PR removes
vjs-ended
on anyseeked
event on the player and resets the button into a play/pause state depending upon the player state.Requirements Checklist