mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-02-04 05:24:08 +00:00
refactor(visualizer): Removed restart requirement and refactored impls (#4200)
This commit is contained in:
@ -1,22 +1,15 @@
|
||||
import type { VisualizerPluginConfig } from '../index';
|
||||
|
||||
export abstract class Visualizer<T> {
|
||||
/**
|
||||
* The name must be the same as the file name.
|
||||
*/
|
||||
abstract name: string;
|
||||
abstract visualizer: T;
|
||||
export abstract class Visualizer {
|
||||
protected audioNode: GainNode;
|
||||
protected audioSource: MediaElementAudioSourceNode;
|
||||
|
||||
protected constructor(
|
||||
_audioContext: AudioContext,
|
||||
_audioSource: MediaElementAudioSourceNode,
|
||||
_visualizerContainer: HTMLElement,
|
||||
_canvas: HTMLCanvasElement,
|
||||
_audioNode: GainNode,
|
||||
_stream: MediaStream,
|
||||
_options: VisualizerPluginConfig,
|
||||
) {}
|
||||
) {
|
||||
this.audioNode = _audioNode;
|
||||
this.audioSource = _audioSource;
|
||||
}
|
||||
|
||||
abstract resize(width: number, height: number): void;
|
||||
abstract render(): void;
|
||||
abstract destroy(): void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user