Class: PlaybackRateMenuButton

PlaybackRateMenuButton

The component for controlling the playback rate.


new PlaybackRateMenuButton(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/playback-rate-menu/playback-rate-menu-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.

Overrides:
Source:
control-bar/playback-rate-menu/playback-rate-menu-button.js
Returns:

The DOM className for this object.

Type
string

createEl()

Create the Component's DOM element

Overrides:
Source:
control-bar/playback-rate-menu/playback-rate-menu-button.js
Returns:

The element that was 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 playback rate menu

Overrides:
Source:
control-bar/playback-rate-menu/playback-rate-menu-button.js
Returns:

Menu object populated with PlaybackRateMenuItems

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])

This gets called when an PlaybackRateMenuButton is "clicked". See ClickableComponent for more detailed information on what a click can be.

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

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

Overrides:
Source:
control-bar/playback-rate-menu/playback-rate-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

playbackRates()

Get possible playback rates

Source:
control-bar/playback-rate-menu/playback-rate-menu-button.js
Returns:

All possible playback rates

Type
Array

playbackRateSupported()

Get whether playback rates is supported by the tech and an array of playback rates exists

Source:
control-bar/playback-rate-menu/playback-rate-menu-button.js
Returns:

Whether changing playback rate is supported

Type
boolean

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

updateARIAAttributes()

Updates ARIA accessibility attributes

Source:
control-bar/playback-rate-menu/playback-rate-menu-button.js

updateLabel( [event])

Update button label when rate changed

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

The event that caused this function to run.

Source:
control-bar/playback-rate-menu/playback-rate-menu-button.js
Listens to Events:
  • Player#event:ratechange

updateVisibility( [event])

Hide playback rate controls when they're no playback rate options to select

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

The event that caused this function to run.

Source:
control-bar/playback-rate-menu/playback-rate-menu-button.js
Listens to Events: