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

Update vjs.Component.addChild to allow an index #2534

Closed
erikyuzwa opened this issue Sep 1, 2015 · 8 comments
Closed

Update vjs.Component.addChild to allow an index #2534

erikyuzwa opened this issue Sep 1, 2015 · 8 comments

Comments

@erikyuzwa
Copy link
Contributor

I'm trying to add "skip next" and "skip back" vjs.Buttons which are currently plugins that would be surrounding the Play button in the ControlBar Component.

the Component supports the addChild(child, [options]), but it would be nice to be able to inject a component at a specific index to help the re-arrangement in the DOM of controls that are rendered.

(my apologies if this is a FAQ)

@heff
Copy link
Member

heff commented Sep 1, 2015

#2477 is actually related to this one. It would make children an array, so a plugins could just manually insert itself in the children array before init.

But also no, there isn't a way to specify that today. If you'd be interested in helping add the option, that'd be cool. I could see the third argument of addChild be the index where you want to splice the child in.

@erikyuzwa
Copy link
Contributor Author

most excellent @heff thanks for the feedback. I'd love to take a shot.

@thijstriemstra
Copy link
Contributor

I'd also be interested in this.

@thijstriemstra
Copy link
Contributor

Maybe a new addChildAt?

@chemoish
Copy link
Member

+1

@chemoish
Copy link
Member

This is what I am currently doing.

let control_bar = this.player.getChild('controlBar');

let chapter_button = control_bar.getChild('chaptersButton');

let chapter_thumbnail_menu_button = new ChapterThumbnailMenuButton();

// add component to end of control bar
control_bar.addChild(chapter_thumbnail_menu_button);

// move component
control_bar.el().insertBefore(chapter_thumbnail_menu_button.el(), chapter_button.el());

Hope this helps as an alternative.

@gkatsev
Copy link
Member

gkatsev commented Oct 28, 2015

In 5.0 we also have a separator element you can use to insert before or after to make your components available on the right-ish or left-ish side of the control bar.

@gkatsev
Copy link
Member

gkatsev commented Mar 28, 2016

This has landed by #2540 in 5.7!

@gkatsev gkatsev closed this as completed Mar 28, 2016
@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

5 participants