Commit 081fbff7be29ab2dbef3f33270b9b623e0a9ad60
1 parent
e0e89ade
feat:性能优化-录音内存泄漏
Showing
1 changed file
with
3 additions
and
3 deletions
lib/pages/reading/bloc/reading_bloc.dart
| ... | ... | @@ -187,7 +187,7 @@ class ReadingPageBloc |
| 187 | 187 | pageController.dispose(); |
| 188 | 188 | audioPlayer.release(); |
| 189 | 189 | audioPlayer.dispose(); |
| 190 | - _voiceXsCancel(); | |
| 190 | + _voiceXsCancel(force: true); | |
| 191 | 191 | return super.close(); |
| 192 | 192 | } |
| 193 | 193 | |
| ... | ... | @@ -387,9 +387,9 @@ class ReadingPageBloc |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | ///取消评测(用于处理退出页面后录音未停止等异常情况的保护操作) |
| 390 | - void _voiceXsCancel() { | |
| 390 | + void _voiceXsCancel({bool force = false}) { | |
| 391 | 391 | Log.d("取消评测 _voiceXsCancel _isRecording=$_isRecording"); |
| 392 | - if (_isRecording) { | |
| 392 | + if (_isRecording || force) { | |
| 393 | 393 | methodChannel.invokeMethod('cancelVoice'); |
| 394 | 394 | } |
| 395 | 395 | } | ... | ... |