提交 fc04f6da authored 作者: yueweilu's avatar yueweilu

录音问题

上级 18dec114
......@@ -90,6 +90,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
///------------------------------------------ 页面 生命周期--------------------------------------------------------
@override
void onInit() async {
......@@ -136,6 +137,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
contentInput.dispose();
flutterTts.stop();
searchInput.dispose();
_mRecorder.closeRecorder();
_mRecorder == null;
// 关闭防截屏
// await ScreenProtector.preventScreenshotOff();
super.onClose();
......@@ -311,9 +314,10 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
startRecording = true;
String filePath = await Tools.getDirectory();
String fileName = Tools.generateVoiceFileName();
Console.log('record---------------------$filePath/$fileName');
String recordePath = '$filePath/$fileName';
Console.log('record---------------------$recordePath');
_mRecorder.startRecorder(
toFile: '$filePath/$fileName',
toFile: recordePath,
audioSource: AudioSource.microphone,
codec: Codec.aacMP4,
......@@ -334,12 +338,15 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
startRecording = false;
final path = await _mRecorder.stopRecorder();
Console.log('stopRecorder-----------path---------------------$path');
if(path!=null && path.isNotEmpty){
var duration = await audioPlayer.setFilePath(path!);
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');
if(audioModel.duration !='0:00:00'){
discussInputAudios.add(audioModel);
}
}
update();
}
......
......@@ -130,7 +130,7 @@ class _ReadDiscussPageState extends State<ReadDiscussPage> {
Visibility(
visible: controller.showReply,
child: Positioned(
bottom:-69,
bottom:-69.w,
left: 0,
right: 0,
top: 0,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论