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.
I don't think this check is necessary because the Player will always has event handling.
There was a problem hiding this comment.
Player starts html5 tech and then resets test fails without it. It does not make a lot of sense though
|
|
||
| this.fluid_ = !!bool; | ||
|
|
||
| if (isEvented(this)) { |
There was a problem hiding this comment.
same here, isEvented check isn't needed.
There was a problem hiding this comment.
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.
I think the best name for this may be playerreset. We already have precedent with the playerresize event.
src/js/player.js
Outdated
| evented(this, {eventBusKey: 'el_'}); | ||
|
|
||
| if (this.fluid_) { | ||
| this.on('vjs_reset', this.updateStyleEl_); |
There was a problem hiding this comment.
so, the idea is to rerun updateStyleEl_ when reset is called? Makes sense to me.
There was a problem hiding this comment.
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.
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.
…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. |
|
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