# Video.js v10 — HTML API (complete)
> Every HTML API page in one file (about 31k tokens). Index with descriptions: https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/llms.txt
---
# createPlayer
Factory function that creates a typed player element and controller for HTML custom elements
## Import
```ts
import { createPlayer } from "@videojs/html";
import { videoFeatures } from "@videojs/html/video";
```
`createPlayer` is the entry point for custom HTML player compositions. It accepts a `features` array and returns the configured `PlayerElement`, a [`PlayerController`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/player-controller) already bound to that player, and `playerContext` as a lower-level escape hatch. Import `ContainerElement` separately when you need a custom container.
**player.ts**
```ts
import { createPlayer, UIElement, selectPlayback } from '@videojs/html';
import { videoFeatures } from '@videojs/html/video';
const { PlayerElement: VideoPlayerElement, PlayerController } = createPlayer({
features: videoFeatures,
});
customElements.define('video-player', VideoPlayerElement);
// Control element with selector
class PlayButton extends UIElement {
#playback = new PlayerController(this, selectPlayback);
}
```
`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):
**player.ts**
```ts
import { ContainerElement, createPlayer } from '@videojs/html';
import { videoFeatures } from '@videojs/html/video';
const { PlayerElement: PlayerRoot } = createPlayer({ features: videoFeatures });
class PlayerRegion extends ContainerElement {}
```
## Examples
### Basic Usage
**index.html**
```html
PlayPause
```
**index.css**
```css
.demo-video-player media-container {
position: relative;
}
.demo-video-player media-container video {
width: 100%;
}
.media-play-button {
position: absolute;
bottom: 10px;
left: 10px;
padding-block: 8px;
padding-inline: 20px;
color: black;
cursor: pointer;
background: rgba(255, 255, 255, 0.7);
border: 1px solid rgba(255, 255, 255, 0.3);
border-radius: 9999px;
backdrop-filter: blur(10px);
}
.media-play-button .paused {
display: none;
}
.media-play-button .playing {
display: none;
}
.media-play-button[data-paused] .paused {
display: inline;
}
.media-play-button:not([data-paused]) .playing {
display: inline;
}
```
**index.ts**
```ts
import {
applyElementProps,
applyStateDataAttrs,
createButton,
createPlayer,
selectPlayback,
UIElement,
} from '@videojs/html';
import { videoFeatures } from '@videojs/html/video';
import '@videojs/html/ui/container';
const { PlayerElement: VideoPlayerElement, PlayerController } = createPlayer({
features: videoFeatures,
});
class PlayToggle extends UIElement {
static readonly tagName = 'demo-play-toggle';
readonly #player = new PlayerController(this, selectPlayback);
#disconnect: AbortController | null = null;
override connectedCallback(): void {
super.connectedCallback();
this.#disconnect = new AbortController();
const buttonProps = createButton({
onActivate: () => {
const state = this.#player.value;
if (!state) return;
state.paused ? state.play() : state.pause();
},
isDisabled: () => !this.#player.value,
});
applyElementProps(this, buttonProps, { signal: this.#disconnect.signal });
}
override disconnectedCallback(): void {
super.disconnectedCallback();
this.#disconnect?.abort();
this.#disconnect = null;
}
protected override update(changed: Map): void {
super.update(changed);
const state = this.#player.value;
if (!state) return;
applyStateDataAttrs(this, state, { paused: 'data-paused', ended: 'data-ended' });
}
}
customElements.define('demo-video-player', VideoPlayerElement);
customElements.define(PlayToggle.tagName, PlayToggle);
```
## API Reference
### Video
`createPlayer(config): CreatePlayerResult`
Creates a typed HTML player class and bound controller.
#### Parameters
| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `config` (required) | `{ features: [PlayerFeature, PlayerFeature, PlayerFeature, PlayerFeature, PlayerFeature, PlayerFeature, PlayerFeature, PlayerFeature, PlayerFeature, PlayerFeature, PlayerFeature, PlayerFeature, PlayerFeature, PlayerFeature, typeof metadataFeature] }` | — | Player configuration with features. |
#### Return Value
| Property | Type | Description |
| --- | --- | --- |
| `PlayerElement` | `typeof UIElement & (new (...args: any[]) => PlayerElement)` | Configured player element class that owns the store and attachment lifecycle. |
| `PlayerController` | `{ new (host: ReactiveControllerHost & HTMLElement): PlayerController; new (host: ReactiveControllerHost & HTMLElement, selector: Selector): PlayerController }` | Player controller bound to this player's context. |
| `playerContext` | `Context` | Context that carries the player store to descendant elements. |
### Audio
`createPlayer(config): CreatePlayerResult`
Creates a typed HTML audio player class and bound controller.
#### Parameters
| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `config` (required) | `{ features: [PlayerFeature, PlayerFeature, PlayerFeature, PlayerFeature, PlayerFeature, PlayerFeature, PlayerFeature, typeof metadataFeature] }` | — | Player configuration with features. |
#### Return Value
| Property | Type | Description |
| --- | --- | --- |
| `PlayerElement` | `typeof UIElement & (new (...args: any[]) => PlayerElement)` | Configured player element class that owns the store and attachment lifecycle. |
| `PlayerController` | `{ new (host: ReactiveControllerHost & HTMLElement): PlayerController; new (host: ReactiveControllerHost & HTMLElement, selector: Selector): PlayerController }` | Player controller bound to this player's context. |
| `playerContext` | `Context` | Context that carries the player store to descendant elements. |
### Generic
`createPlayer(config): CreatePlayerResult>`
Creates a typed HTML player class with custom features.
#### Parameters
| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `config` (required) | `{ features: Features }` | — | Player configuration with features. |
#### Return Value
| Property | Type | Description |
| --- | --- | --- |
| `PlayerElement` | `typeof UIElement & (new (...args: any[]) => PlayerElement>)` | Configured player element class that owns the store and attachment lifecycle. |
| `PlayerController` | `{ new (host: ReactiveControllerHost & HTMLElement): PlayerController>; new (host: ReactiveControllerHost & HTMLElement, selector: Selector['state'], Result>): PlayerController, Result> }` | Player controller bound to this player's context. |
| `playerContext` | `Context>` | Context that carries the player store to descendant elements. |
---
# PlayerController
Reactive controller for accessing player store state in HTML custom elements
## Import
```ts
import { PlayerController } from "@videojs/html/video";
```
`PlayerController` is a reactive controller that consumes the player store from `playerContext`. Without a selector it returns the store instance directly (no subscription — use this for actions). With a selector it returns the selected value and subscribes to changes, triggering a host update on shallow-equal change. Access the current value via `.value`, which returns `undefined` until connected to a player.
The controller exported by each preset, or returned by [`createPlayer`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/html-create-player), is already bound to that player’s context, so pass only the host and optional selector. The lower-level `PlayerController` exported from `@videojs/html` accepts the context as its second argument; its constructor signatures are documented below.
```ts
import { UIElement, selectPlayback } from '@videojs/html';
import { PlayerController } from '@videojs/html/video';
class PlayButtonElement extends UIElement {
readonly #playback = new PlayerController(this, selectPlayback);
}
```
## Examples
### Basic Usage
**index.html**
```html
Paused: Yes | Time: 0.0s | Volume: 100%
```
**index.css**
```css
.demo-ctrl-player media-container {
position: relative;
}
.demo-ctrl-player media-container video {
width: 100%;
}
.panel {
display: flex;
gap: 16px;
align-items: center;
padding: 12px;
background: rgba(0, 0, 0, 0.05);
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.actions {
display: flex;
gap: 6px;
}
.actions button {
padding: 4px 12px;
font-size: 0.8125rem;
color: #111827;
cursor: pointer;
background: white;
border: 1px solid #ccc;
border-radius: 6px;
}
.state {
font-size: 0.8125rem;
font-variant-numeric: tabular-nums;
color: #374151;
}
```
**index.ts**
```ts
import {
applyElementProps,
createButton,
createPlayer,
selectPlayback,
selectTime,
selectVolume,
UIElement,
} from '@videojs/html';
import { videoFeatures } from '@videojs/html/video';
import '@videojs/html/ui/container';
const { PlayerElement: DemoPlayerElement, PlayerController } = createPlayer({
features: videoFeatures,
});
class PlayerActions extends UIElement {
static readonly tagName = 'demo-ctrl-actions';
readonly #player = new PlayerController(this);
#disconnect: AbortController | null = null;
override connectedCallback(): void {
super.connectedCallback();
this.#disconnect = new AbortController();
const signal = this.#disconnect.signal;
const playBtn = this.querySelector('.play')!;
const pauseBtn = this.querySelector('.pause')!;
const volumeBtn = this.querySelector('.volume')!;
const bind = (el: HTMLElement, action: () => void) => {
const props = createButton({ onActivate: action, isDisabled: () => !this.#player.value });
applyElementProps(el, props, { signal });
};
bind(playBtn, () => this.#player.value?.play());
bind(pauseBtn, () => this.#player.value?.pause());
bind(volumeBtn, () => this.#player.value?.setVolume(0.5));
}
override disconnectedCallback(): void {
super.disconnectedCallback();
this.#disconnect?.abort();
this.#disconnect = null;
}
}
class PlayerState extends UIElement {
static readonly tagName = 'demo-ctrl-state';
readonly #playback = new PlayerController(this, selectPlayback);
readonly #time = new PlayerController(this, selectTime);
readonly #volume = new PlayerController(this, selectVolume);
protected override update(changed: Map): void {
super.update(changed);
const playback = this.#playback.value;
const time = this.#time.value;
const volume = this.#volume.value;
if (!playback) return;
const el = this.querySelector('.text');
if (el) {
el.textContent = `Paused: ${playback.paused ? 'Yes' : 'No'} | Time: ${(time?.currentTime ?? 0).toFixed(1)}s | Volume: ${Math.round((volume?.volume ?? 0) * 100)}%`;
}
}
}
customElements.define('demo-ctrl-player', DemoPlayerElement);
customElements.define(PlayerActions.tagName, PlayerActions);
customElements.define(PlayerState.tagName, PlayerState);
```
## API Reference
### Without Selector
`new PlayerController(host, context)`
#### Parameters
| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `host` (required) | `{ addController(controller: ReactiveController): void; removeController(controller: ReactiveController): void; requestUpdate(): void; updateComplete: Promise } & HTMLElement` | — | The host element that owns this controller. |
| `context` (required) | `Context` | — | Player context to resolve the store from. |
#### Return Value
| Property | Type |
| --- | --- |
| `value` | `Result \| undefined` |
| `displayName` | `string \| undefined` |
### With Selector
`new PlayerController(host, context, selector)`
#### Parameters
| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `host` (required) | `{ addController(controller: ReactiveController): void; removeController(controller: ReactiveController): void; requestUpdate(): void; updateComplete: Promise } & HTMLElement` | — | The host element that owns this controller. |
| `context` (required) | `Context` | — | Player context to resolve the store from. |
| `selector` (required) | `{ (state: Store['state']): Result; displayName?: string }` | — | Derives a value from the player store state. |
#### Return Value
| Property | Type |
| --- | --- |
| `value` | `Result \| undefined` |
| `displayName` | `string \| undefined` |
---
# Player store
Every state field and action on the player store, grouped by the feature that adds it
The player store combines the state and actions of every feature the player includes. A field or action exists only when its feature is included. This page lists the whole store; each feature’s reference page adds its selector and examples.
## Access
The player element exposes the store as `store`. State fields and actions are properties of the store, and `store.subscribe()` reports changes. `store.state` is a frozen snapshot of the current state, which is the object selectors take. Inside a custom element, [`PlayerController`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/player-controller) subscribes to a selection and updates its host.
```ts
const player = document.querySelector('video-player');
player.store.paused;
player.store.play();
const unsubscribe = player.store.subscribe(() => {
console.log(player.store.currentTime);
});
```
Each feature also exports a selector, such as `selectPlayback`, that returns its state and actions, or `undefined` when the player doesn’t include the feature. See [`createSelector`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/create-selector) to write your own.
## State and actions
Each feature links to the same entry on its reference page.
| Name | Type | Feature | Description |
| --- | --- | --- | --- |
| `paused` | `boolean` | [`playbackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-playback#playback-state-paused) | Whether playback is paused. |
| `ended` | `boolean` | [`playbackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-playback#playback-state-ended) | Whether playback has reached the end. |
| `started` | `boolean` | [`playbackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-playback#playback-state-started) | Whether playback has started (played or seeked). |
| `waiting` | `boolean` | [`playbackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-playback#playback-state-waiting) | Whether playback is stalled waiting for data. |
| `play` | `() => Promise` | [`playbackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-playback#playback-action-play) | Start playback. Updates `paused` immediately when the media starts. |
| `pause` | `() => void` | [`playbackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-playback#playback-action-pause) | Pause playback. Updates `paused` immediately. |
| `currentTime` | `number` | [`timeFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-time#time-state-currentTime) | Current playback position in seconds. |
| `duration` | `number` | [`timeFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-time#time-state-duration) | Total duration in seconds (0 if unknown). |
| `seeking` | `boolean` | [`timeFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-time#time-state-seeking) | Whether a seek operation is in progress. |
| `seek` | `(time: number) => Promise` | [`timeFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-time#time-action-seek) | Seek to a time in seconds. Returns the actual position after seek. |
| `volume` | `number` | [`volumeFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-volume#volume-state-volume) | Volume level from 0 (silent) to 1 (max). |
| `muted` | `boolean` | [`volumeFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-volume#volume-state-muted) | Whether audio is muted. |
| `volumeAvailability` | `'available' \| 'unavailable' \| 'unsupported'` | [`volumeFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-volume#volume-state-volumeAvailability) | Whether volume can be programmatically set on this platform. |
| `mutedAvailability` | `'available' \| 'unavailable' \| 'unsupported'` | [`volumeFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-volume#volume-state-mutedAvailability) | Whether the media can be muted. Separate from `volumeAvailability` because the two come apart: an embed can take a mute command while offering no way to set a level, and iOS Safari refuses a volume write on media that mutes perfectly well. |
| `setVolume` | `(volume: number) => number` | [`volumeFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-volume#volume-action-setVolume) | Set volume (clamped 0-1). Returns the clamped value. |
| `setMuted` | `(muted: boolean) => boolean` | [`volumeFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-volume#volume-action-setMuted) | Set the muted state, updating the store immediately. Unmuting at volume 0 restores volume to 0.25. Returns the new muted value. |
| `isFullscreen` | `boolean` | [`fullscreenFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-fullscreen#fullscreen-state-isFullscreen) | Whether fullscreen mode is currently active. |
| `fullscreenAvailability` | `'available' \| 'unavailable' \| 'unsupported'` | [`fullscreenFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-fullscreen#fullscreen-state-fullscreenAvailability) | Whether fullscreen can be requested on this platform. |
| `requestFullscreen` | `() => Promise` | [`fullscreenFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-fullscreen#fullscreen-action-requestFullscreen) | Enter fullscreen mode. Tries container first, falls back to media element. |
| `exitFullscreen` | `() => Promise` | [`fullscreenFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-fullscreen#fullscreen-action-exitFullscreen) | Exit fullscreen mode. |
| `userActive` | `boolean` | [`controlsFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-controls#controls-state-userActive) | Whether the user has recently interacted with the player. |
| `controlsVisible` | `boolean` | [`controlsFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-controls#controls-state-controlsVisible) | Whether controls should be visible. |
| `requestControlsLock` | `() => (() => void)` | [`controlsFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-controls#controls-action-requestControlsLock) | Keep controls visible during a sustained interaction. The returned function releases the lock. Multiple concurrent locks are supported and each release function is idempotent. |
| `toggleControls` | `(forceShow?: boolean) => boolean` | [`controlsFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-controls#controls-action-toggleControls) | Toggle controls visibility, or force it with `forceShow`. Returns the new `controlsVisible` value. |
| `buffered` | `[number, number][]` | [`bufferFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-buffer#buffer-state-buffered) | Buffered time ranges as \[start, end\] tuples. |
| `seekable` | `[number, number][]` | [`bufferFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-buffer#buffer-state-seekable) | Seekable time ranges as \[start, end\] tuples. |
| `textTrackList` | `MediaTextTrack[]` | [`textTrackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-text-tracks#textTrack-state-textTrackList) | All text tracks available on the media element. |
| `subtitlesShowing` | `boolean` | [`textTrackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-text-tracks#textTrack-state-subtitlesShowing) | Whether a captions/subtitles track is showing. |
| `chaptersCues` | `MediaTextCue[]` | [`textTrackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-text-tracks#textTrack-state-chaptersCues) | Cues from the first `kind="chapters"` track, with cue ends clamped to a finite media duration. |
| `thumbnailsTrack` | `{ cues: MediaTextCue[]; src: string \| null; crossOrigin: 'anonymous' \| 'use-credentials' \| null } \| null` | [`textTrackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-text-tracks#textTrack-state-thumbnailsTrack) | The first thumbnails track, or `null` when there is none. |
| `toggleSubtitles` | `(forceShow?: boolean) => boolean` | [`textTrackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-text-tracks#textTrack-action-toggleSubtitles) | Toggle captions/subtitles visibility. Showing enables one caption/subtitle track. A track already showing stays selected. Otherwise, selection prefers the last track shown, then a track matching the browser language, then the first available track. Returns whether a track is showing. |
| `selectSubtitlesTrack` | `(id: string \| null) => void` | [`textTrackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-text-tracks#textTrack-action-selectSubtitlesTrack) | Show the captions/subtitles track with `id`, or turn captions/subtitles off with `null`. |
| `playbackRates` | `readonly number[]` | [`playbackRateFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-playback-rate#playbackRate-state-playbackRates) | Available playback rates. |
| `playbackRate` | `number` | [`playbackRateFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-playback-rate#playbackRate-state-playbackRate) | Current playback rate. |
| `setPlaybackRate` | `(rate: number) => void` | [`playbackRateFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-playback-rate#playbackRate-action-setPlaybackRate) | Set the playback rate. |
| `isPictureInPicture` | `boolean` | [`pipFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-pip#pip-state-isPictureInPicture) | Whether picture-in-picture mode is currently active. |
| `pictureInPictureAvailability` | `'available' \| 'unavailable' \| 'unsupported'` | [`pipFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-pip#pip-state-pictureInPictureAvailability) | Whether picture-in-picture can be requested on this platform. |
| `requestPictureInPicture` | `() => Promise` | [`pipFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-pip#pip-action-requestPictureInPicture) | Enter picture-in-picture mode, exiting fullscreen first. Rejects before metadata is loaded. |
| `exitPictureInPicture` | `() => Promise` | [`pipFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-pip#pip-action-exitPictureInPicture) | Exit picture-in-picture mode. |
| `error` | `{ code: number; message: string } \| null` | [`errorFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-error#error-state-error) | The current media error, or null if none. |
| `dismissError` | `() => void` | [`errorFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-error#error-action-dismissError) | Dismiss the current error by clearing it. |
| `title` | `string` | [`metadataFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-metadata#metadata-state-title) | The resolved content title. Set it through the player, not through the store. |
| `poster` | `string` | [`metadataFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-metadata#metadata-state-poster) | The resolved poster URL, independent of the media element's own `poster`. Set it through the player, not through the store. |
| `currentSrc` | `string` | [`sourceFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-source#source-state-currentSrc) | Current media source URL (empty string if none). |
| `canPlay` | `boolean` | [`sourceFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-source#source-state-canPlay) | Whether enough data is loaded to begin playback. |
| `videoRenditionList` | `MediaVideoRendition[]` | [`qualityFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-quality#quality-state-videoRenditionList) | Video renditions available for manual quality selection. |
| `activeVideoRendition` | `{ id: string; width?: number; height?: number; bitrate?: number; frameRate?: number; codec?: string; selected: boolean } \| null` | [`qualityFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-quality#quality-state-activeVideoRendition) | Video rendition currently playing, including when automatic ABR is selected. |
| `selectVideoRendition` | `(id: string) => void` | [`qualityFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-quality#quality-action-selectVideoRendition) | Select a video rendition by `id`, or automatic ABR with `"auto"`. |
| `audioTrackList` | `MediaAudioTrack[]` | [`audioTrackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-audio-track#audioTrack-state-audioTrackList) | Audio tracks available for manual track selection. |
| `selectAudioTrack` | `(id: string) => void` | [`audioTrackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-audio-track#audioTrack-action-selectAudioTrack) | Select an audio track by `id`. |
| `remotePlaybackState` | `'disconnected' \| 'connecting' \| 'connected'` | [`remotePlaybackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-remote-playback#remotePlayback-state-remotePlaybackState) | Current remote playback connection state. |
| `remotePlaybackAvailability` | `'available' \| 'unavailable' \| 'unsupported'` | [`remotePlaybackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-remote-playback#remotePlayback-state-remotePlaybackAvailability) | Whether remote playback can be requested on this platform. |
| `promptRemotePlayback` | `() => Promise` | [`remotePlaybackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-remote-playback#remotePlayback-action-promptRemotePlayback) | Prompt the user to pick a remote playback device. Exits fullscreen first when connecting. |
| `liveEdgeStart` | `number` | [`liveFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-live#live-state-liveEdgeStart) | Playback time where the live edge begins. Playback is live when `currentTime >= liveEdgeStart`. `NaN` when the stream is not live or the value is unknown. |
| `targetLiveWindow` | `number` | [`liveFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-live#live-state-targetLiveWindow) | Describes the kind of live window available. This value is not a duration. `0` for a sliding live window, `Infinity` for a live event with playback history, and `NaN` for on-demand or unknown. |
| `streamType` | `'on-demand' \| 'live' \| 'unknown'` | [`streamTypeFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-stream-type#streamType-state-streamType) | Current stream delivery type. Components use this to show live-specific UI (for example, a live indicator or a "jump to live edge" button) or hide the time display. |
| `orientationLockType` | `'any' \| 'landscape' \| 'landscape-primary' \| 'landscape-secondary' \| 'natural' \| 'portrait' \| 'portrait-primary' \| 'portrait-secondary'` | [`orientationLockFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-orientation-lock#orientationLock-state-orientationLockType) | Screen orientation type locked while fullscreen is active. |
| `setOrientationLockType` | `(value: 'any' \| 'landscape' \| 'landscape-primary' \| 'landscape-secondary' \| 'natural' \| 'portrait' \| 'portrait-primary' \| 'portrait-secondary' \| null \| undefined) => void` | [`orientationLockFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-orientation-lock#orientationLock-action-setOrientationLockType) | Sets the locked orientation type. A missing value, including an empty one, restores the default. |
## Features by preset
Each column is a preset's feature bundle. A feature no bundle includes is opt-in: add it to your [`createPlayer`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/html-create-player) features yourself.
| Feature | `videoFeatures` | `audioFeatures` | `liveAudioFeatures` | `liveVideoFeatures` |
| --- | --- | --- | --- | --- |
| [`playbackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-playback) | ✓ | ✓ | ✓ | ✓ |
| [`timeFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-time) | ✓ | ✓ | ✓ | ✓ |
| [`volumeFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-volume) | ✓ | ✓ | ✓ | ✓ |
| [`fullscreenFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-fullscreen) | ✓ | – | – | ✓ |
| [`controlsFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-controls) | ✓ | – | – | ✓ |
| [`bufferFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-buffer) | ✓ | ✓ | ✓ | ✓ |
| [`textTrackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-text-tracks) | ✓ | – | – | ✓ |
| [`playbackRateFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-playback-rate) | ✓ | ✓ | – | – |
| [`pipFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-pip) | ✓ | – | – | ✓ |
| [`errorFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-error) | ✓ | ✓ | ✓ | ✓ |
| [`metadataFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-metadata) | ✓ | ✓ | ✓ | ✓ |
| [`sourceFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-source) | ✓ | ✓ | ✓ | ✓ |
| [`qualityFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-quality) | ✓ | – | – | – |
| [`audioTrackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-audio-track) | ✓ | – | – | – |
| [`remotePlaybackFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-remote-playback) | ✓ | – | – | ✓ |
| [`liveFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-live) | – | – | ✓ | ✓ |
| [`streamTypeFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-stream-type) | – | – | – | – |
| [`orientationLockFeature`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-orientation-lock) | – | – | – | – |
---
# createSelector
Create a type-safe selector for a store slice's state
## Import
```ts
import { createSelector } from "@videojs/store";
```
`createSelector` is also re-exported from `@videojs/react` and `@videojs/html`.
`createSelector` creates a type-safe selector function for a given slice. The returned selector extracts that slice’s state from the full store state, or returns `undefined` if the slice is not configured.
The built-in selectors ([`selectPlayback`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-playback), [`selectBuffer`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/feature-buffer), etc.) are all created with `createSelector`. Use it to create selectors for custom slices.
**my-custom-selector.ts**
```ts
import { createSelector } from '@videojs/store';
import { myCustomSlice } from './my-custom-slice';
const selectCustom = createSelector(myCustomSlice);
// Use with usePlayer (React) or PlayerController (HTML)
const state = selectCustom(store.state);
```
Pass selectors to [`PlayerController`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/player-controller) or [`StoreController`](https://deploy-preview-3106--vjs10-site.netlify.app/docs/framework/html/reference/api/store-controller) for reactive subscriptions.
## API Reference
`createSelector(slice): Selector