Documentation Index
Fetch the complete documentation index at: https://mintlify.com/videojs/v10/llms.txt
Use this file to discover all available pages before exploring further.
createPlayer is the entry point for setting up a Video.js player with HTML custom elements. It accepts a configuration object with a features array and returns a typed PlayerController, context, ProviderMixin, ContainerMixin, and a create store factory.
Signature
createPlayer is overloaded for video, audio, and generic feature sets:
Parameters
Configuration object for the player factory.
Return value
Typed context object used to wire
PlayerController instances to the nearest provider element in the DOM tree.Factory function that creates a new store instance. Use this for imperative, out-of-tree access to the player store.
PlayerController class pre-bound to this player’s context. Pass it to custom element fields to subscribe to player state. See PlayerController.Mixin function that adds store ownership and context provision to a base element class. The resulting element creates the store lazily and publishes it to descendants. See ProviderMixin.
Mixin function that adds media discovery and auto-attachment to a base element class. The resulting element watches for
<video> and <audio> children and calls store.attach(). See ContainerMixin.Usage
Split provider and container (recommended)
Use separate elements for the store owner and the media region. This pattern gives the most flexibility for complex layouts.player.ts
index.html
Composed element
Apply both mixins to the same element when the store owner and media container should be the same node.player.ts
Imperative store access
Use thecreate factory to create a store instance outside the custom element tree.
player.ts
createPlayer returns the same PlayerController class regardless of call site. The context object is what scopes controllers to the correct provider. Keep the context reference from createPlayer and pass it to every PlayerController instance you create.