SSE Hooks

useAudioRecorder

GitHub
A comprehensive hook for audio recording with real-time analysis using getUserMedia, MediaRecorder, and Web Audio APIs

Installation

npx sse-hooks add use-audio-recorder

Usage

example.ts
import { useAudioRecorder } from "./{hooks file}";

const { isRecording, startRecording, stopRecording, audioUrl } =
  useAudioRecorder({ enableAnalysis: true });

API

Parameters

Prop Default Type
options

{}

UseAudioRecorderOptions

Configuration options for audio recording.

Returns

Return Value Default Type
analysisData-

AudioAnalysisData | null

Live audio analysis data.

audioBlob-

Blob | null

Final recorded audio blob.

audioUrl-

string | null

Object URL for the recorded audio.

clearRecording-

() => void

Clears the current recording state.

downloadRecording-

(filename: string) => void

Downloads the recording as a file.

duration-

number

Duration of the recording in seconds.

error-

string | null

Error message if recording fails.

isPaused-

boolean

Whether recording is currently paused.

isRecording-

boolean

Whether recording is currently active.

isSupported-

boolean

Whether audio recording is supported in the current browser.

mediaRecorder-

MediaRecorder | null

MediaRecorder instance.

pauseRecording-

() => void

Pauses the recording.

resumeRecording-

() => void

Resumes a paused recording.

startRecording-

() => Promise<void>

Starts audio recording.

stopRecording-

() => void

Stops audio recording.

stream-

MediaStream | null

Active media stream.

Types Aliases

No specific type aliases defined for this component.

Changelog

c165d — feat: enhance useRoleGuard and useSSR hooks with additional options and documentation

30da4 — feat: add new hooks and their metadata

b17e8 — feat: add computed and reactive hooks with support for audio recording and media session management

Built with Love • © 2026