# Live video preset

The live video preset — a player, feature bundle, skins, and media for live video streams

`@videojs/html/live-video` is the preset for live video streams. It bundles the `<live-video-player>` element, the `liveVideoFeatures` bundle it is configured with, and four skins that swap the time slider and time displays for a Live button, and plays through the browser’s native `<video>`. See [Presets](../../guides/presets.md) for how presets fit together and [Live streams](../../guides/live-streams.md) for playing a live source.

## Import

```ts
import '@videojs/html/live-video/player';
import '@videojs/html/live-video/skin';
```

Import `@videojs/html/live-video/neutral-skin`, `compat-skin`, or `scaffold-skin` instead for another skin. Or load one [CDN](../../guides/cdn.md) bundle that registers the player and a skin together:

```html
<script type="module" src="https://cdn.jsdelivr.net/npm/@videojs/cdn@10.6.0/live-video.js"></script>
```

`live-video-neutral.js`, `live-video-compat.js`, and `live-video-scaffold.js` register the other skins instead, and `live-video-player.js` registers `<live-video-player>` alone.

## Usage

Live streams are usually HLS, so this example plays through an HLS media component instead of the preset’s native video.

**index.html**

```html
<script type="module">
  import '@videojs/html/live-video/player';
  import '@videojs/html/live-video/skin';
  import '@videojs/html/media/hlsjs-video';
</script>

<live-video-player>
  <live-video-skin>
    <hlsjs-video src="https://example.com/live.m3u8"></hlsjs-video>
  </live-video-skin>
</live-video-player>
```

## Player

`@videojs/html/live-video/player` registers `<live-video-player>`, whose class is `LiveVideoPlayerElement`. It is a [player](../components/player.md) element created by [`createPlayer`](./html-create-player.md) with `liveVideoFeatures`. It owns the player store but no layout. Put a skin or a [`<media-container>`](../components/player-container.md) inside it.

| Attribute | Property | Description |
| --- | --- | --- |
| `content-title` | `contentTitle` | The title to display. Takes precedence over the title the media reports. |
| `poster` | `poster` | The poster to display. Takes precedence over the poster the media reports. |
| `keep-alive` | — | Keeps the player, its store, and the UI elements inside it alive when the element leaves the DOM. Call `destroy()` when you’re done with it. |

`content-title` and `poster` come from the [metadata feature](./feature-metadata.md#player-inputs). The element’s read-only `store` property returns its player store.

The preset root also exports a `PlayerController` bound to the live video player’s store. Use it from any custom element inside `<live-video-player>`; see [`PlayerController`](./player-controller.md).

## Feature bundle

`liveVideoFeatures` is the array of [features](../../guides/features.md) the player is configured with. It is the [video preset’s](./preset-video.md#feature-bundle) `videoFeatures` without playback rate, plus the [live feature](./feature-live.md):

| Feature | Description |
| --- | --- |
| [`playbackFeature`](./feature-playback.md) | Play/pause state and actions for the player store |
| [`qualityFeature`](./feature-quality.md) | Video rendition state and actions for the player store |
| [`audioTrackFeature`](./feature-audio-track.md) | Audio track state and actions for the player store |
| [`volumeFeature`](./feature-volume.md) | Volume level and mute state for the player store |
| [`timeFeature`](./feature-time.md) | Playback position and duration state for the player store |
| [`sourceFeature`](./feature-source.md) | Media source state and actions for the player store |
| [`bufferFeature`](./feature-buffer.md) | Buffered and seekable time range state for the player store |
| [`fullscreenFeature`](./feature-fullscreen.md) | Fullscreen state and actions for the player store |
| [`pipFeature`](./feature-pip.md) | Picture-in-picture state and actions for the player store |
| [`remotePlaybackFeature`](./feature-remote-playback.md) | Remote playback state and actions for the player store |
| [`controlsFeature`](./feature-controls.md) | User activity and controls visibility state for the player store |
| [`textTrackFeature`](./feature-text-tracks.md) | Subtitles, captions, and chapter track state for the player store |
| [`textCuesFeature`](./feature-text-cues.md) | Cues and active cues from metadata, chapters, and app text tracks |
| [`errorFeature`](./feature-error.md) | Media error state and actions for the player store |
| [`liveFeature`](./feature-live.md) | Live edge state for the player store |
| [`metadataFeature`](./feature-metadata.md) | Resolved title and poster values for the player store |

Its type, `LiveVideoFeatures`, is the tuple of those features in order. Import it from the package root:

```ts
import type { LiveVideoFeatures } from '@videojs/html';
```

To add or remove a feature, pass your own array to `createPlayer`. The skins expect the features they render controls for.

```ts
import { createPlayer, streamTypeFeature } from '@videojs/html';
import { liveVideoFeatures } from '@videojs/html/live-video';

const { PlayerElement } = createPlayer({
  features: [...liveVideoFeatures, streamTypeFeature],
});

customElements.define('my-live-video-player', PlayerElement);
```

## Skins

- [LiveVideoSkin](../components/live-video-skin.md) — the default skin, which swaps the time controls for a Live button.
- [NeutralLiveVideoSkin](../components/live-video-neutral-skin.md) — the visually lighter variant, closer to a classic control bar.
- [CompatLiveVideoSkin](../components/live-video-compat-skin.md) — the plain, unbranded variant that avoids newer visual effects, so it looks consistent across browsers.
- [ScaffoldLiveVideoSkin](../components/live-video-scaffold-skin.md) — the minimally styled variant of Compat, a foundation for your own design.

See [Choose a skin](../../guides/skins.md#choose-a-skin) to compare them.

## Media

The preset plays through a native [`<video>`](../components/video.md), so it registers no media component of its own. Most browsers need a streaming [media component](../../guides/media-sources.md) to play a live source, such as [`<hlsjs-video>`](../components/hlsjs-video.md) for HLS.

## Exports

The preset root, `@videojs/html/live-video`, has no side effects. Importing it never registers an element:

| Export | Description |
| --- | --- |
| `LiveVideoPlayerElement` | The [player](#player) element class. |
| `PlayerController` | The player controller, bound to the live video player’s store. |
| `liveVideoFeatures` | The [feature bundle](#feature-bundle). |
| `LiveVideoSkinElement` | The default [skin](#skins) element class. |
| `NeutralLiveVideoSkinElement` | The neutral [skin](#skins) element class. |
| `CompatLiveVideoSkinElement` | The compat [skin](#skins) element class. |
| `ScaffoldLiveVideoSkinElement` | The scaffold [skin](#skins) element class. |

Registration entry points are side-effect-only:

| Entry point | Registers |
| --- | --- |
| `@videojs/html/live-video/player` | `<live-video-player>` |
| `@videojs/html/live-video/skin` | `<live-video-skin>`, `<media-container>`, and the UI elements the skin composes |
| `@videojs/html/live-video/neutral-skin` | `<live-video-neutral-skin>`, `<media-container>`, and the UI elements the neutral skin composes |
| `@videojs/html/live-video/compat-skin` | `<live-video-compat-skin>`, `<media-container>`, and the UI elements the compat skin composes |
| `@videojs/html/live-video/scaffold-skin` | `<live-video-scaffold-skin>`, `<media-container>`, and the UI elements the scaffold skin composes |
| `@videojs/html/live-video/ui` | `<media-container>` and the UI elements of the default skin, without the skin, for a layout you write yourself |
| `@videojs/html/live-video/neutral-ui` | `<media-container>` and the UI elements of the neutral skin, without the skin |