ReferencePlayer
createPlayer
Factory function that creates a typed player element and controller for HTML custom elements
Import
createPlayer is the entry point for custom HTML player compositions. It accepts a features array and returns the configured PlayerElement, a PlayerController already bound to that player, and playerContext as a lower-level escape hatch. Import ContainerElement separately when you need a custom container.
PlayerElement and PlayerController are scoped to the created player’s feature set. The element owns its store and attachment lifecycle; the configured controller does not need a context argument. ContainerElement consumes the shared player context, so the same class works with any created player.
Use split elements (recommended for reusable skins/layouts):
Examples
Basic Usage
API Reference
Video
createPlayer(config): CreatePlayerResult<VideoPlayerStore>
Creates a typed HTML player class and bound controller.
Parameters
Return Value
Audio
createPlayer(config): CreatePlayerResult<AudioPlayerStore>
Creates a typed HTML audio player class and bound controller.
Parameters
Return Value
Generic
createPlayer<const Features extends AnyPlayerFeature[]>(config): CreatePlayerResult<PlayerStore<Features>>
Creates a typed HTML player class with custom features.