Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

flutter flutter logo audio recorder

flutter #1 audio recorder & storer. record audio and store it locally.

flutter #1 audio recorder & storer
flutter #1 audio recorder & storer

usage

to use audio recorder 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 uses 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

download the full project for this post from the following button

this source is fully free for all time

download as zip


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Top