# Buffer

Buffered and seekable time range state for the player store

Tracks buffered and seekable time ranges. Each range is a `[start, end]` pair rather than a browser `TimeRanges` object.

During live playback, `seekable` tells you which times remain available. The first start is the oldest available time, and the last end is the newest. Both values can move forward as a sliding live stream drops older video and adds new video. See [live state](https://videojs.org/docs/framework/html/reference/api/feature-live) for the live-edge values.

## Import

```ts
import { bufferFeature } 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 |
| --- | --- | --- |
| `buffered` | `[number, number][]` | Buffered time ranges as \[start, end\] tuples. |
| `seekable` | `[number, number][]` | Seekable time ranges as \[start, end\] tuples. |

### Selector

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

**buffer-bar.ts**

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

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

class BufferBar extends UIElement {
  readonly #buffer = new PlayerController(this, selectBuffer);
}
```

---

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