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

两端都适用的目录

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