-
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
Inherit tech 'features' from 'MediaTechController' #1412
Conversation
Use vjs.obj.create to inherit 'features' from 'MediaTechController.prototype.features'. Because we are inheriting, if the defaults change (prototype.features), we can receive these updates in our tech if we had not changed properties of features manually.
Can you test to make sure this works with the different uses of features? |
i.e. I think the html5 tech usage needs some modification |
ugh, sorry, i had actually stumbled upon this many months ago but wasn't sure about how to get a good use case for assigning i think @gkatsev's change does the same thing in a much less fragile way |
@heff I think it works correctly. I had a flash and an html player on the page and both work perfectly now. |
The use of features in the HTML5 tech before MediaTechController is called. video.js/src/js/media/html5.js Line 16 in 7f4e6eb
|
Alright, I'll take a look later tonight or tomorrow. |
@heff is there anything keeping those things happening before calling |
I just did a more thorough test with some android and ios devices as well and moving these 4 lines down to below the |
Yeah, I can't think of any problems with that. I wish those weren't in the init in the first place actually, but not sure if there's an easy way to do that now. |
Hm... never mind, moving those lines breaks things. |
Yeah, it doesn't work to move the setting below the MediaTechController call. |
It looks like it's probably because some of those settings need to be set before the createEl function that gets run in the Component init. It looks like a higher level refactor of features is needed. |
One way of fixing it is by passing the overrides in as an option to |
I think we'd still run into some complication with the defaults on MediaTech with the different Another option would be to promote these to direct prototype properties in some way. I think the object is only used for organization currently. |
Do you mean moving them to the prototype of |
Yeah. If we do that we can rely on standard prototype inheritance. If everything's added to MediaTech.prototype and Html5.prototype, not added in the init(), then we don't have to worry about |
Ok, I'll try it out. |
Looks like promoting it to the prototype works well. |
@@ -161,17 +162,15 @@ vjs.MediaTechController.prototype.onTap = function(){ | |||
*/ | |||
vjs.MediaTechController.prototype.setPoster = function(){}; | |||
|
|||
vjs.MediaTechController.prototype.features = { | |||
'volumeControl': true, | |||
vjs.MediaTechController.prototype[ 'volumeControl' ] = true; |
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.
I kept these as strings for now, but I can change it.
Oops, forgot to update tests. |
The rename was needed because otherwise |
Yeah, I was actually thinking we'd leave 'features' or something like it in the property name. |
Could you update this so it can merge with @dmlap's change? |
@gkatsev working on a release. Can you try to finish this up? |
This PR is now obsolete. See #1470. |
Use vjs.obj.create to inherit 'features' from
'MediaTechController.prototype.features'. Because we are inheriting, if
the defaults change (prototype.features), we can receive these updates
in our tech if we had not changed properties of features manually.
This fixes #1407.