# Captions

> Imperative controller that owns the Konva stage lifecycle for a single video element.

Imperative controller that owns the Konva stage lifecycle for a single video element.

## Constructors

### Constructor

```ts
new Captions(options): Captions;
```

Create a controller bound to the provided video element and preset.

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `options` | [`CaptionsOptions`](/docs/api/type-aliases/CaptionsOptions) | Complete configuration for the controller. |

#### Returns

`Captions`

## Methods

### captions()

```ts
captions(nextCaptions): void;
```

Replace the current caption track and repaint without reloading fonts.

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `nextCaptions` | [`Caption`](/docs/api/interfaces/Caption)[] \| `null` | Timed words that should drive the overlay. |

#### Returns

`void`

***

### destroy()

```ts
destroy(): void;
```

Alias for [disable()](#disable) to match typical imperative controller APIs.

#### Returns

`void`

***

### disable()

```ts
disable(): void;
```

Tear down overlays, observers and animation loops to free resources.

#### Returns

`void`

***

### enable()

```ts
enable(): void;
```

Mount caption overlays onto the configured video if they are not active yet.

#### Returns

`void`

***

### getRenderCount()

```ts
getRenderCount(): number;
```

Number of times the scene has been rebuilt. Useful for diagnostics and
tests — it stays flat while the video is paused.

#### Returns

`number`

***

### isEnabled()

```ts
isEnabled(): boolean;
```

Whether the Konva overlay is currently attached to the video element.

#### Returns

`boolean`

`true` when the overlay is mounted on top of the video.

***

### preset()

```ts
preset(nextPreset): void;
```

Swap the active preset and re-render with updated typography/colors.

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `nextPreset` | [`StylePreset`](/docs/api/interfaces/StylePreset) | Preset that becomes the new render baseline. |

#### Returns

`void`

Source: https://captionsjs.dev/docs/api/classes/Captions
