Skip to content

Module: src/ui/Spinner

The Spinner component displays a "busy" animation when the player stalls—typically due to an empty buffer or network-related delay. It appears with a configurable delay to avoid flickering during short interruptions. The spinner listens to player stall events as well as manually published control events.

Version
1.0.0
Author
Frank Kudermann - alphanull
License
MIT
Requires
DomSmith
Source
Spinner.js, line 13

Constructor

new Spinner(player, parent)

Creates an instance of the Spinner component.

Parameters:
Name Type Description
player Player

Reference to the VisionPlayer instance.

parent UI

Reference to the parent instance, in this case the UI.

Members

Holds the instance configuration for this component.

Properties
Name Type Attributes Default Description
delay number optional 1

Delay (in seconds) after which the spinner animation is shown. Used to prevent superfluous showing when the stall period is very short.

Type
Object
Source
Spinner.js, line 20

Reference to the main player instance.

Type
Player
Source
Spinner.js, line 28

Holds tokens of subscriptions to player events, for later unsubscribe.

Type
Array<number>
Source
Spinner.js, line 34

A DomSmith instance used to create the spinner DOM.

Type
DomSmith
Source
Spinner.js, line 40

Spinner state (i.e. "visible" or "hidden") is stored here. Used to prevent double triggering hide() or show().

Type
string
Source
Spinner.js, line 46

Holds the setTimeout id.

Type
number
Source
Spinner.js, line 52

Methods

private #show()

Shows the spinner after the configured delay, if not already visible.

Listens
media/stall/begin
spinner/show
Source
Spinner.js, line 97

private #hide()

Hides the spinner, if not already hidden.

Listens
media/stall/end
spinner/hide
Source
Spinner.js, line 117

destroy()

This method removes all events, subscriptions and DOM nodes created by this component.

Source
Spinner.js, line 135

Events

spinner/show

The Spinner component listens for this event to show the spinner.

Listeners
Spinner#show
Source
Spinner.js, line 146

spinner/hide

The Spinner component listens for this event to hide the spinner.

Listeners
Spinner#hide
Source
Spinner.js, line 151