---
title: ProviderMixin
description: Mixin that creates the player store and manages the full media attach lifecycle
---
import UtilReference from "@/components/docs/api-reference/UtilReference.astro";
import DocsLink from "@/components/docs/DocsLink.astro";
`ProviderMixin` creates a class that owns the player store and the media attach lifecycle. It publishes the store to context so descendants can consume it, and calls `store.attach()` when both a media element and a container are available.
### Store lifecycle
The store is created when the element is constructed. On `connectedCallback`, the mixin publishes three context values to its descendants:
{/* TODO: link context keys to concept page once written (https://github.com/videojs/v10/issues/1033) */}
- **`playerContext`** — the store, consumed by `PlayerController` and other controllers
- **`mediaContext`** — a setter callback for media elements to register themselves
- **`containerContext`** — a setter callback for container elements to register themselves
When a media element and a container both register, the provider calls `store.attach({ media, container })`. If no media element registers via context within a [microtask](https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide), the provider falls back to `querySelector('video, audio')` to support plain `