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';
|
e811f164
吴启风
feat:权限申请页面增加隐私合规...
|
14
|
import '../../../common/permission/permissionRequester.dart';
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
15
16
17
|
import '../../../common/request/dao/listen_dao.dart';
import '../../../common/request/exception.dart';
import '../../../models/course_process_entity.dart';
|
820997e6
吴启风
feat:过渡页-绘本环节
|
18
|
import '../../../route/route.dart';
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
19
|
import '../../../utils/loading.dart';
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
20
|
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
21
|
import '../../../utils/log_util.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
|
if (call.method == 'voiceResult') {
//评测结果
|
1f5969b8
biao
修复 练习和绘本播放音频问题
|
133
134
135
|
await audioPlayer.setAudioContext(AudioContext());
await audioPlayer.setBalance(0.0);
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
136
137
138
139
140
141
142
143
144
|
add(XSVoiceResultEvent(call.arguments));
return;
}
if (call.method == 'voiceStart') {
//评测开始
if (kDebugMode) {
print('评测开始');
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
145
146
|
_isRecording = true;
add(OnXSVoiceStateChangeEvent());
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
147
148
149
|
return;
}
|
46c68b45
吴启风
feat:翻页取消先声评测&增加先...
|
150
151
|
if (call.method == 'voiceEnd' || call.method == 'voiceCancel') {
//评测结束or评测取消
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
152
|
if (kDebugMode) {
|
46c68b45
吴启风
feat:翻页取消先声评测&增加先...
|
153
|
print(call.method == 'voiceEnd' ? '评测结束' : '评测取消');
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
154
|
}
|
1f5969b8
biao
修复 练习和绘本播放音频问题
|
155
156
157
|
await audioPlayer.setAudioContext(AudioContext());
await audioPlayer.setBalance(0.0);
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
158
|
_isRecording = false;
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
159
|
add(OnXSVoiceStateChangeEvent());
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
160
161
162
163
164
|
return;
}
if (call.method == 'voiceFail') {
//评测失败
|
46c68b45
吴启风
feat:翻页取消先声评测&增加先...
|
165
|
_isRecording = false;
|
1f5969b8
biao
修复 练习和绘本播放音频问题
|
166
167
168
|
await audioPlayer.setAudioContext(AudioContext());
await audioPlayer.setBalance(0.0);
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
169
170
|
EasyLoading.showToast('评测失败');
return;
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
171
172
173
|
}
});
});
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
174
|
on<VoicePlayStateChangeEvent>(_voicePlayStateChange);
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
175
|
on<PlayOriginalAudioEvent>(_playOriginalAudio);
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
176
177
178
|
on<XSVoiceInitEvent>(_initVoiceSdk);
on<XSVoiceStartEvent>(_voiceXsStart);
on<XSVoiceStopEvent>(_voiceXsStop);
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
179
|
on<XSVoiceResultEvent>(_voiceXsResult);
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
180
|
on<OnXSVoiceStateChangeEvent>(_onVoiceXsStateChange);
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
181
182
|
on<PlayRecordAudioEvent>(_playRecordAudio);
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
183
184
185
186
187
|
}
@override
Future<void> close() {
pageController.dispose();
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
188
189
|
audioPlayer.release();
audioPlayer.dispose();
|
6b0947ca
吴启风
feat:绘本增加initVoic...
|
190
|
_voiceXsCancel();
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
191
192
193
|
return super.close();
}
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
194
195
|
void _pageControllerChange(CurrentPageIndexChangeEvent event,
Emitter<ReadingPageState> emitter) async {
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
196
|
_currentPage = event.pageIndex;
|
46c68b45
吴启风
feat:翻页取消先声评测&增加先...
|
197
|
_voiceXsCancel();
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
198
|
_playOriginalAudioInner(null, forcePlay: true);
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
199
200
201
|
emitter(CurrentPageIndexState());
}
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
202
|
void _playModeChange(
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
203
|
CurrentModeChangeEvent event, Emitter<ReadingPageState> emitter) async {
|
2a427e12
吴启风
feat:绘本静态ui基本完成
|
204
205
206
207
208
209
|
if (_currentMode == ReadingModeType.auto) {
_currentMode = ReadingModeType.manual;
} else {
_currentMode = ReadingModeType.auto;
}
emitter(CurrentModeState());
|
1dc46cf7
吴启风
feat:绘本ui
|
210
|
}
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
211
212
213
214
215
216
|
///请求数据
void _requestData(
RequestDataEvent event, Emitter<ReadingPageState> emitter) async {
try {
await loading(() async {
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
217
|
_entity = await ListenDao.process(courseLessonId);
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
218
|
Log.d("reading page entity: ${_entity!.toJson()}");
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
219
220
221
222
223
224
225
226
227
|
emitter(RequestDataState());
});
} catch (e) {
if (e is ApiException) {
EasyLoading.showToast(e.message ?? '请求失败,请检查网络连接');
}
}
}
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
228
229
230
231
232
233
|
/// 播放绘本原音
void _playOriginalAudio(
PlayOriginalAudioEvent event, Emitter<ReadingPageState> emitter) async {
_playOriginalAudioInner(event.url);
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
234
|
///播放原音音频
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
235
236
|
/// - [force]: 是否强制播放(true:不管当前状态如何,都会播放目标原音音频,比如翻页场景)
/// (false:如果正在播放,暂停播放,比如点击播放按钮场景)
|
93efa69f
biao
删除评测代码
|
237
238
|
void _playOriginalAudioInner(String? audioUrl,
{bool forcePlay = false}) async {
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
239
|
if (_isRecordAudioPlaying) {
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
240
|
await audioPlayer.stop();
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
241
242
|
_isRecordAudioPlaying = false;
}
|
6051f850
吴启风
feat:带隐私合规权限申请描述的...
|
243
244
|
Log.d(
"_playOriginalAudio _isRecordAudioPlaying=$_isRecordAudioPlaying _isOriginAudioPlaying=$_isOriginAudioPlaying url=$audioUrl");
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
245
|
if (_isOriginAudioPlaying) {
|
75e0dcd2
吴启风
feat:修复绘本音频ios听筒出声
|
246
|
await audioPlayer.stop();
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
247
248
249
250
251
252
|
_isOriginAudioPlaying = false;
if (forcePlay) {
audioUrl ??= currentPageData()?.audioUrl ?? '';
await _playAudio(audioUrl);
_isOriginAudioPlaying = true;
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
253
|
} else {
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
254
|
audioUrl ??= currentPageData()?.audioUrl ?? '';
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
255
256
|
await _playAudio(audioUrl);
_isOriginAudioPlaying = true;
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
257
|
}
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
258
259
|
}
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
260
261
262
263
264
265
|
/// 播放录音
void _playRecordAudio(
PlayRecordAudioEvent event, Emitter<ReadingPageState> emitter) async {
_playRecordAudioInner();
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
266
|
Future<void> _playRecordAudioInner() async {
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
267
|
Log.d(
|
93efa69f
biao
删除评测代码
|
268
|
"_playRecordAudioInner _isOriginAudioPlaying=$_isOriginAudioPlaying _isRecordAudioPlaying=$_isRecordAudioPlaying url=${currentPageData()?.recordUrl}");
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
269
|
if (_isOriginAudioPlaying) {
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
270
271
|
///如果正在播放原音,暂停
await audioPlayer.stop();
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
272
273
|
_isOriginAudioPlaying = false;
}
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
274
|
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
275
|
if (_isRecordAudioPlaying) {
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
276
|
await audioPlayer.stop();
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
277
|
_isRecordAudioPlaying = false;
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
278
|
} else {
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
279
|
final recordAudioUrl = currentPageData()?.recordUrl;
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
280
281
|
await _playAudio(recordAudioUrl);
_isRecordAudioPlaying = true;
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
282
|
}
|
ad37b653
吴启风
feat:1、完成微信支付;2、商...
|
283
|
// emitter(VoicePlayStateChange());
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
284
285
|
}
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
286
|
Future<void> _playAudio(String? audioUrl) async {
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
287
|
if (audioUrl!.isNotEmpty) {
|
1f5969b8
biao
修复 练习和绘本播放音频问题
|
288
289
|
await audioPlayer.play(UrlSource(audioUrl),
balance: 0.0, ctx: AudioContext());
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
290
291
292
293
|
}
}
int dataCount() {
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
294
295
296
297
298
299
300
|
return _entity?.readings?.length ?? 0;
}
CourseProcessReadings? currentPageData() {
return _entity?.readings?[_currentPage];
}
|
4d8b0da4
吴启风
feat:绘本跟读底部ui优化
|
301
302
303
304
305
|
///当前页绘本跟读内容
String readingContent() {
return currentPageData()?.word?.trim() ?? '';
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
306
|
void nextPage() {
|
820997e6
吴启风
feat:过渡页-绘本环节
|
307
308
309
310
311
312
313
314
315
316
317
|
if (currentPage >= dataCount()) {
sectionComplete(() {
popPage(data: {
'currentStep': currentPage,
'courseLessonId': courseLessonId,
'isCompleted': true,
'nextSection': true
});
}, againSectionTap: () {
pageController.jumpToPage(0);
});
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
318
319
320
|
} else {
_currentPage += 1;
pageController.nextPage(
|
8df5fbf9
吴启风
feat:单元列表页由于ios嵌套...
|
321
|
duration: const Duration(milliseconds: 250),
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
322
323
324
325
326
|
curve: Curves.ease,
);
}
}
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
327
328
329
330
331
332
|
///初始化SDK
_initVoiceSdk(
XSVoiceInitEvent event, Emitter<ReadingPageState> emitter) async {
methodChannel.invokeMethod('initVoiceSdk', event.data);
}
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
333
|
///先声测试
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
334
335
|
void _voiceXsStart(
XSVoiceStartEvent event, Emitter<ReadingPageState> emitter) async {
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
336
|
await _stopAudio();
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
337
|
startRecord(event.content);
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
338
339
|
}
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
340
|
///开始录音
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
341
|
void startRecord(String content) async {
|
6051f850
吴启风
feat:带隐私合规权限申请描述的...
|
342
|
// 调用封装好的权限检查和请求方法
|
820997e6
吴启风
feat:过渡页-绘本环节
|
343
|
bool result =
|
e811f164
吴启风
feat:权限申请页面增加隐私合规...
|
344
|
await requestPermission(context, Permission.microphone, "录音", "用于开启录音,识别您的开口作答并给出反馈");
|
6051f850
吴启风
feat:带隐私合规权限申请描述的...
|
345
|
if (result) {
|
820997e6
吴启风
feat:过渡页-绘本环节
|
346
347
348
349
350
|
methodChannel.invokeMethod('startVoice', {
'word': content,
'type': '0',
'userId': UserUtil.getUser()?.id.toString()
});
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
351
|
}
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
352
353
|
}
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
354
355
|
void _voiceXsResult(
XSVoiceResultEvent event, Emitter<ReadingPageState> emitter) async {
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
356
357
358
359
360
|
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时长修改
|
361
|
duration: const Duration(seconds: 2));
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
362
363
|
currentPageData()?.recordScore = overall;
currentPageData()?.recordUrl = args['audioUrl'] + '.mp3';
|
93efa69f
biao
删除评测代码
|
364
|
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
365
|
///完成录音后紧接着播放录音
|
820997e6
吴启风
feat:过渡页-绘本环节
|
366
367
368
369
370
371
372
373
374
375
376
377
378
379
|
await _playRecordAudioInner();
if (isLastPage()) {
sectionComplete(() {
popPage(data: {
'currentStep': currentPage,
'courseLessonId': courseLessonId,
'isCompleted': true,
'nextSection': true
});
}, againSectionTap: () {
_resetLocalResult();
pageController.jumpToPage(0);
});
}
|
a6ad33b3
吴启风
feat:绘本评测结果toast时长修改
|
380
|
// emitter(FeedbackState());
|
a506beff
吴启风
feat:先声sdk方法找不到问题...
|
381
|
}
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
382
383
384
385
386
387
388
|
///终止评测
void _voiceXsStop(
XSVoiceStopEvent event, Emitter<ReadingPageState> emitter) async {
methodChannel.invokeMethod('stopVoice');
}
|
6b0947ca
吴启风
feat:绘本增加initVoic...
|
389
390
|
///取消评测(用于处理退出页面后录音未停止等异常情况的保护操作)
void _voiceXsCancel() {
|
46c68b45
吴启风
feat:翻页取消先声评测&增加先...
|
391
392
393
394
|
Log.d("取消评测 _voiceXsCancel _isRecording=$_isRecording");
if (_isRecording) {
methodChannel.invokeMethod('cancelVoice');
}
|
6b0947ca
吴启风
feat:绘本增加initVoic...
|
395
396
|
}
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
397
398
399
400
401
|
void _voicePlayStateChange(VoicePlayStateChangeEvent event,
Emitter<ReadingPageState> emitter) async {
emitter(VoicePlayStateChange());
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
402
403
404
405
406
|
void _onAudioPlayComplete() {
if (_isRecordAudioPlaying && _currentMode == ReadingModeType.auto) {
nextPage();
}
|
820997e6
吴启风
feat:过渡页-绘本环节
|
407
408
409
|
Log.d(
"_onAudioPlayComplete _isOriginAudioPlaying=$_isOriginAudioPlaying _voicePlayState=$_voicePlayState recordUrl=${currentPageData()?.recordUrl?.isNotEmpty}");
if (_isOriginAudioPlaying &&
|
820997e6
吴启风
feat:过渡页-绘本环节
|
410
|
currentPageData()?.recordUrl?.isNotEmpty != true) {
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
411
412
413
414
415
416
417
418
|
///如果刚刚完成原音播放&&录音为空,则开始录音
startRecord(currentPageData()?.word ?? '');
}
_isOriginAudioPlaying = false;
_isRecordAudioPlaying = false;
}
|
2ee6209a
吴启风
feat:绘本播放状态优化
|
419
|
Future<void> _stopAudio() async {
|
53e9e6db
吴启风
feat:绘本语音评测逻辑
|
420
421
422
423
|
await audioPlayer.stop();
_isOriginAudioPlaying = false;
_isRecordAudioPlaying = false;
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
424
|
|
820997e6
吴启风
feat:过渡页-绘本环节
|
425
426
|
void _onVoiceXsStateChange(OnXSVoiceStateChangeEvent event,
Emitter<ReadingPageState> emitter) async {
|
ad37b653
吴启风
feat:1、完成微信支付;2、商...
|
427
|
emitter(XSVoiceTestState());
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
428
|
}
|
065022b7
吴启风
feat:绘本评测反馈弹窗+原音播...
|
429
|
|
820997e6
吴启风
feat:过渡页-绘本环节
|
430
431
432
433
434
435
436
437
438
439
440
441
442
|
///是否是最后一页
bool isLastPage() {
return currentPage == dataCount();
}
///重置数据
void _resetLocalResult() {
_entity?.readings?.forEach((element) {
element.recordScore = null;
element.recordUrl = null;
});
}
}
|