audio_recorder 1.0.1

Audio recorder #

pub package Build Status Coverage Status

Record audio and store it locally

Usage #

To use this plugin, add audio_recorder as a dependency in your pubspec.yaml file.

Android #

Make sure you add the following permissions to your Android Manifest

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

iOS #

Make sure you add the following key to Info.plist for iOS

<key>NSMicrophoneUsageDescription</key>
<string>Record audio for playback</string>

Example #

// Import package
import 'package:audio_recorder/audio_recorder.dart';

// Check permissions before starting
bool hasPermissions = await AudioRecorder.hasPermissions;

// Get the state of the recorder
bool isRecording = await AudioRecorder.isRecording;

// Start recording
await AudioRecorder.start(path: _controller.text, audioOutputFormat: AudioOutputFormat.AAC);

// Stop recording
Recording recording = await AudioRecorder.stop();
print("Path : ${recording.path},  Format : ${recording.audioOutputFormat},  Duration : ${recording.duration},  Extension : ${recording.extension},");

Encoding format #

For now, the plugin only use the AAC compression to encode audio. You can specify the extension of the output audio file in the file path that you give to the start method. The recognized extensions are :

  • .m4a
  • .mp4
  • .aac

If the file path does not finish with these extensions, the ".m4a" extension is added by default.

Exceptions #

The start method raise an exception if :

  • A file already exists at the given file path
  • The parent directory of the file path does not exist

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

[0.0.1] - Published Feb 8, 2018.

  • Record audio and store it locally

[0.0.2] - Published May 16, 2018.

  • Support Dart 2

[0.0.3] - Published June 11, 2018.

  • Update readme

[0.0.4] - Published June 11, 2018.

  • Added path of application directory to user's file name so that a valid file can be written in iOS.
  • Added diagnostic info to help user find the location of their recorded file.

[0.0.5] - Published August 16, 2018.

  • Fix readme with the right class name
  • Make Volume up when recording on iOS

[0.0.6] - Published September 9, 2018.

  • Added test and code coverage report for plugin

[1.0.0] - Published July 4, 2019.

  • Fix a bug where the MediaRecorder.AudioEncoder format AMR_NB create a confusion for some players
  • Fix for flutter beta v0.10.2
  • Add wav file support

[1.0.1] - Published July 5, 2019.

  • Fix swift version

example/README.md

audio_recorder_example #

Demonstrates how to use the audio_recorder plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  audio_recorder: ^1.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:audio_recorder/audio_recorder.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
86
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
89
Learn more about scoring.

We analyzed this package on Jul 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/audio_recorder.dart.

Run flutter format to format lib/audio_recorder.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.40.0.flutter-f981f09760 <3.0.0
file ^5.0.4 5.0.8+1
flutter 0.0.0
path ^1.5.1 1.6.2
Transitive dependencies
collection 1.14.11
intl 0.15.8
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test
path_provider ^1.1.0
test ^1.3.0

Admin