提交 9b582660 authored 作者: yueweilu's avatar yueweilu

两端都适用的目录

上级 151d27d7
......@@ -304,13 +304,14 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
startRecording = true;
String filePath = await Tools.getDirectory();
String fileName = Tools.generateVoiceFileName();
Console.log('record---------------------$filePath/$fileName');
_mRecorder.startRecorder(
toFile: '$filePath/$fileName',
audioSource: AudioSource.microphone,
codec: Codec.aacMP4,
);
// _mRecorder?.setSubscriptionDuration(Duration(milliseconds: 100));
// _mRecorder?.onProgress?.listen((e)
// {
......@@ -325,6 +326,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
void stopRecorder() async{
startRecording = false;
final path = await _mRecorder.stopRecorder();
Console.log('stopRecorder-----------path---------------------$path');
var duration = await audioPlayer.setFilePath(path!);
Console.log('-----duration---------------------$duration------');
AudioModel audioModel = AudioModel(path: path,duration: Tools.formatDuration(duration!),currentDuration: '0:00:00');
......
......@@ -38,7 +38,7 @@ abstract class Tools {
static Future<String> getDirectory() async {
// getTemporaryDirectory
final directory = await getApplicationSupportDirectory();
final directory = await getTemporaryDirectory();
return directory!.path;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论