Commit 93efa69f5c3b36305b409baf120382e9a721d9b9
1 parent
da57e288
删除评测代码
Showing
1 changed file
with
5 additions
and
11 deletions
lib/pages/reading/bloc/reading_bloc.dart
... | ... | @@ -130,8 +130,6 @@ class ReadingPageBloc |
130 | 130 | "setMethodCallHandler method=${call.method} arguments=${call.arguments}"); |
131 | 131 | if (call.method == 'voiceResult') { |
132 | 132 | //评测结果 |
133 | - await audioPlayer.setAudioContext(AudioContext()); | |
134 | - await audioPlayer.setBalance(0.0); | |
135 | 133 | add(XSVoiceResultEvent(call.arguments)); |
136 | 134 | return; |
137 | 135 | } |
... | ... | @@ -152,8 +150,6 @@ class ReadingPageBloc |
152 | 150 | print(call.method == 'voiceEnd' ? '评测结束' : '评测取消'); |
153 | 151 | } |
154 | 152 | _isRecording = false; |
155 | - await audioPlayer.setAudioContext(AudioContext()); | |
156 | - await audioPlayer.setBalance(0.0); | |
157 | 153 | add(OnXSVoiceStateChangeEvent()); |
158 | 154 | return; |
159 | 155 | } |
... | ... | @@ -161,8 +157,6 @@ class ReadingPageBloc |
161 | 157 | if (call.method == 'voiceFail') { |
162 | 158 | //评测失败 |
163 | 159 | _isRecording = false; |
164 | - await audioPlayer.setAudioContext(AudioContext()); | |
165 | - await audioPlayer.setBalance(0.0); | |
166 | 160 | EasyLoading.showToast('评测失败'); |
167 | 161 | return; |
168 | 162 | } |
... | ... | @@ -231,7 +225,8 @@ class ReadingPageBloc |
231 | 225 | ///播放原音音频 |
232 | 226 | /// - [force]: 是否强制播放(true:不管当前状态如何,都会播放目标原音音频,比如翻页场景) |
233 | 227 | /// (false:如果正在播放,暂停播放,比如点击播放按钮场景) |
234 | - void _playOriginalAudioInner(String? audioUrl, {bool forcePlay = false}) async { | |
228 | + void _playOriginalAudioInner(String? audioUrl, | |
229 | + {bool forcePlay = false}) async { | |
235 | 230 | if (_isRecordAudioPlaying) { |
236 | 231 | await audioPlayer.stop(); |
237 | 232 | _isRecordAudioPlaying = false; |
... | ... | @@ -261,8 +256,7 @@ class ReadingPageBloc |
261 | 256 | |
262 | 257 | Future<void> _playRecordAudioInner() async { |
263 | 258 | Log.d( |
264 | - "_playRecordAudioInner _isOriginAudioPlaying=$_isOriginAudioPlaying _isRecordAudioPlaying=$_isRecordAudioPlaying url=${currentPageData() | |
265 | - ?.recordUrl}"); | |
259 | + "_playRecordAudioInner _isOriginAudioPlaying=$_isOriginAudioPlaying _isRecordAudioPlaying=$_isRecordAudioPlaying url=${currentPageData()?.recordUrl}"); | |
266 | 260 | if (_isOriginAudioPlaying) { |
267 | 261 | ///如果正在播放原音,暂停 |
268 | 262 | await audioPlayer.stop(); |
... | ... | @@ -283,8 +277,7 @@ class ReadingPageBloc |
283 | 277 | Future<void> _playAudio(String? audioUrl) async { |
284 | 278 | if (audioUrl!.isNotEmpty) { |
285 | 279 | await audioPlayer.play(UrlSource(audioUrl), |
286 | - balance: 0.0, ctx: AudioContext() | |
287 | - ); | |
280 | + balance: 0.0, ctx: AudioContext()); | |
288 | 281 | } |
289 | 282 | } |
290 | 283 | |
... | ... | @@ -354,6 +347,7 @@ class ReadingPageBloc |
354 | 347 | duration: const Duration(seconds: 2)); |
355 | 348 | currentPageData()?.recordScore = overall; |
356 | 349 | currentPageData()?.recordUrl = args['audioUrl'] + '.mp3'; |
350 | + | |
357 | 351 | ///完成录音后紧接着播放录音 |
358 | 352 | await _playRecordAudioInner(); |
359 | 353 | if (isLastPage()) { | ... | ... |