-
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
Why plugins are Placed after the full-screen button at the end? #2731
Comments
I think that if #2540 gets finished and merged you can do what you want. Another option is to specify the whole child-order during player setup: videojs('id', {
controlBar: {
children: [
'playToggle',
'muteTogle',
/* etc */
'yourPlugin',
'fullscreenToggle'
]
}
}); Not sure about another way, besides manually moving the element to the correct position. |
Thanks to @nickygerritsen This example works as expected, but only within the limits of the possibilities offered by the core. If I understand correctly?! I realize I may have to plugin will not be able placed children skip? I tried several variations, looked up https://github.com/videojs/video.js/blob/master/docs/guides/plugins.md... Or maybe there are other problems? But I did not get the plugin "Resolution Switcher" between the children? Or is there a problem? All tips and suggestions are welcome! |
@gkatsev's comment on that issue is the most relevant here. Plugins should be inserting themselves before or after the separator element, which is generally where people were inserting plugins anyway (after progress, before fullscreen, essentially). |
In my case I wanted to replace the chapters button with my own (including location). https://github.com/collab-project/videojs-record/blob/master/src/js/videojs.record.js#L333, apparently wanted to put the plugin at the very beginning of the control bar. I haven't seen an example of https://github.com/videojs/video.js/blob/master/src/js/control-bar/control-bar.js#L56 being implemented, but I am sure either heff push strategy or insertBefore will work. Is there a reason why plugins "should" only be inserted surrounding the control spacer? If order/location didn't matter, it would seem like the spacer would work well. |
It's because plugins generally don't really care about specific location only the general location and this lets plugins not really worry about interaction with other plugins. You could just insert your component after the spacer and be done with it. Of course, this won't necessarily apply to all plugins and components but insert around the spacer should probably (and hopefully does) cover the 80% usecase of adding items to the control bar. |
What @gkatsev said. Also keep in mind that this is intended for general plugins that shouldn't need to know anything about the rest of the control bar (other than the existence of the spacer). If this is a plugin just for a specific implementation, you can make assumptions that we would prefer a plugin for "the wild" not make. — On Wed, Nov 4, 2015 at 5:46 PM, Gary Katsevman [email protected]
|
Going to close this as we have proposed solutions, plus, there's PRs out for inserting children at specific indexes, which should help as well. |
Hmm, slightly coming back to this... What about overriding addChild() in control-bar.js to automatically add components after the customcontolspacer (if present) ? Wouldn't that be the most logical thing to do in this case regardless ? The easiest to use for plugin developers ? |
Is it a mistake or a natural process?
I think the fullscreen button should be the last. Plugins should in my view be placed between screenhots as shown here?!
Or is it some kind of trick or recommendations to change the order? Thank you in advance!
The text was updated successfully, but these errors were encountered: