flutter_plugin-audio_recorder
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)
ios permission
add usage description to plist plugin
<key>nsmicrophoneusagedescription</key>
<string>can we use your microphone please</string>
usage
init (run this before start
, so we could check if file with given name already exists)
var recorder = flutteraudiorecorder("filename", audioformat.aac);
await _recorder.initialized;
or
var recorder = flutteraudiorecorder("filename.mp4"); // .wav .aac .m4a
await _recorder.initialized;
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
name | description |
---|---|
path | string |
extension | string |
duration | duration |
audioformat | audioformat |
metering | audiometering |
status | recordingstatus |
recording.metering
name | description |
---|---|
peakpower | double |
averagepower | double |
ismeteringenabled | bool |
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.
Comments are closed.