官方介绍
这个插件为android和ios平台提供了简单的记录器和播放器功能。这仅支持每个平台的默认文件扩展名。该插件可以处理来自远程URL的文件,也可以处理本地播放流(通过桥接同步准确时间)。
需要权限
iOS:需要在info.plist文件添加一下权限
NSMicrophoneUsageDescription
This sample uses the microphone to record your speech and convert it to text.
UIBackgroundModes
audio
image.png
Android:需要AndroidManifest.xml
image.png
官方的功能方法
image.png
用法
生成对象
FlutterSound flutterSound = new FlutterSound();
一、录音功能
1.启动录音
//file是文件名,比如 file = Platform.isIOS ? 'ios.m4a' : 'android.mp4'
Future result = await flutterSound.startRecorder(file);
返回录音音频文件的uri路径字符串成。
2.停止录音
Future result = await fl