flutter_audio_recorder 0.3.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new83

flutter_audio_recorder #

pub version Awesome Flutter

English | 简体中文

Flutter Audio Record Plugin that supports Record Pause Resume Stop and provide access to audio level metering properties average power peak power(currently for iOS only)

Installation #

add flutter_audio_recorder to your pubspec.yaml

iOS Permission #

add usage description to plist

<key>NSMicrophoneUsageDescription</key>
<string>Can We Use Your Microphone Please</string>

note: iOS Deployment Target is 8.0 #

Usage #

Init (run this before start, so we could check if file with given name already exists)

var recorder = FlutterAudioRecorder("file_path.mp4"); // .wav .aac .m4a
await recorder.initialized;

or

var recorder = FlutterAudioRecorder("file_path", audioFormat: AudioFormat.AAC); // or AudioFormat.WAV
await recorder.initialized;
Sample Rate #
var recorder = FlutterAudioRecorder("file_path", audioFormat: AudioFormat.AAC, sampleRate: 22000); // sampleRate is 16000 by default
await recorder.initialized;
Audio Extension and Format Mapping #
Audio FormatAudio Extension List
AAC.m4a .aac .mp4
WAV.wav

Start recording #

await recorder.start();
var recording = await recorder.current(channel: 0);

Get recording details #

var current = await recording.current(channel: 0);
// print(current.status);

You could use a timer to access details every 50ms(simply cancel the timer when recording is done)

new Timer.periodic(tick, (Timer t) async {
        var current = await recording.current(channel: 0);
        // print(current.status);
        setState(() {
        });
      });
Recording #
NameDescription
pathString
extensionString
durationDuration
audioFormatAudioFormat
meteringAudioMetering
statusRecordingStatus
Recording.metering #
NameDescription
peakPowerdouble
averagePowerdouble
isMeteringEnabledbool
Recording.status #

Unset,Initialized,Recording,Paused,Stopped

Pause #

await recorder.pause();

Resume #

await recorder.resume();

Stop (after stop, run init again to create another recording)

var result = await recorder.stop();
File file = widget.localFileSystem.file(result.path);

Example #

Please check example app using Xcode.

Getting Started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

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

0.3.0 #

  • Support Sample Rate.

0.2.2 #

  • Correct iOS deployment target to 8.0.

0.2.1 #

  • Simplify usage example for initialize recorder.

0.2.0 #

  • Fix issue of init method.
  • Fix issue of wav format recording initialization.
  • audioFormat of FlutterAudioRecorder now is optional when instantiating.
  • Overwrite file extension when there is conflicts between extension and audioFormat.
  • Update Example app.
  • Update README.

0.1.3 #

  • Fix README.md errors.

0.1.2 #

  • Updated Package Description.

0.1.1 #

  • Chinese Documentation added.

0.1.0 #

  • Documentation added.

0.0.1 #

  • Initial Release.

example/README.md

flutter_audio_recorder_example #

Demonstrates how to use the flutter_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:
  flutter_audio_recorder: ^0.3.0

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:flutter_audio_recorder/flutter_audio_recorder.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
66
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
83
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-0.36 points)

45 out of 46 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/flutter_audio_recorder.dart. (-0.50 points)

Analysis of lib/flutter_audio_recorder.dart reported 1 hint:

line 5 col 8: Unused import: 'package:flutter/cupertino.dart'.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
file ^5.0.4 5.1.0
flutter 0.0.0
path ^1.5.1 1.6.4
Transitive dependencies
collection 1.14.11 1.14.12
intl 0.16.0
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test