Visibility(
visible: isRecording == false,
child: TextButton(
onPressed: () async {
final recording = await _recorder.getCurrentRecording();
if (recording != null) {
await _audioPlayer.play(recording.path);
}
},
错误:未为类型“MicrophoneRecorder”定义方法“getCurrentRecording”。
我该怎么办?
我尝试升级麦克风包,并执行Flutter清洁命令
1条答案
按热度按时间fnx2tebb1#
在microphone library docs上似乎没有
getCurrentRecording
的方法定义,这很可能是你遇到这个问题的原因。你可以在MicrophoneRecorder Class Docs上找到MicrophoneRecorder
支持的所有方法。也就是说,为了检索记录,您可以使用以下内容:
1.录制一些东西,然后停止录制(这只是这里的一个例子,很可能你需要使用一些逻辑来实现这一点-iidoEe.,2个按钮来开始和停止录制等)。
1.取回录音
有一个非常好的示例应用程序演示了GitHub: microphone example app上的麦克风库。它可以给予一些关于如何利用这个包的想法。
希望有帮助。
干杯
约阿尼斯