Skip to content
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

Closed
kukrik opened this issue Oct 23, 2015 · 9 comments
Closed

Why plugins are Placed after the full-screen button at the end? #2731

kukrik opened this issue Oct 23, 2015 · 9 comments

Comments

@kukrik
Copy link

kukrik commented Oct 23, 2015

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?!

viga

Or is it some kind of trick or recommendations to change the order? Thank you in advance!

@nickygerritsen
Copy link
Contributor

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.

@kukrik
Copy link
Author

kukrik commented Oct 27, 2015

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!

@chemoish
Copy link
Member

@kukrik related #2534

@mmcc
Copy link
Member

mmcc commented Nov 4, 2015

@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).

@chemoish
Copy link
Member

chemoish commented Nov 4, 2015

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.

@gkatsev
Copy link
Member

gkatsev commented Nov 5, 2015

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.

@mmcc
Copy link
Member

mmcc commented Nov 5, 2015

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. 


Sent from mobile

On Wed, Nov 4, 2015 at 5:46 PM, Gary Katsevman [email protected]
wrote:

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.

Reply to this email directly or view it on GitHub:
#2731 (comment)

@gkatsev
Copy link
Member

gkatsev commented Nov 17, 2015

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.

@gkatsev gkatsev closed this as completed Nov 17, 2015
@hartman
Copy link
Contributor

hartman commented Dec 19, 2015

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 ?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants