onEvent method
void
onEvent(
- dynamic event
Implementation
void onEvent(dynamic event) {
final Map<dynamic, dynamic> map = event;
final String? eventName = map['event'];
switch (eventName) {
case 'onDidEnd':
final Map<dynamic, dynamic> params = map['params'];
final Map<dynamic, dynamic> info = params['info'] ?? {};
final Map<dynamic, dynamic> error = params['error'] ?? {};
TTError? taskError;
TTVideoEngineLocalServerTaskInfo? taskInfo;
if (error.isNotEmpty) {
taskError = TTError(error['code'], error['msg']);
}
if (info.isNotEmpty) {
taskInfo = TTVideoEngineLocalServerTaskInfo.fromJson(info);
}
onPreloadEnd?.call(taskInfo, taskError);
_clearEvent();
break;
case 'onCancel':
onPreloadCancel?.call();
_clearEvent();
break;
default:
}
}