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