Class: TrackButton

TrackButton

The base class for buttons that toggle specific track types (e.g. subtitles).


new TrackButton(player [, options])

Creates an instance of this class.

Parameters:
Name Type Argument Description
player Player

The Player that this class should be attached to.

options Object <optional>

The key/value store of player options.

Source:
control-bar/track-button.js

Extends

Members


<protected> hideThreshold_ :Number

Hide the menu if the number of items is less than or equal to this threshold. This defaults to 0 and whenever we add items which can be hidden to the menu we'll increment it. We list it here because every time we run createMenu we need to reset the value.

Type:
  • Number
Inherited From:
Source:
menu/menu-button.js

Methods


buildCSSClass()

Builds the default DOM className.

Inherited From:
Source:
menu/menu-button.js
Returns:

The DOM className for this object.

Type
string

createEl()

Create the MenuButtonss DOM element.

Inherited From:
Source:
menu/menu-button.js
Returns:

The element that gets created.

Type
Element

<abstract> createItems()

Create the list of menu items. Specific to each subclass.

Inherited From:
Source:
menu/menu-button.js

createMenu()

Create the menu and add all items to it.

Inherited From:
Source:
menu/menu-button.js
Returns:

The constructed menu

Type
Menu

disable()

Disable the MenuButton. Don't allow it to be clicked.

Inherited From:
Source:
menu/menu-button.js
Returns:

Returns itself; method can be chained.

Type
MenuButton

enable()

Enable the MenuButton. Allow it to be clicked.

Inherited From:
Source:
menu/menu-button.js
Returns:

Returns itself; method can be chained.

Type
MenuButton

handleClick(event)

Handle a click on a MenuButton. See ClickableComponent#handleClick for instances where this is called.

Parameters:
Name Type Description
event EventTarget~Event

The keydown, tap, or click event that caused this function to be called.

Inherited From:
Source:
menu/menu-button.js
Listens to Events:
  • event:tap
  • event:click

handleKeyPress(event)

Handle tab, escape, down arrow, and up arrow keys for MenuButton. See ClickableComponent#handleKeyPress for instances where this is called.

Parameters:
Name Type Description
event EventTarget~Event

The keydown event that caused this function to be called.

Inherited From:
Source:
menu/menu-button.js
Listens to Events:
  • event:keydown

handleSubmenuKeyPress(event)

Handle a keydown event on a sub-menu. The listener for this is added in the constructor.

Parameters:
Name Type Description
event EventTarget~Event

Key press event

Inherited From:
Source:
menu/menu-button.js
Listens to Events:
  • event:keydown

pressButton()

Put the current MenuButton into a pressed state.

Inherited From:
Source:
menu/menu-button.js

unpressButton()

Take the current MenuButton out of a pressed state.

Inherited From:
Source:
menu/menu-button.js

update()

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

Inherited From:
Source:
menu/menu-button.js