-
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(player): add playerreset event #5335
Conversation
this.loadTech_(this.options_.techOrder[0], null); | ||
this.techCall_('reset'); | ||
if (isEvented(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.
I don't think this check is necessary because the Player will always has event handling.
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.
Player starts html5 tech and then resets test fails without it. It does not make a lot of sense though
@@ -768,8 +772,14 @@ class Player extends Component { | |||
|
|||
this.fluid_ = !!bool; | |||
|
|||
if (isEvented(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.
same here, isEvented check isn't needed.
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.
Fluid is called first time before the player is evented.
src/js/player.js
Outdated
this.loadTech_(this.options_.techOrder[0], null); | ||
this.techCall_('reset'); | ||
if (isEvented(this)) { | ||
this.trigger('vjs_reset'); |
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 think the best name for this may be playerreset
. We already have precedent with the playerresize
event.
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.
ok
src/js/player.js
Outdated
@@ -404,6 +405,9 @@ class Player extends Component { | |||
// Make this an evented object and use `el_` as its event bus. | |||
evented(this, {eventBusKey: 'el_'}); | |||
|
|||
if (this.fluid_) { | |||
this.on('vjs_reset', this.updateStyleEl_); |
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.
so, the idea is to rerun updateStyleEl_
when reset is called? Makes sense to me.
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.
so, fluid
gets called in createEl
so, I'm not sure we actually need this here. We can probably get away with just the piece inside the fluid
method.
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.
Fluid is called first time before createEl, player is not evented yet. So no listener. Thats why the listener need to be added after createEl. I will take a look if first time fluid can move after player evented, but a delayed listener also seems a viable solution for me.
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 see, 🤔
…vented is inited, or run immediately when object is evented.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
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
The test failures are unrelated, merging anyway. We will not do a release if tests continue failing. |
Passed in master https://travis-ci.org/videojs/video.js/builds/451039377 |
Description
Added a reset event trigger to reset method. Use this event to reset a fluid player.
Specific Changes proposed
In reset() method a 'vjs_reset' event is being triggered. In fluid() method event listener is being initialialised.
Because the first time fluid() runs player is not "evented" yet, the listener is initialised after player is evented. Maybe it would be better to add the event as "delayed" and after player is "evented" init all "delayed" events.
Requirements Checklist