-
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
Switched player.tech to tech_, to promote it as private #2590
Conversation
Sounds good to me. |
Just one question concerning this. How do I access a "non standard" tech function in a component with the tech being private? I want to access a function of a custom tech which is not a default function like How to eiter publish the function from within the tech or to access the function via some other way from the component? Thanks. :-) EDIT: Read the Component docs and I'm now using |
How are you adding a function to the player so that
this.player_.myFunction() isn't working? That should work, and is ok to do
because it's a private var of `this`.
If you have a specific feature you want to access on a tech, you should
submit and issue about it so we can find a way to make it work the same
across all techs the same way. If we start adding tech-specific functions,
it breaks the model where any plugin can work with any tech.
|
Here is the basic tech (very reduced) setup: (function() {
var Tech = videojs.getComponent('Tech');
var MyTech = videojs.extends(Tech, {
myFunction: function(){
return something;
}
});
videojs.registerComponent('MyTech', MyTech);
})(); Now in my Component (simple button, ES6), I can't access this function via |
In 5.0, the tech no longer has a reference to the player. But the player should still have |
Okay, thanks. :) |
Please don't use tech_ until you've at least submitted an issue about why you needed to use it and what the player is lacking. I haven't seen a usecase yet where we shouldn't be looking into how to expose the information at the player level, in a way that's consistent between techs (even if it's just reporting that the info/feature isn't supported). The consistency between techs is actually growing in importance for video.js users (and users of video.js plugins), so we need to keep being religious about that. |
lgtm |
closes #2060
Just changes player.tech to player.tech_ wherever it's used, because it's important to promote that the tech is a private reference that plugin authors shouldn't be using. This was mangled in 4.x, so should be ok to change.