Repository navigation
|
I was wondering if there is docs on creating a media button to add to the controls. And if there is an api to externally add buttons dynamically to any skin loaded. There doesnt seem to be an api for any of this. There is an exported MediaButtonElement but it's hard to track how its supposed to work as its over engineered and not simple like VJS8 components. It doesn't make any sense. The state stuff doesn't work in iife modules also. I've had to replicate it more simple using UIElement instead so far but there was a refactored change how the icons is setup so can't afford to keep changing that. |
Replies: 2 comments
|
What you ended up doing, extending
The IIFE problem is load order, not IIFE as such. A classic script runs before the deferred module that defines customElements.whenDefined('video-player').then(() => {
customElements.define('my-button', MyButtonElement);
});I reproduced this with @videojs/html 10.2.0. A |
|
Thanks for raising this. A few follow-ups on top of the answer above: State not arriving in IIFE builds is fixed in Adding buttons to a skin: we've deliberately not added a way to add controls into the packaged skins. They're meant to be used as they are, and their internal markup can change between releases as we add features or fix bugs. If you need anything beyond what they offer, the solution is to add the skin's source to your project with the shadcn CLI (Customize skins) and put your additional button in Icons: the skin source registers only the icons its own controls use, in
|
Thanks for raising this. A few follow-ups on top of the answer above:
State not arriving in IIFE builds is fixed in
@videojs/html@10.3.0(#9663). A custom element that connects before<video-player>is defined now gets its state once the player connects, so you no longer need thecustomElements.whenDefined('video-player')workaround after upgrading.Adding buttons to a skin: we've deliberately not added a way to add controls into the packaged skins. They're meant to be used as they are, and their internal markup can change between releases as we add features or fix bugs. If you need anything beyond what they offer, the solution is to add the skin's source to your project with the shadcn C…