a506beff
吴启风
feat:先声sdk方法找不到问题...
|
1
|
import 'package:audioplayers/audioplayers.dart';
|
1dc46cf7
吴启风
feat:绘本ui
|
2
|
import 'package:flutter/cupertino.dart';
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
3
4
|
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
|
1dc46cf7
吴启风
feat:绘本ui
|
5
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
6
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
6051f850
吴启风
feat:带隐私合规权限申请描述的...
|
7
|
import 'package:permission_handler/permission_handler.dart';
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
8
|
import 'package:wow_english/pages/reading/widgets/ReadingModeType.dart';
|
820997e6
吴启风
feat:过渡页-绘本环节
|
9
10
11
|
import 'package:wow_english/pages/section/subsection/base_section/bloc.dart';
import 'package:wow_english/pages/section/subsection/base_section/event.dart';
import 'package:wow_english/pages/section/subsection/base_section/state.dart';
|
1dc46cf7
吴启风
feat:绘本ui
|
12
|
|
dae7f2fd
吴启风
feat:增加android端先声...
|
13
|
import '../../../common/core/user_util.dart';
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
14
15
16
|
import '../../../common/request/dao/listen_dao.dart';
import '../../../common/request/exception.dart';
import '../../../models/course_process_entity.dart';
|
820997e6
吴启风
feat:过渡页-绘本环节
|
17
|
import '../../../route/route.dart';
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
18
|
import '../../../utils/loading.dart';
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
19
|
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
20
|
import '../../../utils/log_util.dart';
|
20345cbf
吴启风
feat:修改头像权限androi...
|
21
|
import '../../../common/permission/permissionRequestPage.dart';
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
22
|
|
1dc46cf7
吴启风
feat:绘本ui
|
23
24
25
|
part 'reading_event.dart';
part 'reading_state.dart';
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
enum VoicePlayState {
///未知
unKnow,
///播放中
playing,
///播放完成
completed,
///播放终止
stop
}
|
820997e6
吴启风
feat:过渡页-绘本环节
|
40
41
|
class ReadingPageBloc
extends BaseSectionBloc<ReadingPageEvent, ReadingPageState> {
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
42
43
|
final PageController pageController;
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
44
45
|
final String courseLessonId;
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
46
47
48
49
|
///当前页索引
int _currentPage = 0;
///当前播放模式
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
50
|
ReadingModeType _currentMode = ReadingModeType.manual;
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
51
52
53
54
55
|
int get currentPage => _currentPage + 1;
ReadingModeType get currentMode => _currentMode;
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
56
57
58
59
60
61
62
63
64
|
CourseProcessEntity? _entity;
CourseProcessEntity? get entity => _entity;
///正在评测
bool _isRecording = false;
bool get isRecording => _isRecording;
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
///原始音频是否正在播放
bool _isOriginAudioPlaying = false;
bool get isOriginAudioPlaying => _isOriginAudioPlaying;
///录音音频是否正在播放
bool _isRecordAudioPlaying = false;
bool get isRecordAudioPlaying => _isRecordAudioPlaying;
///正在播放音频状态
VoicePlayState _voicePlayState = VoicePlayState.unKnow;
VoicePlayState get voicePlayState => _voicePlayState;
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
80
81
82
83
|
late MethodChannel methodChannel;
late AudioPlayer audioPlayer;
|
6051f850
吴启风
feat:带隐私合规权限申请描述的...
|
84
85
86
|
final BuildContext context;
ReadingPageBloc(this.context, this.pageController, this.courseLessonId)
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
87
|
: super(ReadingPageInitial()) {
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
88
|
on<CurrentPageIndexChangeEvent>(_pageControllerChange);
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
89
|
on<CurrentModeChangeEvent>(_playModeChange);
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
90
91
92
|
// pageController.addListener(() {
// _currentPage = pageController.page!.round();
// });
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
93
|
on<RequestDataEvent>(_requestData);
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
94
|
on<InitBlocEvent>((event, emit) {
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
95
96
|
//音频播放器
audioPlayer = AudioPlayer();
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
97
|
audioPlayer.onPlayerStateChanged.listen((event) async {
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
98
|
Log.d("播放状态变化 event=$event");
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
99
|
if (event == PlayerState.completed) {
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
100
101
|
debugPrint('播放完成');
_voicePlayState = VoicePlayState.completed;
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
102
|
_onAudioPlayComplete();
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
103
104
105
106
|
}
if (event == PlayerState.stopped) {
debugPrint('播放结束');
_voicePlayState = VoicePlayState.stop;
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
107
|
}
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
108
|
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
109
110
111
112
|
if (event == PlayerState.playing) {
debugPrint('正在播放中');
_voicePlayState = VoicePlayState.playing;
}
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
113
114
115
116
117
118
|
if (event == PlayerState.disposed) {
debugPrint('播放器释放');
_voicePlayState = VoicePlayState.unKnow;
}
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
119
120
|
if (isClosed) {
return;
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
121
|
}
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
122
|
add(VoicePlayStateChangeEvent());
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
123
124
|
});
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
125
126
127
|
methodChannel =
const MethodChannel('wow_english/sing_sound_method_channel');
methodChannel.invokeMethod('initVoiceSdk', {}); //初始化评测
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
128
|
methodChannel.setMethodCallHandler((call) async {
|
6051f850
吴启风
feat:带隐私合规权限申请描述的...
|
129
130
|
Log.d(
"setMethodCallHandler method=${call.method} arguments=${call.arguments}");
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
131
132
133
134
135
136
137
138
139
140
141
|
if (call.method == 'voiceResult') {
//评测结果
add(XSVoiceResultEvent(call.arguments));
return;
}
if (call.method == 'voiceStart') {
//评测开始
if (kDebugMode) {
print('评测开始');
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
142
143
|
_isRecording = true;
add(OnXSVoiceStateChangeEvent());
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
144
145
146
|
return;
}
|
46c68b45
吴启风
feat:翻页取消先声评测&增加先...
|
147
148
|
if (call.method == 'voiceEnd' || call.method == 'voiceCancel') {
//评测结束or评测取消
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
149
|
if (kDebugMode) {
|
46c68b45
吴启风
feat:翻页取消先声评测&增加先...
|
150
|
print(call.method == 'voiceEnd' ? '评测结束' : '评测取消');
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
151
|
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
152
153
|
_isRecording = false;
add(OnXSVoiceStateChangeEvent());
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
154
155
156
157
158
|
return;
}
if (call.method == 'voiceFail') {
//评测失败
|
46c68b45
吴启风
feat:翻页取消先声评测&增加先...
|
159
|
_isRecording = false;
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
160
161
|
EasyLoading.showToast('评测失败');
return;
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
162
163
164
|
}
});
});
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
165
|
on<VoicePlayStateChangeEvent>(_voicePlayStateChange);
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
166
|
on<PlayOriginalAudioEvent>(_playOriginalAudio);
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
167
168
169
|
on<XSVoiceInitEvent>(_initVoiceSdk);
on<XSVoiceStartEvent>(_voiceXsStart);
on<XSVoiceStopEvent>(_voiceXsStop);
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
170
|
on<XSVoiceResultEvent>(_voiceXsResult);
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
171
|
on<OnXSVoiceStateChangeEvent>(_onVoiceXsStateChange);
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
172
173
|
on<PlayRecordAudioEvent>(_playRecordAudio);
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
174
175
176
177
178
|
}
@override
Future<void> close() {
pageController.dispose();
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
179
180
|
audioPlayer.release();
audioPlayer.dispose();
|
6b0947ca
吴启风
feat:绘本增加initVoic...
|
181
|
_voiceXsCancel();
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
182
183
184
|
return super.close();
}
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
185
186
|
void _pageControllerChange(CurrentPageIndexChangeEvent event,
Emitter<ReadingPageState> emitter) async {
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
187
|
_currentPage = event.pageIndex;
|
46c68b45
吴启风
feat:翻页取消先声评测&增加先...
|
188
|
_voiceXsCancel();
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
189
|
_playOriginalAudioInner(null, forcePlay: true);
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
190
191
192
|
emitter(CurrentPageIndexState());
}
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
193
|
void _playModeChange(
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
194
|
CurrentModeChangeEvent event, Emitter<ReadingPageState> emitter) async {
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
195
196
197
198
199
200
|
if (_currentMode == ReadingModeType.auto) {
_currentMode = ReadingModeType.manual;
} else {
_currentMode = ReadingModeType.auto;
}
emitter(CurrentModeState());
|
1dc46cf7
吴启风
feat:绘本ui
|
201
|
}
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
202
203
204
205
206
207
|
///请求数据
void _requestData(
RequestDataEvent event, Emitter<ReadingPageState> emitter) async {
try {
await loading(() async {
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
208
|
_entity = await ListenDao.process(courseLessonId);
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
209
|
Log.d("reading page entity: ${_entity!.toJson()}");
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
210
211
212
213
214
215
216
217
218
|
emitter(RequestDataState());
});
} catch (e) {
if (e is ApiException) {
EasyLoading.showToast(e.message ?? '请求失败,请检查网络连接');
}
}
}
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
219
220
221
222
223
224
|
/// 播放绘本原音
void _playOriginalAudio(
PlayOriginalAudioEvent event, Emitter<ReadingPageState> emitter) async {
_playOriginalAudioInner(event.url);
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
225
|
///播放原音音频
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
226
227
228
|
/// - [force]: 是否强制播放(true:不管当前状态如何,都会播放目标原音音频,比如翻页场景)
/// (false:如果正在播放,暂停播放,比如点击播放按钮场景)
void _playOriginalAudioInner(String? audioUrl, {bool forcePlay = false}) async {
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
229
|
if (_isRecordAudioPlaying) {
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
230
|
await audioPlayer.stop();
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
231
232
|
_isRecordAudioPlaying = false;
}
|
6051f850
吴启风
feat:带隐私合规权限申请描述的...
|
233
234
|
Log.d(
"_playOriginalAudio _isRecordAudioPlaying=$_isRecordAudioPlaying _isOriginAudioPlaying=$_isOriginAudioPlaying url=$audioUrl");
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
235
|
if (_isOriginAudioPlaying) {
|
75e0dcd2
吴启风
feat:修复绘本音频ios听筒出声
|
236
|
await audioPlayer.stop();
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
237
238
239
240
241
242
|
_isOriginAudioPlaying = false;
if (forcePlay) {
audioUrl ??= currentPageData()?.audioUrl ?? '';
await _playAudio(audioUrl);
_isOriginAudioPlaying = true;
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
243
|
} else {
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
244
|
audioUrl ??= currentPageData()?.audioUrl ?? '';
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
245
246
|
await _playAudio(audioUrl);
_isOriginAudioPlaying = true;
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
247
|
}
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
248
249
|
}
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
250
251
252
253
254
255
|
/// 播放录音
void _playRecordAudio(
PlayRecordAudioEvent event, Emitter<ReadingPageState> emitter) async {
_playRecordAudioInner();
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
256
|
Future<void> _playRecordAudioInner() async {
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
257
258
259
|
Log.d(
"_playRecordAudioInner _isOriginAudioPlaying=$_isOriginAudioPlaying _isRecordAudioPlaying=$_isRecordAudioPlaying url=${currentPageData()
?.recordUrl}");
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
260
|
if (_isOriginAudioPlaying) {
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
261
262
|
///如果正在播放原音,暂停
await audioPlayer.stop();
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
263
264
|
_isOriginAudioPlaying = false;
}
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
265
|
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
266
|
if (_isRecordAudioPlaying) {
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
267
|
await audioPlayer.stop();
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
268
|
_isRecordAudioPlaying = false;
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
269
|
} else {
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
270
|
final recordAudioUrl = currentPageData()?.recordUrl;
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
271
272
|
await _playAudio(recordAudioUrl);
_isRecordAudioPlaying = true;
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
273
|
}
|
ad37b653
吴启风
feat:1、完成微信支付;2、商...
|
274
|
// emitter(VoicePlayStateChange());
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
275
276
|
}
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
277
|
Future<void> _playAudio(String? audioUrl) async {
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
278
279
|
if (audioUrl!.isNotEmpty) {
await audioPlayer.play(UrlSource(audioUrl));
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
280
281
282
283
|
}
}
int dataCount() {
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
284
285
286
287
288
289
290
|
return _entity?.readings?.length ?? 0;
}
CourseProcessReadings? currentPageData() {
return _entity?.readings?[_currentPage];
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
291
|
void nextPage() {
|
820997e6
吴启风
feat:过渡页-绘本环节
|
292
293
294
295
296
297
298
299
300
301
302
|
if (currentPage >= dataCount()) {
sectionComplete(() {
popPage(data: {
'currentStep': currentPage,
'courseLessonId': courseLessonId,
'isCompleted': true,
'nextSection': true
});
}, againSectionTap: () {
pageController.jumpToPage(0);
});
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
303
304
305
|
} else {
_currentPage += 1;
pageController.nextPage(
|
8df5fbf9
吴启风
feat:单元列表页由于ios嵌套...
|
306
|
duration: const Duration(milliseconds: 250),
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
307
308
309
310
311
|
curve: Curves.ease,
);
}
}
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
312
313
314
315
316
317
|
///初始化SDK
_initVoiceSdk(
XSVoiceInitEvent event, Emitter<ReadingPageState> emitter) async {
methodChannel.invokeMethod('initVoiceSdk', event.data);
}
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
318
|
///先声测试
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
319
320
|
void _voiceXsStart(
XSVoiceStartEvent event, Emitter<ReadingPageState> emitter) async {
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
321
|
await _stopAudio();
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
322
|
startRecord(event.content);
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
323
324
|
}
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
325
|
///开始录音
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
326
|
void startRecord(String content) async {
|
6051f850
吴启风
feat:带隐私合规权限申请描述的...
|
327
|
// 调用封装好的权限检查和请求方法
|
820997e6
吴启风
feat:过渡页-绘本环节
|
328
329
|
bool result =
await permissionCheckAndRequest(context, Permission.microphone, "录音");
|
6051f850
吴启风
feat:带隐私合规权限申请描述的...
|
330
|
if (result) {
|
820997e6
吴启风
feat:过渡页-绘本环节
|
331
332
333
334
335
|
methodChannel.invokeMethod('startVoice', {
'word': content,
'type': '0',
'userId': UserUtil.getUser()?.id.toString()
});
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
336
|
}
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
337
338
|
}
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
339
340
|
void _voiceXsResult(
XSVoiceResultEvent event, Emitter<ReadingPageState> emitter) async {
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
341
342
343
344
345
|
final Map args = event.message as Map;
final result = args['result'] as Map;
Log.d("_voiceXsResult result=$result");
final overall = result['overall'].toString();
EasyLoading.showToast('测评成功,分数是$overall',
|
a6ad33b3
吴启风
feat:绘本评测结果toast时长修改
|
346
|
duration: const Duration(seconds: 2));
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
347
348
349
|
currentPageData()?.recordScore = overall;
currentPageData()?.recordUrl = args['audioUrl'] + '.mp3';
///完成录音后紧接着播放录音
|
820997e6
吴启风
feat:过渡页-绘本环节
|
350
351
352
353
354
355
356
357
358
359
360
361
362
363
|
await _playRecordAudioInner();
if (isLastPage()) {
sectionComplete(() {
popPage(data: {
'currentStep': currentPage,
'courseLessonId': courseLessonId,
'isCompleted': true,
'nextSection': true
});
}, againSectionTap: () {
_resetLocalResult();
pageController.jumpToPage(0);
});
}
|
a6ad33b3
吴启风
feat:绘本评测结果toast时长修改
|
364
|
// emitter(FeedbackState());
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
365
|
}
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
366
367
368
369
370
371
372
|
///终止评测
void _voiceXsStop(
XSVoiceStopEvent event, Emitter<ReadingPageState> emitter) async {
methodChannel.invokeMethod('stopVoice');
}
|
6b0947ca
吴启风
feat:绘本增加initVoic...
|
373
374
|
///取消评测(用于处理退出页面后录音未停止等异常情况的保护操作)
void _voiceXsCancel() {
|
46c68b45
吴启风
feat:翻页取消先声评测&增加先...
|
375
376
377
378
|
Log.d("取消评测 _voiceXsCancel _isRecording=$_isRecording");
if (_isRecording) {
methodChannel.invokeMethod('cancelVoice');
}
|
6b0947ca
吴启风
feat:绘本增加initVoic...
|
379
380
|
}
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
381
382
383
384
385
|
void _voicePlayStateChange(VoicePlayStateChangeEvent event,
Emitter<ReadingPageState> emitter) async {
emitter(VoicePlayStateChange());
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
386
387
388
389
390
|
void _onAudioPlayComplete() {
if (_isRecordAudioPlaying && _currentMode == ReadingModeType.auto) {
nextPage();
}
|
820997e6
吴启风
feat:过渡页-绘本环节
|
391
392
393
|
Log.d(
"_onAudioPlayComplete _isOriginAudioPlaying=$_isOriginAudioPlaying _voicePlayState=$_voicePlayState recordUrl=${currentPageData()?.recordUrl?.isNotEmpty}");
if (_isOriginAudioPlaying &&
|
820997e6
吴启风
feat:过渡页-绘本环节
|
394
|
currentPageData()?.recordUrl?.isNotEmpty != true) {
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
395
396
397
398
399
400
401
402
|
///如果刚刚完成原音播放&&录音为空,则开始录音
startRecord(currentPageData()?.word ?? '');
}
_isOriginAudioPlaying = false;
_isRecordAudioPlaying = false;
}
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
403
|
Future<void> _stopAudio() async {
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
404
405
406
407
|
await audioPlayer.stop();
_isOriginAudioPlaying = false;
_isRecordAudioPlaying = false;
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
408
|
|
820997e6
吴启风
feat:过渡页-绘本环节
|
409
410
|
void _onVoiceXsStateChange(OnXSVoiceStateChangeEvent event,
Emitter<ReadingPageState> emitter) async {
|
ad37b653
吴启风
feat:1、完成微信支付;2、商...
|
411
|
emitter(XSVoiceTestState());
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
412
|
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
413
|
|
820997e6
吴启风
feat:过渡页-绘本环节
|
414
415
416
417
418
419
420
421
422
423
424
425
426
|
///是否是最后一页
bool isLastPage() {
return currentPage == dataCount();
}
///重置数据
void _resetLocalResult() {
_entity?.readings?.forEach((element) {
element.recordScore = null;
element.recordUrl = null;
});
}
}
|