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