@zeewain/3d-avatar-sdk 1.2.5 → 2.1.1
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 +43 -38
- package/dist/index.es5.js +80 -81
- package/dist/index.es5.umd.js +80 -81
- package/dist/index.esm.js +138 -85
- package/dist/index.umd.cjs +138 -84
- 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 清空当前配置
|
|
@@ -14220,7 +14212,8 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14220
14212
|
return __awaiter(this, void 0, void 0, function () {
|
|
14221
14213
|
var apiUrl, requestBody;
|
|
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,7 +14240,7 @@ 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,
|
|
@@ -14439,7 +14433,6 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14439
14433
|
* @private
|
|
14440
14434
|
*/
|
|
14441
14435
|
BroadcastService.prototype.getBroadcastApiPath = function (type) {
|
|
14442
|
-
ConfigManager.getInstance().getEnv();
|
|
14443
14436
|
switch (type) {
|
|
14444
14437
|
case exports.BroadcastType.TEXT:
|
|
14445
14438
|
return '/aiep-openapi/avatar-interaction/v1/broadcast/text';
|
|
@@ -14533,13 +14526,11 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14533
14526
|
* @param config - Unity配置对象
|
|
14534
14527
|
* @description 初始化数字人加载器,创建Unity加载器实例
|
|
14535
14528
|
*/
|
|
14536
|
-
function ZEEAvatarLoader(
|
|
14529
|
+
function ZEEAvatarLoader() {
|
|
14537
14530
|
/** Avatar API实例 */
|
|
14538
14531
|
this.apiService = null;
|
|
14539
14532
|
/** Unity实例 */
|
|
14540
14533
|
this.unityInstance = null;
|
|
14541
|
-
// 同时设置到配置管理器中
|
|
14542
|
-
ConfigManager.getInstance().setConfig(config);
|
|
14543
14534
|
this.loader = new UnityLoader();
|
|
14544
14535
|
}
|
|
14545
14536
|
/**
|
|
@@ -14653,14 +14644,22 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14653
14644
|
* @protected
|
|
14654
14645
|
*/
|
|
14655
14646
|
ZEEAvatarLoader.prototype.initGlobalConfig = function () {
|
|
14656
|
-
var
|
|
14657
|
-
|
|
14647
|
+
var config = ConfigManager.getInstance().getConfig();
|
|
14648
|
+
var globalParams = {
|
|
14649
|
+
token: config === null || config === void 0 ? void 0 : config.token,
|
|
14658
14650
|
apiBaseUrl: ConfigManager.getInstance().getApiBaseUrl(false),
|
|
14659
|
-
idleMotionList:
|
|
14660
|
-
|
|
14651
|
+
idleMotionList: config === null || config === void 0 ? void 0 : config.idleMotionList
|
|
14652
|
+
// 純AB包方案在SDK 2.1.0 中已弃用
|
|
14653
|
+
// assetsUrl: config?.assetsUrl
|
|
14654
|
+
};
|
|
14655
|
+
var assetModuleParams = {
|
|
14656
|
+
isZip: true,
|
|
14657
|
+
assetBundlePath: config === null || config === void 0 ? void 0 : config.assetsUrl
|
|
14661
14658
|
};
|
|
14662
|
-
|
|
14663
|
-
this.unityInstance.SendMessage('AvatarSDK', '
|
|
14659
|
+
this.unityInstance.SendMessage('AvatarSDK', 'InitializeConfig', JSON.stringify(globalParams));
|
|
14660
|
+
this.unityInstance.SendMessage('AvatarSDK', 'InitAssetBundleModule', JSON.stringify(assetModuleParams));
|
|
14661
|
+
console.warn('[ Send Unity message ]: AvatarSDK.InitializeConfig', globalParams);
|
|
14662
|
+
console.warn('[ Send Unity message ]: AvatarSDK.InitAssetBundleModule', assetModuleParams);
|
|
14664
14663
|
};
|
|
14665
14664
|
return ZEEAvatarLoader;
|
|
14666
14665
|
}();
|
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 清空当前配置
|
|
@@ -14223,7 +14215,8 @@
|
|
|
14223
14215
|
return __awaiter(this, void 0, void 0, function () {
|
|
14224
14216
|
var apiUrl, requestBody;
|
|
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,7 +14243,7 @@
|
|
|
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,
|
|
@@ -14442,7 +14436,6 @@
|
|
|
14442
14436
|
* @private
|
|
14443
14437
|
*/
|
|
14444
14438
|
BroadcastService.prototype.getBroadcastApiPath = function (type) {
|
|
14445
|
-
ConfigManager.getInstance().getEnv();
|
|
14446
14439
|
switch (type) {
|
|
14447
14440
|
case exports.BroadcastType.TEXT:
|
|
14448
14441
|
return '/aiep-openapi/avatar-interaction/v1/broadcast/text';
|
|
@@ -14536,13 +14529,11 @@
|
|
|
14536
14529
|
* @param config - Unity配置对象
|
|
14537
14530
|
* @description 初始化数字人加载器,创建Unity加载器实例
|
|
14538
14531
|
*/
|
|
14539
|
-
function ZEEAvatarLoader(
|
|
14532
|
+
function ZEEAvatarLoader() {
|
|
14540
14533
|
/** Avatar API实例 */
|
|
14541
14534
|
this.apiService = null;
|
|
14542
14535
|
/** Unity实例 */
|
|
14543
14536
|
this.unityInstance = null;
|
|
14544
|
-
// 同时设置到配置管理器中
|
|
14545
|
-
ConfigManager.getInstance().setConfig(config);
|
|
14546
14537
|
this.loader = new UnityLoader();
|
|
14547
14538
|
}
|
|
14548
14539
|
/**
|
|
@@ -14656,14 +14647,22 @@
|
|
|
14656
14647
|
* @protected
|
|
14657
14648
|
*/
|
|
14658
14649
|
ZEEAvatarLoader.prototype.initGlobalConfig = function () {
|
|
14659
|
-
var
|
|
14660
|
-
|
|
14650
|
+
var config = ConfigManager.getInstance().getConfig();
|
|
14651
|
+
var globalParams = {
|
|
14652
|
+
token: config === null || config === void 0 ? void 0 : config.token,
|
|
14661
14653
|
apiBaseUrl: ConfigManager.getInstance().getApiBaseUrl(false),
|
|
14662
|
-
idleMotionList:
|
|
14663
|
-
|
|
14654
|
+
idleMotionList: config === null || config === void 0 ? void 0 : config.idleMotionList
|
|
14655
|
+
// 純AB包方案在SDK 2.1.0 中已弃用
|
|
14656
|
+
// assetsUrl: config?.assetsUrl
|
|
14657
|
+
};
|
|
14658
|
+
var assetModuleParams = {
|
|
14659
|
+
isZip: true,
|
|
14660
|
+
assetBundlePath: config === null || config === void 0 ? void 0 : config.assetsUrl
|
|
14664
14661
|
};
|
|
14665
|
-
|
|
14666
|
-
this.unityInstance.SendMessage('AvatarSDK', '
|
|
14662
|
+
this.unityInstance.SendMessage('AvatarSDK', 'InitializeConfig', JSON.stringify(globalParams));
|
|
14663
|
+
this.unityInstance.SendMessage('AvatarSDK', 'InitAssetBundleModule', JSON.stringify(assetModuleParams));
|
|
14664
|
+
console.warn('[ Send Unity message ]: AvatarSDK.InitializeConfig', globalParams);
|
|
14665
|
+
console.warn('[ Send Unity message ]: AvatarSDK.InitAssetBundleModule', assetModuleParams);
|
|
14667
14666
|
};
|
|
14668
14667
|
return ZEEAvatarLoader;
|
|
14669
14668
|
}();
|