audio-visualizer
audio-visualizer is a performant audio visualizer for React projects.
Quickstart
npm install @tiagotrindade/audio-visualizer
audio-visualizer exports a component AudioVisualizer
(as default).
The AudioVisualizer
component receive the following madatory parameters:
audio
(type: RefObject<HTMLAudioElement>
) — the element where the audio comes fromheight
(type: number
) — the height of the visualizer canvaswidth
(type: number
) — the width of the visualizer canvas
Example
import React, { useRef } from "react"
import AudioVisualizer from "@tiagotrindade/audio-visualizer"
function App() {
const audio = useRef()
return (
<>
<audio ref={audio} src="..." />
<AudioVisualizer audio={audio} width={200} height={100} />
</>
)
}