Custom hook to initialize and control a WaveSurfer audio waveform player.

URL of the audio file to play

Optional initial play state

Optional callback invoked when play state changes

An object containing:

  • containerRef: Ref to the DOM element where WaveSurfer will mount
  • isPlaying: Current playback state
  • togglePlay: Function to toggle between play and pause
interface useAudioMainProps {
    audio_url: string;
    handleDuration?: (value: string) => void;
    handlePlaying?: (value: boolean) => void;
    playing?: boolean;
}

Properties

audio_url: string
handleDuration?: (value: string) => void
handlePlaying?: (value: boolean) => void
playing?: boolean