Skip to Content
npm i @clxrity/react-audio

Waveform

The waveform component is used to display audio waveforms. It can be used to visualize audio files in a user-friendly way.

"use client"; import { Waveform } from "@clxrity/react-audio"; export default function WaveformExample() { return ( <div> <Waveform src="/audio/drums_2.wav" /> </div> ); }

Props


PropertyTypeDescriptionRequiredDefault Value
srcstringThe source URL of the audio file to visualize. (internal unless CORS settings are configured)undefined
sizenumberThe size of the canvas element in pixels.420
colorstringThe color of the waveform.primary
autoplaybooleanWhether to autoplay the audio when the component is mounted.false
loopbooleanWhether to loop the audio playback.false
showProgressbooleanWhether to show the progress of the audio playback.false
showVolumebooleanWhether to show the volume control.false
fftSizenumberThe size of the FFT (Fast Fourier Transform) used for audio analysis.2048
onLoad() => voidCallback function to be called when the audio is loaded.undefined
audioRefRefObject<HTMLAudioElement | null> | nullA reference to the HTML audio element. If not provided, a new ref will be created.null
Last updated on