Constructor
new Play(player, parent)
Creates an instance of the Play component.
| Name | Type | Description |
|---|---|---|
player |
Player |
Reference to the VisionPlayer instance. |
parent |
Controller |
Reference to the parent instance, in this case the controller component. |
Members
private #player :Player
private #subscriptions :Array<number>
Holds tokens of subscriptions to player events, for later unsubscribe.
private #dom :DomSmith
Methods
private #onDataReady()
Sets up the component as soon as the media data is available.
- Listens
- data/ready
- Source
- Play.js, line 67
private #togglePlay()
Invoked when the user presses the play button. Toggles between 'play' and 'pause'.
private #onPlay()
This method switches the appearance of the play button to the play state.
- Listens
- media/play
- Source
- Play.js, line 89
private #onPause()
This method switches the appearance of the play button to the pause state.
- Listens
- media/pause
- Source
- Play.js, line 102
private #onEngineSet(data)
Invoked when the engine is switched.
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
Object |
The event data.
|
- Listens
- player/engine/set
- Source
- Play.js, line 119
private #enable()
Enables the play button 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
- Play.js, line 149
private #disable()
Disables the button functionality. This method listens to media error events which cause the button to be disabled.
- Listens
- media/error
- data/nomedia
- Source
- Play.js, line 160