@zeewain/3d-avatar-sdk 1.2.5 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +249 -12
- package/dist/assets/Build/webgl.data.unityweb +0 -0
- package/dist/assets/Build/webgl.framework.js.unityweb +0 -0
- package/dist/assets/Build/webgl.wasm.unityweb +0 -0
- package/dist/examples/test-umd/index.html +2 -1
- package/dist/examples/test-vue2/package.json +1 -1
- package/dist/examples/test-vue2/src/App.vue +1 -0
- package/dist/examples/test-vue3/package.json +1 -1
- package/dist/examples/test-vue3/src/App.vue +1 -1
- package/dist/examples/test-vue3/src/components/GlobalConfig.vue +9 -6
- package/dist/examples/test-vue3/src/types.ts +1 -1
- package/dist/index.d.ts +63 -39
- package/dist/index.es5.js +180 -87
- package/dist/index.es5.umd.js +180 -87
- package/dist/index.esm.js +229 -90
- package/dist/index.umd.cjs +229 -89
- package/package.json +6 -6
package/dist/index.es5.js
CHANGED
|
@@ -12191,6 +12191,8 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
12191
12191
|
ResourceErrorCode[ResourceErrorCode["NOT_FOUND"] = 3003] = "NOT_FOUND";
|
|
12192
12192
|
/** 资源格式不支持 */
|
|
12193
12193
|
ResourceErrorCode[ResourceErrorCode["UNSUPPORTED_FORMAT"] = 3004] = "UNSUPPORTED_FORMAT";
|
|
12194
|
+
/** 资源版本不兼容 */
|
|
12195
|
+
ResourceErrorCode[ResourceErrorCode["VERSION_INCOMPATIBLE"] = 3005] = "VERSION_INCOMPATIBLE";
|
|
12194
12196
|
})(exports.ResourceErrorCode || (exports.ResourceErrorCode = {}));
|
|
12195
12197
|
/**
|
|
12196
12198
|
* 系统错误码 (4xxx)
|
|
@@ -12283,6 +12285,9 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
12283
12285
|
}, _a[exports.ResourceErrorCode.UNSUPPORTED_FORMAT] = {
|
|
12284
12286
|
category: exports.ErrorCategory.RESOURCE,
|
|
12285
12287
|
message: '资源格式不支持'
|
|
12288
|
+
}, _a[exports.ResourceErrorCode.VERSION_INCOMPATIBLE] = {
|
|
12289
|
+
category: exports.ErrorCategory.RESOURCE,
|
|
12290
|
+
message: '资源版本不兼容'
|
|
12286
12291
|
},
|
|
12287
12292
|
// 系统错误
|
|
12288
12293
|
_a[exports.SystemErrorCode.OUT_OF_MEMORY] = {
|
|
@@ -12468,6 +12473,48 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
12468
12473
|
return SDKError;
|
|
12469
12474
|
}(Error);
|
|
12470
12475
|
|
|
12476
|
+
/**
|
|
12477
|
+
* Unity服务日志级别枚举
|
|
12478
|
+
* @enum {string}
|
|
12479
|
+
* @description 定义日志记录的级别
|
|
12480
|
+
*/
|
|
12481
|
+
var LogLevel;
|
|
12482
|
+
(function (LogLevel) {
|
|
12483
|
+
LogLevel["DEBUG"] = "debug";
|
|
12484
|
+
LogLevel["INFO"] = "info";
|
|
12485
|
+
LogLevel["WARN"] = "warn";
|
|
12486
|
+
LogLevel["ERROR"] = "error";
|
|
12487
|
+
})(LogLevel || (LogLevel = {}));
|
|
12488
|
+
/**
|
|
12489
|
+
* 简单日志记录器实现
|
|
12490
|
+
* @class SimpleLogger
|
|
12491
|
+
* @implements {ISimpleLogger}
|
|
12492
|
+
* @description 提供基础的日志记录功能
|
|
12493
|
+
*/
|
|
12494
|
+
var SimpleLogger = /** @class */function () {
|
|
12495
|
+
function SimpleLogger(enableDebug) {
|
|
12496
|
+
if (enableDebug === void 0) {
|
|
12497
|
+
enableDebug = false;
|
|
12498
|
+
}
|
|
12499
|
+
this.enableDebug = enableDebug;
|
|
12500
|
+
}
|
|
12501
|
+
SimpleLogger.prototype.debug = function (message, data) {
|
|
12502
|
+
if (this.enableDebug) {
|
|
12503
|
+
console.debug("[SDK DEBUG] ".concat(message), data);
|
|
12504
|
+
}
|
|
12505
|
+
};
|
|
12506
|
+
SimpleLogger.prototype.info = function (message, data) {
|
|
12507
|
+
console.info("[SDK INFO] ".concat(message), data);
|
|
12508
|
+
};
|
|
12509
|
+
SimpleLogger.prototype.warn = function (message, data) {
|
|
12510
|
+
console.warn("[SDK WARN] ".concat(message), data);
|
|
12511
|
+
};
|
|
12512
|
+
SimpleLogger.prototype.error = function (message, error, data) {
|
|
12513
|
+
console.error("[SDK ERROR] ".concat(message), error, error instanceof SDKError ? error.code : null, data);
|
|
12514
|
+
};
|
|
12515
|
+
return SimpleLogger;
|
|
12516
|
+
}();
|
|
12517
|
+
|
|
12471
12518
|
/**
|
|
12472
12519
|
* @fileoverview Unity服务基础类型定义
|
|
12473
12520
|
* @description 定义Unity服务的通用接口和类型,为所有Unity服务提供统一的基础类型
|
|
@@ -12488,18 +12535,6 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
12488
12535
|
/** 操作取消 */
|
|
12489
12536
|
UnityOperationStatus[UnityOperationStatus["CANCELLED"] = 3] = "CANCELLED";
|
|
12490
12537
|
})(exports.UnityOperationStatus || (exports.UnityOperationStatus = {}));
|
|
12491
|
-
/**
|
|
12492
|
-
* Unity服务日志级别枚举
|
|
12493
|
-
* @enum {string}
|
|
12494
|
-
* @description 定义日志记录的级别
|
|
12495
|
-
*/
|
|
12496
|
-
exports.LogLevel = void 0;
|
|
12497
|
-
(function (LogLevel) {
|
|
12498
|
-
LogLevel["DEBUG"] = "debug";
|
|
12499
|
-
LogLevel["INFO"] = "info";
|
|
12500
|
-
LogLevel["WARN"] = "warn";
|
|
12501
|
-
LogLevel["ERROR"] = "error";
|
|
12502
|
-
})(exports.LogLevel || (exports.LogLevel = {}));
|
|
12503
12538
|
|
|
12504
12539
|
/**
|
|
12505
12540
|
* 默认Unity服务配置
|
|
@@ -12841,35 +12876,6 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
12841
12876
|
};
|
|
12842
12877
|
return UnityBaseService;
|
|
12843
12878
|
}();
|
|
12844
|
-
/**
|
|
12845
|
-
* 简单日志记录器实现
|
|
12846
|
-
* @class SimpleLogger
|
|
12847
|
-
* @implements {IUnityLogger}
|
|
12848
|
-
* @description 提供基础的日志记录功能
|
|
12849
|
-
*/
|
|
12850
|
-
var SimpleLogger = /** @class */function () {
|
|
12851
|
-
function SimpleLogger(enableDebug) {
|
|
12852
|
-
if (enableDebug === void 0) {
|
|
12853
|
-
enableDebug = false;
|
|
12854
|
-
}
|
|
12855
|
-
this.enableDebug = enableDebug;
|
|
12856
|
-
}
|
|
12857
|
-
SimpleLogger.prototype.debug = function (message, data) {
|
|
12858
|
-
if (this.enableDebug) {
|
|
12859
|
-
console.debug("[Unity Debug] ".concat(message), data);
|
|
12860
|
-
}
|
|
12861
|
-
};
|
|
12862
|
-
SimpleLogger.prototype.info = function (message, data) {
|
|
12863
|
-
console.info("[Unity Info] ".concat(message), data);
|
|
12864
|
-
};
|
|
12865
|
-
SimpleLogger.prototype.warn = function (message, data) {
|
|
12866
|
-
console.warn("[Unity Warning] ".concat(message), data);
|
|
12867
|
-
};
|
|
12868
|
-
SimpleLogger.prototype.error = function (message, error, data) {
|
|
12869
|
-
console.error("[Unity Error] ".concat(message), error, error instanceof SDKError ? error.code : null, data);
|
|
12870
|
-
};
|
|
12871
|
-
return SimpleLogger;
|
|
12872
|
-
}();
|
|
12873
12879
|
|
|
12874
12880
|
/**
|
|
12875
12881
|
* @fileoverview Avatar API接口定义
|
|
@@ -12984,6 +12990,9 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
12984
12990
|
});
|
|
12985
12991
|
});
|
|
12986
12992
|
};
|
|
12993
|
+
AvatarService.prototype.handleCallback = function (operation, code, message, data) {
|
|
12994
|
+
_super.prototype.handleCallback.call(this, operation, code, message, data);
|
|
12995
|
+
};
|
|
12987
12996
|
/**
|
|
12988
12997
|
* 播放数字人动作
|
|
12989
12998
|
* @param clipCode - 动作编码
|
|
@@ -13313,6 +13322,16 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
13313
13322
|
containerId: config.containerId || 'unity-container'
|
|
13314
13323
|
});
|
|
13315
13324
|
};
|
|
13325
|
+
/**
|
|
13326
|
+
* 更新SDK配置
|
|
13327
|
+
* @param config - SDK配置对象
|
|
13328
|
+
* @description 更新全局SDK配置
|
|
13329
|
+
*/
|
|
13330
|
+
ConfigManager.prototype.updateConfig = function (config) {
|
|
13331
|
+
if (this.config) {
|
|
13332
|
+
this.config = __assign(__assign({}, this.config), config);
|
|
13333
|
+
}
|
|
13334
|
+
};
|
|
13316
13335
|
/**
|
|
13317
13336
|
* 获取SDK配置
|
|
13318
13337
|
* @returns IAvatarSDKConfig | null SDK配置对象或null
|
|
@@ -13321,24 +13340,6 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
13321
13340
|
ConfigManager.prototype.getConfig = function () {
|
|
13322
13341
|
return this.config;
|
|
13323
13342
|
};
|
|
13324
|
-
/**
|
|
13325
|
-
* 获取认证token
|
|
13326
|
-
* @returns string 认证token
|
|
13327
|
-
* @description 获取当前配置的认证token
|
|
13328
|
-
*/
|
|
13329
|
-
ConfigManager.prototype.getToken = function () {
|
|
13330
|
-
var _a;
|
|
13331
|
-
return ((_a = this.config) === null || _a === void 0 ? void 0 : _a.token) || '';
|
|
13332
|
-
};
|
|
13333
|
-
/**
|
|
13334
|
-
* 获取环境类型
|
|
13335
|
-
* @returns string 环境类型
|
|
13336
|
-
* @description 获取当前配置的环境类型
|
|
13337
|
-
*/
|
|
13338
|
-
ConfigManager.prototype.getEnv = function () {
|
|
13339
|
-
var _a;
|
|
13340
|
-
return ((_a = this.config) === null || _a === void 0 ? void 0 : _a.env) || 'prod';
|
|
13341
|
-
};
|
|
13342
13343
|
/**
|
|
13343
13344
|
* 获取API基础URL
|
|
13344
13345
|
* @param withApiModule 是否包含模块路径
|
|
@@ -13356,15 +13357,6 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
13356
13357
|
}
|
|
13357
13358
|
return ((_d = getEnvConfig(((_c = this.config) === null || _c === void 0 ? void 0 : _c.env) || 'prod', withApiModule)) === null || _d === void 0 ? void 0 : _d.apiBaseUrl) || '';
|
|
13358
13359
|
};
|
|
13359
|
-
/**
|
|
13360
|
-
* 获取自定义API URL
|
|
13361
|
-
* @returns string | undefined 自定义API URL
|
|
13362
|
-
* @description 获取自定义API URL配置
|
|
13363
|
-
*/
|
|
13364
|
-
ConfigManager.prototype.getCustomApiUrl = function () {
|
|
13365
|
-
var _a;
|
|
13366
|
-
return (_a = this.config) === null || _a === void 0 ? void 0 : _a.apiUrl;
|
|
13367
|
-
};
|
|
13368
13360
|
/**
|
|
13369
13361
|
* 重置配置
|
|
13370
13362
|
* @description 清空当前配置
|
|
@@ -14218,9 +14210,10 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14218
14210
|
*/
|
|
14219
14211
|
BroadcastService.prototype.startTaskRequest = function (task) {
|
|
14220
14212
|
return __awaiter(this, void 0, void 0, function () {
|
|
14221
|
-
var apiUrl, requestBody;
|
|
14213
|
+
var apiUrl, requestBody, sdkError;
|
|
14222
14214
|
var _this = this;
|
|
14223
|
-
|
|
14215
|
+
var _a;
|
|
14216
|
+
return __generator(this, function (_b) {
|
|
14224
14217
|
task.status = BroadcastTaskStatus.REQUESTING;
|
|
14225
14218
|
this.logger.debug('Starting task request', {
|
|
14226
14219
|
taskId: task.id
|
|
@@ -14231,7 +14224,8 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14231
14224
|
humanCode: task.params.humanCode,
|
|
14232
14225
|
speed: task.params.speed,
|
|
14233
14226
|
volume: task.params.volume >= 0 ? task.params.volume * 100 : undefined,
|
|
14234
|
-
isSubtitle: task.params.isSubtitle
|
|
14227
|
+
isSubtitle: task.params.isSubtitle,
|
|
14228
|
+
audioDrivenVersion: ConfigManager.getInstance().getConfig().audioDrivenVersion
|
|
14235
14229
|
};
|
|
14236
14230
|
// 根据播报类型设置特定参数
|
|
14237
14231
|
if (task.params.type === exports.BroadcastType.TEXT) {
|
|
@@ -14246,11 +14240,30 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14246
14240
|
method: 'POST',
|
|
14247
14241
|
headers: {
|
|
14248
14242
|
'Content-Type': 'application/json',
|
|
14249
|
-
'x_auth_token': ConfigManager.getInstance().
|
|
14243
|
+
'x_auth_token': ((_a = ConfigManager.getInstance().getConfig()) === null || _a === void 0 ? void 0 : _a.token) || ''
|
|
14250
14244
|
},
|
|
14251
14245
|
body: JSON.stringify(requestBody),
|
|
14252
14246
|
signal: task.controller.signal,
|
|
14253
14247
|
openWhenHidden: true,
|
|
14248
|
+
/**
|
|
14249
|
+
* 连接建立时的回调,用于检查 HTTP 状态码
|
|
14250
|
+
* @param response - HTTP 响应对象
|
|
14251
|
+
* @throws {SDKError} 当 HTTP 状态码异常时抛出对应的 SDKError
|
|
14252
|
+
*/
|
|
14253
|
+
onopen: function onopen(response) {
|
|
14254
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
14255
|
+
var error;
|
|
14256
|
+
return __generator(this, function (_a) {
|
|
14257
|
+
// 检查 HTTP 状态码,处理 401 token 过期等异常
|
|
14258
|
+
if (!response.ok) {
|
|
14259
|
+
error = this.createHttpError(response.status, response.statusText, task.id);
|
|
14260
|
+
this.handleTaskError(task, error);
|
|
14261
|
+
throw error;
|
|
14262
|
+
}
|
|
14263
|
+
return [2 /*return*/];
|
|
14264
|
+
});
|
|
14265
|
+
});
|
|
14266
|
+
},
|
|
14254
14267
|
onmessage: function onmessage(event) {
|
|
14255
14268
|
_this.handleTaskResponse(task, event.data);
|
|
14256
14269
|
},
|
|
@@ -14258,12 +14271,15 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14258
14271
|
_this.handleTaskClose(task);
|
|
14259
14272
|
},
|
|
14260
14273
|
onerror: function onerror(error) {
|
|
14261
|
-
|
|
14262
|
-
|
|
14274
|
+
// 将所有异常统一转换为 SDKError
|
|
14275
|
+
var sdkError = _this.convertToSDKError(error, task.id);
|
|
14276
|
+
_this.handleTaskError(task, sdkError);
|
|
14277
|
+
throw sdkError;
|
|
14263
14278
|
}
|
|
14264
14279
|
});
|
|
14265
14280
|
} catch (error) {
|
|
14266
|
-
this.
|
|
14281
|
+
sdkError = this.convertToSDKError(error, task.id);
|
|
14282
|
+
this.handleTaskError(task, sdkError);
|
|
14267
14283
|
}
|
|
14268
14284
|
return [2 /*return*/];
|
|
14269
14285
|
});
|
|
@@ -14362,15 +14378,19 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14362
14378
|
* 处理任务错误
|
|
14363
14379
|
* @param task - 播报任务
|
|
14364
14380
|
* @param error - 错误对象
|
|
14365
|
-
* @description
|
|
14381
|
+
* @description 处理任务执行过程中的错误,防止重复触发错误回调
|
|
14366
14382
|
* @private
|
|
14367
14383
|
*/
|
|
14368
14384
|
BroadcastService.prototype.handleTaskError = function (task, error) {
|
|
14369
14385
|
var _a, _b;
|
|
14386
|
+
// 如果任务已经是失败或取消状态,不再重复处理,防止回调被多次触发
|
|
14387
|
+
if (task.status === BroadcastTaskStatus.FAILED || task.status === BroadcastTaskStatus.CANCELLED) {
|
|
14388
|
+
return;
|
|
14389
|
+
}
|
|
14370
14390
|
task.status = BroadcastTaskStatus.FAILED;
|
|
14371
14391
|
task.error = error;
|
|
14372
14392
|
this.logger.error("Task failed - ".concat(task.id), error);
|
|
14373
|
-
//
|
|
14393
|
+
// 触发错误回调(只触发一次)
|
|
14374
14394
|
(_b = (_a = this.callbacks).onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);
|
|
14375
14395
|
};
|
|
14376
14396
|
/**
|
|
@@ -14439,7 +14459,6 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14439
14459
|
* @private
|
|
14440
14460
|
*/
|
|
14441
14461
|
BroadcastService.prototype.getBroadcastApiPath = function (type) {
|
|
14442
|
-
ConfigManager.getInstance().getEnv();
|
|
14443
14462
|
switch (type) {
|
|
14444
14463
|
case exports.BroadcastType.TEXT:
|
|
14445
14464
|
return '/aiep-openapi/avatar-interaction/v1/broadcast/text';
|
|
@@ -14515,6 +14534,74 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14515
14534
|
this.queueProcessTimer = null;
|
|
14516
14535
|
}
|
|
14517
14536
|
};
|
|
14537
|
+
/**
|
|
14538
|
+
* 根据 HTTP 状态码创建对应的 SDKError
|
|
14539
|
+
* @param status - HTTP 状态码
|
|
14540
|
+
* @param statusText - HTTP 状态文本
|
|
14541
|
+
* @param taskId - 任务 ID(用于日志记录)
|
|
14542
|
+
* @returns SDKError 实例
|
|
14543
|
+
* @description 将 HTTP 错误状态码映射为对应的 SDKError
|
|
14544
|
+
* @private
|
|
14545
|
+
*/
|
|
14546
|
+
BroadcastService.prototype.createHttpError = function (status, statusText, taskId) {
|
|
14547
|
+
this.logger.warn("HTTP error occurred - Task: ".concat(taskId, ", Status: ").concat(status), {
|
|
14548
|
+
status: status,
|
|
14549
|
+
statusText: statusText
|
|
14550
|
+
});
|
|
14551
|
+
switch (status) {
|
|
14552
|
+
case 401:
|
|
14553
|
+
// Token 过期或未授权
|
|
14554
|
+
return new SDKError(exports.NetworkErrorCode.UNAUTHORIZED, "Token \u5DF2\u8FC7\u671F\u6216\u65E0\u6548\uFF0C\u8BF7\u91CD\u65B0\u6388\u6743 (HTTP ".concat(status, ")"));
|
|
14555
|
+
case 403:
|
|
14556
|
+
// 禁止访问
|
|
14557
|
+
return new SDKError(exports.NetworkErrorCode.UNAUTHORIZED, "\u65E0\u6743\u9650\u8BBF\u95EE\u8BE5\u8D44\u6E90 (HTTP ".concat(status, ")"));
|
|
14558
|
+
case 404:
|
|
14559
|
+
// 资源不存在
|
|
14560
|
+
return new SDKError(exports.NetworkErrorCode.SERVER_ERROR, "\u8BF7\u6C42\u7684\u8D44\u6E90\u4E0D\u5B58\u5728 (HTTP ".concat(status, ")"));
|
|
14561
|
+
case 500:
|
|
14562
|
+
case 502:
|
|
14563
|
+
case 503:
|
|
14564
|
+
case 504:
|
|
14565
|
+
// 服务器错误
|
|
14566
|
+
return new SDKError(exports.NetworkErrorCode.SERVER_ERROR, "\u670D\u52A1\u5668\u9519\u8BEF\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5 (HTTP ".concat(status, ")"));
|
|
14567
|
+
default:
|
|
14568
|
+
// 其他 HTTP 错误
|
|
14569
|
+
return new SDKError(exports.NetworkErrorCode.CONNECTION_FAILED, "\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25: ".concat(statusText || 'Unknown Error', " (HTTP ").concat(status, ")"));
|
|
14570
|
+
}
|
|
14571
|
+
};
|
|
14572
|
+
/**
|
|
14573
|
+
* 将任意错误转换为 SDKError
|
|
14574
|
+
* @param error - 原始错误对象
|
|
14575
|
+
* @param taskId - 任务 ID(用于日志记录)
|
|
14576
|
+
* @returns SDKError 实例
|
|
14577
|
+
* @description 统一将各种类型的错误转换为 SDKError,便于上层统一处理
|
|
14578
|
+
* @private
|
|
14579
|
+
*/
|
|
14580
|
+
BroadcastService.prototype.convertToSDKError = function (error, taskId) {
|
|
14581
|
+
// 如果已经是 SDKError,直接返回
|
|
14582
|
+
if (error instanceof SDKError) {
|
|
14583
|
+
return error;
|
|
14584
|
+
}
|
|
14585
|
+
// 如果是普通 Error 对象
|
|
14586
|
+
if (error instanceof Error) {
|
|
14587
|
+
// 检查是否是网络相关的错误
|
|
14588
|
+
var errorMessage_1 = error.message.toLowerCase();
|
|
14589
|
+
if (errorMessage_1.includes('timeout') || errorMessage_1.includes('timed out')) {
|
|
14590
|
+
return new SDKError(exports.NetworkErrorCode.REQUEST_TIMEOUT, "\u8BF7\u6C42\u8D85\u65F6 - Task: ".concat(taskId), error);
|
|
14591
|
+
}
|
|
14592
|
+
if (errorMessage_1.includes('network') || errorMessage_1.includes('fetch') || errorMessage_1.includes('connection')) {
|
|
14593
|
+
return new SDKError(exports.NetworkErrorCode.CONNECTION_FAILED, "\u7F51\u7EDC\u8FDE\u63A5\u5931\u8D25 - Task: ".concat(taskId, ": ").concat(error.message), error);
|
|
14594
|
+
}
|
|
14595
|
+
if (errorMessage_1.includes('abort') || errorMessage_1.includes('cancel')) {
|
|
14596
|
+
return new SDKError(exports.OperationErrorCode.OPERATION_CANCELLED, "\u64CD\u4F5C\u5DF2\u53D6\u6D88 - Task: ".concat(taskId), error);
|
|
14597
|
+
}
|
|
14598
|
+
// 默认作为操作失败处理
|
|
14599
|
+
return new SDKError(exports.OperationErrorCode.OPERATION_FAILED, "\u64AD\u62A5\u4EFB\u52A1\u6267\u884C\u5931\u8D25 - Task: ".concat(taskId, ": ").concat(error.message), error);
|
|
14600
|
+
}
|
|
14601
|
+
// 如果是字符串或其他类型
|
|
14602
|
+
var errorMessage = String(error);
|
|
14603
|
+
return new SDKError(exports.OperationErrorCode.OPERATION_FAILED, "\u64AD\u62A5\u4EFB\u52A1\u6267\u884C\u5931\u8D25 - Task: ".concat(taskId, ": ").concat(errorMessage));
|
|
14604
|
+
};
|
|
14518
14605
|
return BroadcastService;
|
|
14519
14606
|
}(UnityBaseService);
|
|
14520
14607
|
|
|
@@ -14533,13 +14620,11 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14533
14620
|
* @param config - Unity配置对象
|
|
14534
14621
|
* @description 初始化数字人加载器,创建Unity加载器实例
|
|
14535
14622
|
*/
|
|
14536
|
-
function ZEEAvatarLoader(
|
|
14623
|
+
function ZEEAvatarLoader() {
|
|
14537
14624
|
/** Avatar API实例 */
|
|
14538
14625
|
this.apiService = null;
|
|
14539
14626
|
/** Unity实例 */
|
|
14540
14627
|
this.unityInstance = null;
|
|
14541
|
-
// 同时设置到配置管理器中
|
|
14542
|
-
ConfigManager.getInstance().setConfig(config);
|
|
14543
14628
|
this.loader = new UnityLoader();
|
|
14544
14629
|
}
|
|
14545
14630
|
/**
|
|
@@ -14653,14 +14738,22 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14653
14738
|
* @protected
|
|
14654
14739
|
*/
|
|
14655
14740
|
ZEEAvatarLoader.prototype.initGlobalConfig = function () {
|
|
14656
|
-
var
|
|
14657
|
-
|
|
14741
|
+
var config = ConfigManager.getInstance().getConfig();
|
|
14742
|
+
var globalParams = {
|
|
14743
|
+
token: config === null || config === void 0 ? void 0 : config.token,
|
|
14658
14744
|
apiBaseUrl: ConfigManager.getInstance().getApiBaseUrl(false),
|
|
14659
|
-
idleMotionList:
|
|
14660
|
-
|
|
14745
|
+
idleMotionList: config === null || config === void 0 ? void 0 : config.idleMotionList
|
|
14746
|
+
// 純AB包方案在SDK 2.1.0 中已弃用
|
|
14747
|
+
// assetsUrl: config?.assetsUrl
|
|
14748
|
+
};
|
|
14749
|
+
var assetModuleParams = {
|
|
14750
|
+
isZip: true,
|
|
14751
|
+
assetBundlePath: config === null || config === void 0 ? void 0 : config.assetsUrl
|
|
14661
14752
|
};
|
|
14662
|
-
|
|
14663
|
-
this.unityInstance.SendMessage('AvatarSDK', '
|
|
14753
|
+
this.unityInstance.SendMessage('AvatarSDK', 'InitializeConfig', JSON.stringify(globalParams));
|
|
14754
|
+
this.unityInstance.SendMessage('AvatarSDK', 'InitAssetBundleModule', JSON.stringify(assetModuleParams));
|
|
14755
|
+
console.warn('[ Send Unity message ]: AvatarSDK.InitializeConfig', globalParams);
|
|
14756
|
+
console.warn('[ Send Unity message ]: AvatarSDK.InitAssetBundleModule', assetModuleParams);
|
|
14664
14757
|
};
|
|
14665
14758
|
return ZEEAvatarLoader;
|
|
14666
14759
|
}();
|