flutter_desktop_audio_recorder

Last updated:

0 purchases

flutter_desktop_audio_recorder Image
flutter_desktop_audio_recorder Images
Add to Cart

Description:

flutter desktop audio recorder

flutter_desktop_audio_recorder #
This is a Flutter package allowing you to record audio for:

macOS
windows

Output file type #

macOS: .m4a
windows: .wav

Usage #

FlutterDesktopAudioRecorder recorder = FlutterDesktopAudioRecorder();

@override
void initState() {
super.initState();

_hasMicPermission = await recorder.hasMicPermission();

recorder.permissionGrantedListener = () {
if (!mounted) return;
setState(() {
_hasMicPermission = true;
});
};
}

Future startRecording() async {
_fileName = DateTime.now().millisecondsSinceEpoch.toString();
String path = await Utilities.getVoiceFilePath();
try {
return await recorder.start(path: path, fileName: _fileName);
} on PlatformException catch (e) {
switch (e.code) {
case "permissionError":
recorder.requestMicPermission();
break;
default:
}
log(e.message ?? "Unhandled error");
}
}

Future stopRecording() async {
return recorder.stop();
}

Future isRecording() async {
return recorder.isRecording();
}
copied to clipboard
macOS Permission #
1. Add usage description to plist
```
<key>NSMicrophoneUsageDescription</key>
<string>Can We Use Your Microphone Please</string>
```
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.