- Version
- 1.0.0
- License
- MIT
- Extends
- AnalyserAudio
- Requires
- VisualizerFrequencyRender
- VisualizerFrequencyWorker
- DomSmith
- supportsWorkerModules
- Source
- VisualizerFrequency.js, line 21
Constructor
new VisualizerFrequency(player, parent, optionsopt)
Creates an instance of the VisualizerFrequency component.
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
player |
Player |
Reference to the VisionPlayer instance. |
|||||||||
parent |
AudioChain |
Reference to the parent instance. |
|||||||||
options |
Object | optional |
Additional options.
|
Members
private #config :Object
Configuration options for the VisualizerBar component, seperated from the superclass config.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
channels
|
number | optional | 2 | Number of audio channels. |
hiPass
|
number | optional | 0 | High-pass filter value. |
loPass
|
number | optional | 0 | Low-pass filter value. |
fftSize
|
number | optional | 512 | FFT size specific to VisualizerBar. |
- Type
- Object
- Source
- VisualizerFrequency.js, line 31
private #player :Player
Reference to the main player instance.
- Type
- Player
- Source
- VisualizerFrequency.js, line 37
private #subscriptions :Array<number>
Holds tokens of subscriptions (for this subclass only).
- Type
- Array<number>
- Source
- VisualizerFrequency.js, line 43
private #apiKey :symbol
Secret key only known to the player instance and initialized components. Used to be able to restrict access to API methods in conjunction with secure mode.
- Type
- symbol
- Source
- VisualizerFrequency.js, line 50
private #dom :DomSmith
DOM elements for the visualizer.
- Type
- DomSmith
- Source
- VisualizerFrequency.js, line 56
private #canvas
Canvas element and its drawing context.
| Name | Type | Description |
|---|---|---|
ele
|
HTMLCanvasElement | Canvas element. |
ctx
|
CanvasRenderingContext2D | 2D drawing context. |
- Source
- VisualizerFrequency.js, line 63
private #useWorker :boolean
Flag indicating if the visualizer should use a worker.
- Type
- boolean
- Source
- VisualizerFrequency.js, line 69
private #worker :VisualizerFrequencyWorker
Optional worker which renders the canvas offscreen.
- Type
- VisualizerFrequencyWorker
- Source
- VisualizerFrequency.js, line 75
Methods
async, private #initWorker()
Initializes the worker for offloading rendering, if supported. If workers are not supported, sets up local canvas rendering.
- Source
- VisualizerFrequency.js, line 122
startLoop()
Starts the audio analysis loop.
- Listens
- media/play
- Source
- VisualizerFrequency.js, line 146
analyseLoop()
Main analysis loop. Calls the parent's analyseLoop and then sends frequency data to the worker or renders locally.
- Source
- VisualizerFrequency.js, line 157
private #resize()
Invoked when window resizes. Sets the canvas dimensions accordingly.
- Listens
- ui/resize
- Source
- VisualizerFrequency.js, line 170
destroy()
This method removes all events, subscriptions and DOM nodes created by this component.
- Source
- VisualizerFrequency.js, line 190