-
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
add component to specific index #2540
Conversation
and tests
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED Commit: 80d8f26 (Please note that this is a fully automated comment.) |
A suggestion PR made here: https://github.com/erikyuzwa/video.js/pull/1 |
…th-index Minor changes to #2540
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: 19cad93 (Please note that this is a fully automated comment.) |
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: 0527665 (Please note that this is a fully automated comment.) |
We can keep this open until we can fix the last broken test. Not sure if you meant to close it. |
sounds good -- wasn't sure if you were getting annoying travis alerts or something because of the failed tests. ;) |
but is it 'right'?
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: d763d0e (Please note that this is a fully automated comment.) |
Yeah, the problem is we need the tech to be first, always, so that other components in the player overlap the video. The problem is we're adding the tech directly to the player element instead of using the |
leave it to me to find the trickiest thing to tweak. I'm hoping the end result is an approach that really benefits users. I'll take a look at the player then and use your advice as a roadmap, many thanks. |
Thanks for being patient. :) We'll get this figured out.
|
aye |
using the updated addChild to add our vjs-tech into our DOM children array
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: 0f02202 (Please note that this is a fully automated comment.) |
hey @heff, I know it's a crazy month - just wondering if you've had a chance to look at my latest commit to see if this is in the right direction. |
This PR makes me happy 😃. Anyway, aren't the tests missing stuff that tests the |
thanks @nickygerritsen 👍 - yes great point, I shall work at that to try and see this PR through |
@erikyuzwa any update on this :)? |
Btw, would you also consider adding Something like: addChildBefore(child, before, options={}) {
this.addChild(child, options, getChildIndex(before));
}
addChildAfter(child, after, options={}) {
this.addChild(child, options, getChildIndex(after) + 1);
}
getChildIndex(child) {
let component;
if (typeof child === 'string') {
component = this.getChild(child);
} else {
component = child;
}
let index = this.children_.indexOf(component);
if (index === -1) { /* Throw some error? */ }
return index;
} Or similar. I think it would make sense for something like this? Normally you want to insert a child at a given index because you want it to appear before / after some other component (actually exactly as you suggested in #2534). |
hey @nickygerritsen - hmm perhaps to try and keep this PR as "small" as possible (and in motion), I'd suggest creating a PR of your own once / if this one goes through. Ultimately it'd be up to @heff and the videojs team. |
Thanks @gkatsev - much appreciated. I'll take a look for that module. Once I find it, I might submit a PR on the readme to update that |
Yeah, the contributing.md is kind of outdated right now. It's on my TODO to update it. |
I get it. You're swamped, no worries. |
@@ -405,7 +406,9 @@ class Component { | |||
// Add the UI object's element to the container div (box) | |||
// Having an element is not required | |||
if (typeof component.el === 'function' && component.el()) { | |||
this.contentEl().appendChild(component.el()); | |||
var childNodes = this.contentEl().children; | |||
var refNode = childNodes[index] || undefined; |
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.
wouldn't oh, I see now that it would be pointing at the current position in the elements list so it would be exactly the item we want to use here.refNode
end up pointing at the current element?
Also, it would automatically get the value undefined
if childNodes[index]
doesn't exist. It would be better to use || null
.
@erikyuzwa hey, finally got around to reviewing it. Made a few comments. Thanks. |
oh awesome - my humble thanks @gkatsev - always looking to improving my output. I'll take a look at your comments. |
Thanks. LGTM. |
LGTM |
@erikyuzwa Thanks! |
And it's out in 5.7.0! (Not yet on the CDN, but available in github releases and npm as |
properly add overlay as a player component so that video.js will be aware of its existence when initializing additional components; not inserting those before the overlay unless specified otherwise. See videojs/video.js#2540 Fixes #11
and tests
@heff my humble apologies for a PR this way. I did attempt to use
contrib feature submit
as per docs, but I was getting an----->undefined
as a response after answering all the prompts.this corresponds with issue #2534