Commit 081fbff7be29ab2dbef3f33270b9b623e0a9ad60

Authored by 吴启风
1 parent e0e89ade

feat:性能优化-录音内存泄漏

lib/pages/reading/bloc/reading_bloc.dart
@@ -187,7 +187,7 @@ class ReadingPageBloc @@ -187,7 +187,7 @@ class ReadingPageBloc
187 pageController.dispose(); 187 pageController.dispose();
188 audioPlayer.release(); 188 audioPlayer.release();
189 audioPlayer.dispose(); 189 audioPlayer.dispose();
190 - _voiceXsCancel(); 190 + _voiceXsCancel(force: true);
191 return super.close(); 191 return super.close();
192 } 192 }
193 193
@@ -387,9 +387,9 @@ class ReadingPageBloc @@ -387,9 +387,9 @@ class ReadingPageBloc
387 } 387 }
388 388
389 ///取消评测(用于处理退出页面后录音未停止等异常情况的保护操作) 389 ///取消评测(用于处理退出页面后录音未停止等异常情况的保护操作)
390 - void _voiceXsCancel() { 390 + void _voiceXsCancel({bool force = false}) {
391 Log.d("取消评测 _voiceXsCancel _isRecording=$_isRecording"); 391 Log.d("取消评测 _voiceXsCancel _isRecording=$_isRecording");
392 - if (_isRecording) { 392 + if (_isRecording || force) {
393 methodChannel.invokeMethod('cancelVoice'); 393 methodChannel.invokeMethod('cancelVoice');
394 } 394 }
395 } 395 }