@t-pro/web-recording-lib
v1.0.7
Published
Robust audio recording on the browser
Readme
Web Recording Library
A robust audio recording library for web browsers with support for various recording methods and formats.
Features
- Multiple Recording Methods: Support for AudioWorklet and MediaTrack recording
- TypeScript Support: Full TypeScript definitions included
- Multiple Module Formats: UMD, CommonJS, ESM, and global builds
- Browser Compatibility: Works with modern browsers supporting WebRTC and MediaCapture APIs
Installation
npm install @t-pro/web-recording-libUsage
Basic Recording
import { selectAudioCapture, AudioWorkletRecordingHelper } from '@T-Pro/web-recording-lib';
// Select the best available audio capture method
const recorder = await selectAudioCapture();
// Start recording
await recorder.start();
// Stop recording
const audioData = await recorder.stop();Advanced Usage with Options
import {
AudioWorkletRecordingHelper,
RecorderHelperOptions,
DataCallback
} from '@t-pro/web-recording-lib';
const options: RecorderHelperOptions = {
sampleRate: 44100,
channels: 1,
onData: (data: Float32Array) => {
console.log('Received audio data:', data);
}
};
const recorder = new AudioWorkletRecordingHelper(options);
await recorder.start();API Reference
selectAudioCapture()
Automatically selects the best available recording method for the current browser.
AudioWorkletRecordingHelper
High-performance recording using AudioWorklet API.
MediaTrackRecorderHelper
Recording using MediaTrack API for broader browser compatibility.
RecorderHelperOptions
interface RecorderHelperOptions {
sampleRate?: number;
channels?: number;
onData?: DataCallback;
}Browser Support
- Chrome 66+ (AudioWorklet)
- Firefox 60+ (MediaTrack)
- Safari 14+ (MediaTrack)
- Edge 79+ (AudioWorklet)
License
ISC
Author
Alexandre Felipe
