# Error

Media error state and actions for the player store

Tracks media errors.

## Import

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

The `audioFeatures`, `liveAudioFeatures`, `liveVideoFeatures`, and `videoFeatures` [feature bundles](https://videojs.org/docs/framework/html/guides/presets) include this feature.

## API Reference

### State

| Property | Type | Description |
| --- | --- | --- |
| `error` | `{ code: number; message: string } \| null` | The current media error, or null if none. |

### Actions

| Action | Type | Description |
| --- | --- | --- |
| `dismissError` | `() => void` | Dismiss the current error by clearing it. |

### Selector

Pass `selectError` to [`PlayerController`](https://videojs.org/docs/framework/html/reference/api/player-controller) to subscribe to error state. Returns `undefined` if the error feature is not configured.

**error-display.ts**

```ts
import { createPlayer, UIElement, selectError } from '@videojs/html';
import { videoFeatures } from '@videojs/html/video';

const { PlayerController } = createPlayer({ features: videoFeatures });

class ErrorDisplay extends UIElement {
  readonly #error = new PlayerController(this, selectError);
}
```

---

HTML documentation: https://videojs.org/docs/framework/html/llms.txt
All documentation: https://videojs.org/llms.txt
