Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/katerinutkina/audio-recorder-plugin
TypeScript + Webpack + HTML + SCSS
https://github.com/katerinutkina/audio-recorder-plugin
audio-recorder media-recorder typescript webpack
Last synced: 25 days ago
JSON representation
TypeScript + Webpack + HTML + SCSS
- Host: GitHub
- URL: https://github.com/katerinutkina/audio-recorder-plugin
- Owner: KaterinUtkina
- Created: 2024-07-18T17:59:18.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2024-07-29T16:24:15.000Z (4 months ago)
- Last Synced: 2024-10-15T21:22:27.331Z (about 1 month ago)
- Topics: audio-recorder, media-recorder, typescript, webpack
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/audio-recorder-plugin
- Size: 541 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# audio-recorder-plugin
Audio Recorder Plugin is a versatile and easy-to-use plugin for recording audio in the browser using the MediaRecorder API. It includes polyfill support to ensure compatibility across different browsers, making it a reliable choice for your web audio recording needs.
## Table of Contents
- [Features](#features)
- [Live Demo](#live-demo)
- [Installation](#installation)
- [Usage](#usage)
- [API](#api)
- [License](#license)## Features
- **Cross-Browser Support:** Utilizes a polyfill to handle browser inconsistencies.
- **Simple API:** Easy methods for initializing, starting, and stopping audio recordings.
- **Playback Ready:** Returns the recorded audio as an HTMLAudioElement for straightforward playback.## Live Demo
Check out the live demo of the Audio Recorder Plugin: [Audio Recorder Plugin Live Demo](https://katerinutkina.github.io/audio-recorder-plugin/)
## Installation
You can install the plugin via npm or yarn:
```bash
npm install audio-recorder-plugin
```
or
```bash
yarn add audio-recorder-plugin
```
## Usage
Here's how you can use the AudioRecorderPlugin in your JavaScript project:```
import { AudioRecorderPlugin } from 'audio-recorder-plugin';
const recorder = new AudioRecorderPlugin();const start = async () => {
try {
await recorder.init();
await recorder.startRecording();
// Your code...
} catch (error) {
console.error('Error starting the audio recorder:', error);
}
}const stop = async () => {
try {
const audio = await recorder.stopRecording();
// Your code...
} catch (error) {
console.error('Error stopping the audio recorder:', error);
}
}
```
## API### `AudioRecorderPlugin`
The `AudioRecorderPlugin` provides a simple interface for recording audio in the browser. Below are the methods available in the plugin:
#### `init(): Promise`
Initializes the audio recorder. This method must be called before starting the recording. It sets up any necessary resources and ensures the recorder is ready for use.
#### `startRecording(): Promise`
Starts the audio recording process. This method begins capturing audio from the user's microphone. Make sure to call `init()` successfully before invoking this method.
#### `stopRecording(): Promise`
Stops the audio recording process and returns an `HTMLAudioElement` containing the recorded audio. The returned audio element can be appended to the DOM or used for playback.
## License
This project is licensed under the MIT License. See the LICENSE file for more details.