useAudioRecorder
Installation
npx sse-hooks add use-audio-recorder
yarn dlx sse-hooks add use-audio-recorder
pnpm dlx sse-hooks add use-audio-recorder
deno run -A npm:sse-hooks add use-audio-recorder
bunx sse-hooks add use-audio-recorder
Usage
import { useAudioRecorder } from "./{hooks file}";
const { isRecording, startRecording, stopRecording, audioUrl } =
useAudioRecorder({ enableAnalysis: true });
API
Parameters
| Prop | Default | Type |
|---|---|---|
options |
|
Configuration options for audio recording.
|
Returns
| Return Value | Default | Type |
|---|---|---|
analysisData | - |
Live audio analysis data. |
audioBlob | - |
Final recorded audio blob. |
audioUrl | - |
Object URL for the recorded audio. |
clearRecording | - |
Clears the current recording state. |
downloadRecording | - |
Downloads the recording as a file. |
duration | - |
Duration of the recording in seconds. |
error | - |
Error message if recording fails. |
isPaused | - |
Whether recording is currently paused. |
isRecording | - |
Whether recording is currently active. |
isSupported | - |
Whether audio recording is supported in the current browser. |
mediaRecorder | - |
MediaRecorder instance. |
pauseRecording | - |
Pauses the recording. |
resumeRecording | - |
Resumes a paused recording. |
startRecording | - |
Starts audio recording. |
stopRecording | - |
Stops audio recording. |
stream | - |
Active media stream. |