Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/TheCoderDream/ngx-mic-recorder

Microphone recorder for angular
https://github.com/TheCoderDream/ngx-mic-recorder

angular angular-audio angular-audio-recorder angular-voice-recorder audio-recorder mp3-recorder ng2 ngx typescript voice-recorder

Last synced: 6 days ago
JSON representation

Microphone recorder for angular

Awesome Lists containing this project

README

        


Angular Microphone Recorder


ngx-mic-recorder





npm





DEMO: https://stackblitz.com/edit/angular-ivy-bdzsz1?file=src/app/app.component.html

## Features

- Audio recording visualization.
- Start, stop, pause and resume audio recording.
- Fully customizable and configurable.
- Fully documented.

## Dependencies

| ngx-mic-recorder | Angular |
|------------------|---------|
| 1.0.0 | => 12.x |

## Install

```bash
npm install ngx-mic-recorder --save
```

## Setup

**Step 1:** Import the module

```ts
import { NgxMicRecorderModule } from 'ngx-mic-recorder';

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
NgxMicRecorderModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
```

## Use

```html

```

**With all options:**
```html

```

## Properties

| Option | Type | Default | Description |
|-------------------------|-------------------------------------------------|------------------------------------|---------------------------------------------------------------------------------------------------------------|
| showVisualization | number | true | Whether to show the visualization |
| visualizationType | ``SineWave``, ``FrequencyBars``, ``FrequencyCircles`` | SineWave | Audio Recording visualization type |
| visualizationOptions | object | [see below](#visualization options) | Audio Recording visualization options |

##### visualization options

```typescript
const defaultVisualizationOptions = {
width: 300,
height: 150,
strokeColor: '#212121',
backgroundColor: 'white',
}
```

## Events

| Event | Value | Description |
|----------------------|-------|------------------------------------------------------|
| afterStartRecording | void | After microphone start recording |
| afterStopRecording | Blob | After microphone stop recording with recorded audio |
| onPauseRecording | void | When microphone pauses recording |
| onResumeRecording | void | When microphone resumes recording |
| getAsMp3 | `{ data: Blob, url: string}` | Get recorded audio as encoded to MP3 |

## Template options

```html













{{ recordingTime }}



{{ recordingState }}




```

## NgxMicRecorderService
**Note :** You can use your own fully custom template with the service.

## Properties

| Option | Type | Initial value |
|-------------------------|---------------------------------------------------|----------------------------|
| isRecording$ | ``Observable`` | ``Observable`` |
| isPaused$ | ``Observable`` | ``Observable`` |
| recordingTime$ | ``Observable`` | ``Observable<'00:00:00'>`` |
| recordedBlob$ | ``Observable`` | ``Observable`` |
| recordedBlobAsMp3$ | ``Observable`` | ``Observable`` |
| recordingState$ | ``Observable<'inactive', 'paused', 'recording'>`` | ``Observable<'inactive'>`` |

## Methods

| Name |
|--------------------|
| startRecording |
| stopRecording |
| toggleStartStop |
| resume |
| pause |
| togglePauseAndResume |
| setRecordingEvents |