Command Palette

Search for a command to run...

Docs
Waveform Player

Waveform Player

Audio player with visual waveform representation and seek controls

Loading...

Installation

Usage

import WaveformPlayer from "@/components/ruixen/waveform-player";
 
export default function App() {
  return (
    <WaveformPlayer
      audioSrc="https://example.com/audio.mp3"
      width={500}
      height={80}
    />
  );
}

Props

PropTypeDefaultDescription
audioSrcstring-URL of the audio file
widthnumber400Width of the waveform
heightnumber60Height of the waveform
classNamestring-Additional CSS classes

Features

  • Visual Waveform: Simulated audio waveform with random heights
  • Click to Seek: Click anywhere on waveform to jump to position
  • Progress Overlay: Visual indication of playback progress
  • Play/Pause Control: Simple audio controls
  • Responsive Bars: 40 individual waveform bars
  • Smooth Animations: CSS transitions for interactions

Waveform Generation

The component generates a simulated waveform with:

  • 40 bars: Individual frequency bars
  • Random heights: Between 10px and (height-20)px
  • 2px width: Consistent bar width
  • Rounded corners: Smooth appearance

Interaction

  • Click to seek: Click any position to jump to that time
  • Progress visualization: Filled overlay shows current position
  • Responsive design: Adapts to specified dimensions