Class: TextTrackButton

TextTrackButton

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


new TextTrackButton(player [, options])

Creates an instance of this class.

Parameters:
Name Type Argument Default 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/text-track-controls/text-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:
Overrides:
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

createItems( [items])

Create a menu item for each text track

Parameters:
Name Type Argument Default Description
items Array.<TextTrackMenuItem> <optional>
[]

Existing array of items to use during creation

Overrides:
Source:
control-bar/text-track-controls/text-track-button.js
Returns:

Array of menu items that were created

Type
Array.<TextTrackMenuItem>

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