---
updatedAt: 2026-07-20T12:03:45.000Z
agentTools:
  siteIndex: https://developer.bitmovin.com/llms.txt
  projectIndex: https://developer.bitmovin.com/playback/llms.txt
---

# Buffer API

Buffer management and monitoring

## BufferConfig

> Interface

Configures different kinds of buffer settings for media types defined in [MediaType](https://developer.bitmovin.com/playback/reference/web-sdk-player-api#mediatype).

Example:

```js
buffer: {
  [MediaType.Video]: {
    [BufferType.ForwardDuration]: 30,
    [BufferType.BackwardDuration]: 20,
  },
  [MediaType.Audio]: {
    [BufferType.ForwardDuration]: 50,
    [BufferType.BackwardDuration]: 20,
  },
},
```

## Properties

### audio?

> `optional` **audio?**: [`BufferMediaTypeConfig`](https://developer.bitmovin.com/playback/reference/web-sdk-buffer#buffermediatypeconfig)

Configures various settings for the audio buffers.

***

### video?

> `optional` **video?**: [`BufferMediaTypeConfig`](https://developer.bitmovin.com/playback/reference/web-sdk-buffer#buffermediatypeconfig)

Configures various settings for the video buffers.

***

## BufferLevel

> Interface

Holds information about the current buffer level.

## Properties

### level

> **level**: `number`

The amount of currently buffered data, relative to the current time of the player.
Returns `null` if there is no track for the associated media type.

***

### media

> **media**: [`MediaType`](https://developer.bitmovin.com/playback/reference/web-sdk-player-api#mediatype)

The media type the buffer data applies to.

***

### targetLevel

> **targetLevel**: `number`

The target buffer level the player tries to maintain for the associated media type.

***

### type

> **type**: [`BufferType`](https://developer.bitmovin.com/playback/reference/web-sdk-buffer#buffertype)

The buffer type the buffer data applies to.

***

## BufferLevelTargets

> Interface

## Properties

### backwardduration

> **backwardduration**: `number`

***

### forwardduration

> **forwardduration**: `number`

***

## BufferMediaTypeConfig

> Interface

## Properties

### backwardduration?

> `optional` **backwardduration?**: `number`

The amount of data in seconds the player keeps buffered after it played over it. Default is `20`.

***

### forwardduration?

> `optional` **forwardduration?**: `number`

The amount of data in seconds the player tries to buffer in advance. Default is `40`.

For live streams the lowest value of playlist duration for HLS, `timeShiftBufferDepth` for DASH and
this `targetLevel` value is used as a maximum value for the forward buffers.

***

## BufferType

> Enum

## Enumeration Members

### BackwardDuration

> **BackwardDuration**: `"backwardduration"`

Represents the buffered data up until the current playback time.

***

### ForwardDuration

> **ForwardDuration**: `"forwardduration"`

Represents the buffered data starting at the current playback time.

***

## PlayerBufferAPI

> Interface

## Methods

### getLevel()

> **getLevel**(`type`, `media`): [`BufferLevel`](https://developer.bitmovin.com/playback/reference/web-sdk-buffer#bufferlevel)

Returns the current and target buffer level for the given buffer type and media type.

#### Parameters

##### type

[`BufferType`](https://developer.bitmovin.com/playback/reference/web-sdk-buffer#buffertype)

the buffer type for which to get the buffer level for.

##### media

[`MediaType`](https://developer.bitmovin.com/playback/reference/web-sdk-player-api#mediatype)

the media type for which to get the buffer level for.

#### Returns

[`BufferLevel`](https://developer.bitmovin.com/playback/reference/web-sdk-buffer#bufferlevel)

**Since:** v8.1

***

### setTargetLevel()

> **setTargetLevel**(`type`, `value`, `media`): `void`

Sets the target buffer level for the chosen buffer and media type.

#### Parameters

##### type

[`BufferType`](https://developer.bitmovin.com/playback/reference/web-sdk-buffer#buffertype)

The buffer type to change the target buffer level for.

##### value

`number`

The value to set.

##### media

[`MediaType`](https://developer.bitmovin.com/playback/reference/web-sdk-player-api#mediatype)

The media type to change the target buffer level for.

#### Returns

`void`

**Since:** v8.1