## PlaybackRateMenuButton

The component for controlling the playback rate.

## Constructor

#### new PlaybackRateMenuButton(player, optionsopt)
`control-bar/playback-rate-menu/playback-rate-menu-button.js`, `line 15`

  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.

### Extends

- MenuButton

### Members

#### protected hideThreshold_ :Number
`menu/menu-button.js`, `line 103`

  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.

  Inherited From:
    - MenuButton#hideThreshold_

### Methods

#### blur()
`menu/menu-button.js`, `line 247`

  Remove the focus from the actual button, not this element

  Inherited From:
    - MenuButton#blur

#### buildCSSClass() → {string}
`control-bar/playback-rate-menu/playback-rate-menu-button.js`, `line 61`

  Builds the default DOM `className`.

  ##### Returns:

  string -

  The DOM `className` for this object.

  Overrides:
    - MenuButton#buildCSSClass

#### buildWrapperCSSClass() → {string}
`menu/menu-button.js`, `line 157`

  Allow sub components to stack CSS class names for the wrapper element

  ##### Returns:

  string -

  The constructed wrapper DOM `className`

  Overrides:
    - MenuButton#buildWrapperCSSClass

#### controlText(textopt, elopt) → {string}
`menu/menu-button.js`, `line 206`

  Get or set the localized control text that will be used for accessibility.

  > NOTE: This will come from the internal `menuButton_` element.

  ##### Parameters:

  Name | Type | Attributes | Default | Description
  --- | --- | --- | --- | ---
  `text` | string | <optional> |  | Control text for element.
  `el` | Element | <optional> | this.menuButton_.el() | Element to set the title on.

  ##### Returns:

  string -
  - The control text when getting
  Inherited From:
    - MenuButton#controlText

#### createEl() → {Element}
`control-bar/playback-rate-menu/playback-rate-menu-button.js`, `line 42`

  Create the `Component`'s DOM element

  ##### Returns:

  Element -

  The element that was created.

  Overrides:
    - MenuButton#createEl

#### abstract createItems()
`menu/menu-button.js`, `line 136`

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

  Inherited From:
    - MenuButton#createItems

#### createMenu() → {Menu}
`control-bar/playback-rate-menu/playback-rate-menu-button.js`, `line 75`

  Create the playback rate menu

  ##### Returns:

  Menu -

  Menu object populated with PlaybackRateMenuItems

  Overrides:
    - MenuButton#createMenu

#### disable()
`menu/menu-button.js`, `line 361`

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

  Inherited From:
    - MenuButton#disable

#### enable()
`menu/menu-button.js`, `line 373`

  Enable the `MenuButton`. Allow it to be clicked.

  Inherited From:
    - MenuButton#enable

#### focus()
`menu/menu-button.js`, `line 240`

  Set the focus to the actual button, not to this element

  Inherited From:
    - MenuButton#focus

#### handleBlur(event)
`menu/menu-button.js`, `line 274`

  Called when a `MenuButton` loses focus. Turns off the listener for `keydown` events. Which Stops `this.handleKeyPress` from getting called.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `event` | EventTarget~Event | The `blur` event that caused this function to be called.

  ##### Listens to Events:

  - event:blur
  Inherited From:
    - MenuButton#handleBlur

#### handleClick(eventopt)
`control-bar/playback-rate-menu/playback-rate-menu-button.js`, `line 109`

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

  ##### Parameters:

  Name | Type | Attributes | Description
  --- | --- | --- | ---
  `event` | EventTarget~Event | <optional> | The `keydown`, `tap`, or `click` event that caused this function to be called.

  ##### Listens to Events:

  - event:tap
  - event:click
  Overrides:
    - MenuButton#handleClick

#### handleFocus(event)
`menu/menu-button.js`, `line 261`

  This gets called when a `MenuButton` gains focus via a `focus` event. Turns on listening for `keydown` events. When they happen it calls `this.handleKeyPress`.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `event` | EventTarget~Event | The `focus` event that caused this function to be called.

  ##### Listens to Events:

  - event:focus
  Inherited From:
    - MenuButton#handleFocus

#### handleKeyPress(event)
`menu/menu-button.js`, `line 287`

  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.

  ##### Listens to Events:

  - event:keydown
  Inherited From:
    - MenuButton#handleKeyPress

#### handleSubmenuKeyPress(event)
`menu/menu-button.js`, `line 318`

  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

  ##### Listens to Events:

  - event:keydown
  Inherited From:
    - MenuButton#handleSubmenuKeyPress

#### playbackRates() → {Array}
`control-bar/playback-rate-menu/playback-rate-menu-button.js`, `line 132`

  Get possible playback rates

  ##### Returns:

  Array -

  All possible playback rates

#### playbackRateSupported() → {boolean}
`control-bar/playback-rate-menu/playback-rate-menu-button.js`, `line 143`

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

  ##### Returns:

  boolean -

  Whether changing playback rate is supported

#### pressButton()
`menu/menu-button.js`, `line 337`

  Put the current `MenuButton` into a pressed state.

  Inherited From:
    - MenuButton#pressButton

#### unpressButton()
`menu/menu-button.js`, `line 350`

  Take the current `MenuButton` out of a pressed state.

  Inherited From:
    - MenuButton#unpressButton

#### update()
`menu/menu-button.js`, `line 60`

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

  Inherited From:
    - MenuButton#update

#### updateARIAAttributes()
`control-bar/playback-rate-menu/playback-rate-menu-button.js`, `line 93`

  Updates ARIA accessibility attributes

#### updateLabel(eventopt)
`control-bar/playback-rate-menu/playback-rate-menu-button.js`, `line 175`

  Update button label when rate changed

  ##### Parameters:

  Name | Type | Attributes | Description
  --- | --- | --- | ---
  `event` | EventTarget~Event | <optional> | The event that caused this function to run.

  ##### Listens to Events:

  - Player#event:ratechange

#### updateVisibility(eventopt)
`control-bar/playback-rate-menu/playback-rate-menu-button.js`, `line 159`

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

  ##### Parameters:

  Name | Type | Attributes | Description
  --- | --- | --- | ---
  `event` | EventTarget~Event | <optional> | The event that caused this function to run.

  ##### Listens to Events:

  - Player#event:loadstart