- Version
- 1.0.0
- License
- MIT
- Requires
- DomSmith
- Source
- PlaybackRate.js, line 11
Constructor
new PlaybackRate(player, parent)
Members
private #config :Object
Holds the instance configuration for this component.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
allowedValues
|
Array<number> | optional | [0.25, 0.5, 1, 2, 4] | This configures which playback rate speeds appear in the menu. |
speed
|
number | optional | 1 | The initial playback speed. |
- Type
- Object
- Source
- PlaybackRate.js, line 19
private #player :Player
Reference to the main player instance.
- Type
- Player
- Source
- PlaybackRate.js, line 28
private #menu :Menu
private #subscriptions :Array<number>
Holds tokens of subscriptions to player events, for later unsubscribe.
- Type
- Array<number>
- Source
- PlaybackRate.js, line 40
Methods
private #onMediaReady()
Sets up the component as soon as the media is playable.
- Listens
- media/ready
- Source
- PlaybackRate.js, line 102
private #toggleSpeed(value)
Changes playback speed.
| Name | Type | Description |
|---|---|---|
value |
number |
The desired speed (1 is normal speed). |
- Source
- PlaybackRate.js, line 119
private #onRateChange()
This handler is called if playback speed is changed (either by this component or otherwise). Updates the menus' "is-active" state accordingly.
- Listens
- media/ratechange
- Source
- PlaybackRate.js, line 131
private #enable()
Enables the menu functionality. This method listens to canplay events in order to restore a usable state again when the player recovered from a media error (for example by loading another file).
- Listens
- media/canplay
- Source
- PlaybackRate.js, line 146
private #disable()
Disables the menu functionality. This method listens to media error events which cause the button to be disabled.
- Listens
- media/error
- data/nomedia
- Source
- PlaybackRate.js, line 157
destroy()
This method removes all events, subscriptions and DOM nodes created by this component.
- Source
- PlaybackRate.js, line 166