ChaptersButton(player, optionsopt, readyopt)

The button component for toggling and selecting chapters Chapters act much differently than other text tracks Cues are navigation vs. other tracks of alternative languages

new ChaptersButton(player, optionsopt, readyopt)

Creates an instance of this class.

Parameters:
Name Type Attributes Description
player Player

The Player that this class should be attached to.

options Object <optional>

The key/value store of player options.

ready Component~ReadyCallback <optional>

The function to call when this function is ready.

Extends

Methods

buildCSSClass() → {string}

Builds the default DOM className.

Returns:
string -

The DOM className for this object.

createItems() → {Array.<TextTrackMenuItem>}

Create a menu item for each text track

Returns:
Array.<TextTrackMenuItem> -

Array of menu items

Overrides:

createMenu() → {Menu}

Create menu from chapter track

Returns:
Menu -

New menu for the chapter buttons

findChaptersTrack() → {TextTrack|undefined}

Find the track object that is currently in use by this ChaptersButton

Returns:
TextTrack | undefined -

The current track or undefined if none was found.

getMenuCaption() → {string}

Get the caption for the ChaptersButton based on the track label. This will also use the current tracks localized kind as a fallback if a label does not exist.

Returns:
string -

The tracks current label or the localized track kind.

setTrack(track)

Set the currently selected track for the chapters button.

Parameters:
Name Type Description
track TextTrack

The new track to select. Nothing will change if this is the currently selected track.

update(eventopt)

Update the menu based on the current state of its items.

Parameters:
Name Type Attributes Description
event EventTarget~Event <optional>

An event that triggered this function to run.

Listens to Events: