ProviderMixin is a mixin factory that adds store ownership and context provision to a custom element class. The resulting element creates the player store and publishes it to descendant elements so that PlayerController and ContainerMixin instances can resolve it automatically.
ProviderMixin is returned by createPlayer pre-bound to the player context and store factory.
Signature
Usage
Creating a provider element
<video-player> that uses a PlayerController or ContainerMixin will automatically receive the store.
Split provider and container
UseProviderMixin on its own when the store owner is a different element from the one containing the media:
Composed element
Compose both mixins when a single element should own the store and host the media:Properties
The player store instance. Created lazily on first access. After
destroyCallback is called, a new store is created on next access.Store lifecycle
The store is initialized with the factory fromcreatePlayer and published to context on connectedCallback. On destroyCallback, the store is destroyed and the reference is cleared.
store is re-created lazily on the next access.
Lifecycle
connectedCallback— publishes the store to the element’s context so descendants can consume it.destroyCallback— callsstore.destroy()and clears the store reference.
The store is created eagerly at field initialization time (not lazily on
connectedCallback) so that imperative access to this.store works before the element is inserted into the DOM. If the store was destroyed by a previous destroyCallback, it is re-created lazily on the next store getter access.