## ChaptersButton

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

## Constructor

#### new ChaptersButton(player, optionsopt, readyopt)
`control-bar/text-track-controls/chapters-button.js`, `line 16`

  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

- TextTrackButton

### Methods

#### buildCSSClass() → {string}
`control-bar/text-track-controls/chapters-button.js`, `line 40`

  Builds the default DOM `className`.

  ##### Returns:

  string -

  The DOM `className` for this object.

#### createItems() → {Array.<TextTrackMenuItem>}
`control-bar/text-track-controls/chapters-button.js`, `line 156`

  Create a menu item for each text track

  ##### Returns:

  Array.<TextTrackMenuItem> -

  Array of menu items

  Overrides:
    - TextTrackButton#createItems

#### createMenu() → {Menu}
`control-bar/text-track-controls/chapters-button.js`, `line 145`

  Create menu from chapter track

  ##### Returns:

  Menu -

  New menu for the chapter buttons

#### findChaptersTrack() → {TextTrack|undefined}
`control-bar/text-track-controls/chapters-button.js`, `line 112`

  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}
`control-bar/text-track-controls/chapters-button.js`, `line 132`

  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)
`control-bar/text-track-controls/chapters-button.js`, `line 72`

  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)
`control-bar/text-track-controls/chapters-button.js`, `line 58`

  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:

  - TextTrackList#event:addtrack
  - TextTrackList#event:removetrack
  - TextTrackList#event:change