@zeewain/3d-avatar-sdk 1.2.4 → 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 +253 -20
- 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/pnpm-lock.yaml +7 -7
- package/dist/examples/test-vue3/src/App.vue +35 -13
- package/dist/examples/test-vue3/src/components/BroadcastAPI.vue +78 -26
- package/dist/examples/test-vue3/src/components/GlobalConfig.vue +10 -6
- package/dist/examples/test-vue3/src/components/LogPanel.vue +5 -5
- package/dist/examples/test-vue3/src/components/MotionControlAPI.vue +44 -7
- package/dist/examples/test-vue3/src/types.ts +1 -1
- package/dist/examples/test-vue3/src/utils/index.ts +35 -0
- package/dist/index.d.ts +69 -48
- package/dist/index.es5.js +145 -124
- package/dist/index.es5.umd.js +145 -124
- package/dist/index.esm.js +194 -120
- package/dist/index.umd.cjs +194 -119
- 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 清空当前配置
|
|
@@ -13816,14 +13808,14 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
13816
13808
|
_this.taskSequence = 0;
|
|
13817
13809
|
/** 当前发送任务的序号 */
|
|
13818
13810
|
_this.currentSendingSequence = 0;
|
|
13819
|
-
/**
|
|
13820
|
-
_this.
|
|
13811
|
+
/** 是否正在播报音频 */
|
|
13812
|
+
_this.isBroadcastingAudio = false;
|
|
13821
13813
|
/** 是否已经收到音频 */
|
|
13822
13814
|
_this.hasReceivedAudio = false;
|
|
13823
13815
|
/** 队列处理定时器 */
|
|
13824
13816
|
_this.queueProcessTimer = null;
|
|
13825
|
-
/**
|
|
13826
|
-
_this.
|
|
13817
|
+
/** 播报完成次数 */
|
|
13818
|
+
_this.broadcastCompletedCount = 0;
|
|
13827
13819
|
_this.callbacks = config.callbacks || {};
|
|
13828
13820
|
_this.logger.info('Broadcast service initialized', {
|
|
13829
13821
|
config: config
|
|
@@ -13840,7 +13832,7 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
13840
13832
|
* @override
|
|
13841
13833
|
*/
|
|
13842
13834
|
BroadcastService.prototype.handleCallback = function (operation, code, message, data) {
|
|
13843
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
13835
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
13844
13836
|
// 提取 isBroadcastCompleted 参数
|
|
13845
13837
|
var isBroadcastCompleted = JSON.parse(data || '{}').isBroadcastCompleted;
|
|
13846
13838
|
// 先调用基类处理逻辑
|
|
@@ -13850,19 +13842,31 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
13850
13842
|
switch (operation) {
|
|
13851
13843
|
case exports.BroadcastOperationType.START_BROADCAST:
|
|
13852
13844
|
if (isBroadcastCompleted) {
|
|
13853
|
-
|
|
13845
|
+
this.broadcastCompletedCount++;
|
|
13846
|
+
var status_1 = this.getStatus();
|
|
13847
|
+
if (((_a = status_1.queueInfo) === null || _a === void 0 ? void 0 : _a.completedTasks) === this.broadcastCompletedCount) {
|
|
13848
|
+
// 重置状态、计数
|
|
13849
|
+
this.isBroadcastingAudio = false;
|
|
13850
|
+
this.hasReceivedAudio = false;
|
|
13851
|
+
this.currentSendingSequence = 0;
|
|
13852
|
+
// 清理已完成的任务
|
|
13853
|
+
this.cleanupCompletedTasks();
|
|
13854
|
+
this.logger.warn('Broadcast all completed');
|
|
13855
|
+
}
|
|
13856
|
+
// this.logger.warn('AAAAAA', { status: this.getStatus(), broadcastCompletedCount: this.broadcastCompletedCount });
|
|
13857
|
+
(_c = (_b = this.callbacks).onFinish) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
13854
13858
|
}
|
|
13855
13859
|
break;
|
|
13856
13860
|
case exports.BroadcastOperationType.PAUSE_BROADCAST:
|
|
13857
|
-
(
|
|
13861
|
+
(_e = (_d = this.callbacks).onPause) === null || _e === void 0 ? void 0 : _e.call(_d);
|
|
13858
13862
|
this.logger.debug('Broadcast paused callback triggered');
|
|
13859
13863
|
break;
|
|
13860
13864
|
case exports.BroadcastOperationType.RESUME_BROADCAST:
|
|
13861
|
-
(
|
|
13865
|
+
(_g = (_f = this.callbacks).onResume) === null || _g === void 0 ? void 0 : _g.call(_f);
|
|
13862
13866
|
this.logger.debug('Broadcast resumed callback triggered');
|
|
13863
13867
|
break;
|
|
13864
13868
|
case exports.BroadcastOperationType.STOP_BROADCAST:
|
|
13865
|
-
(
|
|
13869
|
+
(_j = (_h = this.callbacks).onStop) === null || _j === void 0 ? void 0 : _j.call(_h);
|
|
13866
13870
|
this.logger.debug('Broadcast stopped callback triggered');
|
|
13867
13871
|
break;
|
|
13868
13872
|
}
|
|
@@ -13933,7 +13937,7 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
13933
13937
|
});
|
|
13934
13938
|
// 触发开始回调
|
|
13935
13939
|
(_b = (_a = this.callbacks).onStart) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
13936
|
-
this.
|
|
13940
|
+
this.isBroadcastingAudio = true;
|
|
13937
13941
|
_c.label = 2;
|
|
13938
13942
|
case 2:
|
|
13939
13943
|
task = this.createBroadcastTask(params);
|
|
@@ -14041,8 +14045,9 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14041
14045
|
// 取消所有队列中的任务
|
|
14042
14046
|
this.cancelAllTasks();
|
|
14043
14047
|
// 重置状态
|
|
14044
|
-
this.
|
|
14048
|
+
this.isBroadcastingAudio = false;
|
|
14045
14049
|
this.hasReceivedAudio = false;
|
|
14050
|
+
this.broadcastCompletedCount = 0;
|
|
14046
14051
|
_a.label = 1;
|
|
14047
14052
|
case 1:
|
|
14048
14053
|
_a.trys.push([1, 3,, 4]);
|
|
@@ -14076,27 +14081,32 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14076
14081
|
* @description 获取当前播报服务的状态信息,包括队列状态
|
|
14077
14082
|
*/
|
|
14078
14083
|
BroadcastService.prototype.getStatus = function () {
|
|
14084
|
+
var completedTasks = this.taskQueue.filter(function (t) {
|
|
14085
|
+
return t.status === BroadcastTaskStatus.COMPLETED;
|
|
14086
|
+
}).length;
|
|
14087
|
+
var requestingTasks = this.taskQueue.filter(function (t) {
|
|
14088
|
+
return t.status === BroadcastTaskStatus.REQUESTING;
|
|
14089
|
+
}).length;
|
|
14090
|
+
var failedTasks = this.taskQueue.filter(function (t) {
|
|
14091
|
+
return t.status === BroadcastTaskStatus.FAILED;
|
|
14092
|
+
}).length;
|
|
14093
|
+
var totalPendingResponses = this.taskQueue.reduce(function (sum, t) {
|
|
14094
|
+
return sum + t.pendingResponses.length;
|
|
14095
|
+
}, 0);
|
|
14096
|
+
var currentSendingSequence = this.currentSendingSequence;
|
|
14097
|
+
var isGeneratingAudio = completedTasks + failedTasks !== this.taskQueue.length;
|
|
14079
14098
|
return {
|
|
14080
|
-
isActive: this.
|
|
14081
|
-
|
|
14099
|
+
isActive: this.isBroadcastingAudio || isGeneratingAudio,
|
|
14100
|
+
// 是否正在播报音频或正在生成音频
|
|
14101
|
+
isGeneratingAudio: isGeneratingAudio,
|
|
14082
14102
|
hasReceivedAudio: this.hasReceivedAudio,
|
|
14083
|
-
pendingCallbacks: this.getPendingCallbackCount(),
|
|
14084
|
-
hasController: this.activeController !== null,
|
|
14085
14103
|
queueInfo: {
|
|
14086
14104
|
totalTasks: this.taskQueue.length,
|
|
14087
|
-
requestingTasks:
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
}).length,
|
|
14093
|
-
failedTasks: this.taskQueue.filter(function (t) {
|
|
14094
|
-
return t.status === BroadcastTaskStatus.FAILED;
|
|
14095
|
-
}).length,
|
|
14096
|
-
totalPendingResponses: this.taskQueue.reduce(function (sum, t) {
|
|
14097
|
-
return sum + t.pendingResponses.length;
|
|
14098
|
-
}, 0),
|
|
14099
|
-
currentSendingSequence: this.currentSendingSequence
|
|
14105
|
+
requestingTasks: requestingTasks,
|
|
14106
|
+
completedTasks: completedTasks,
|
|
14107
|
+
failedTasks: failedTasks,
|
|
14108
|
+
totalPendingResponses: totalPendingResponses,
|
|
14109
|
+
currentSendingSequence: currentSendingSequence
|
|
14100
14110
|
}
|
|
14101
14111
|
};
|
|
14102
14112
|
};
|
|
@@ -14106,10 +14116,7 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14106
14116
|
*/
|
|
14107
14117
|
BroadcastService.prototype.destroy = function () {
|
|
14108
14118
|
// 清理队列处理定时器
|
|
14109
|
-
|
|
14110
|
-
clearInterval(this.queueProcessTimer);
|
|
14111
|
-
this.queueProcessTimer = null;
|
|
14112
|
-
}
|
|
14119
|
+
this.clearQueueProcessTimer();
|
|
14113
14120
|
// 取消所有任务
|
|
14114
14121
|
this.cancelAllTasks();
|
|
14115
14122
|
// 调用基类销毁方法
|
|
@@ -14187,12 +14194,12 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14187
14194
|
if (nextTask) {
|
|
14188
14195
|
this.sendNextResponse(nextTask);
|
|
14189
14196
|
}
|
|
14190
|
-
//
|
|
14191
|
-
this.
|
|
14192
|
-
|
|
14193
|
-
|
|
14194
|
-
|
|
14195
|
-
this.
|
|
14197
|
+
// 如果队列中没有剩余任务,则停止定时器
|
|
14198
|
+
var remainingTasks = this.taskQueue.filter(function (task) {
|
|
14199
|
+
return task.status !== BroadcastTaskStatus.COMPLETED && task.status !== BroadcastTaskStatus.FAILED && task.status !== BroadcastTaskStatus.CANCELLED;
|
|
14200
|
+
});
|
|
14201
|
+
if (remainingTasks.length === 0) {
|
|
14202
|
+
this.clearQueueProcessTimer();
|
|
14196
14203
|
}
|
|
14197
14204
|
};
|
|
14198
14205
|
/**
|
|
@@ -14205,7 +14212,8 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14205
14212
|
return __awaiter(this, void 0, void 0, function () {
|
|
14206
14213
|
var apiUrl, requestBody;
|
|
14207
14214
|
var _this = this;
|
|
14208
|
-
|
|
14215
|
+
var _a;
|
|
14216
|
+
return __generator(this, function (_b) {
|
|
14209
14217
|
task.status = BroadcastTaskStatus.REQUESTING;
|
|
14210
14218
|
this.logger.debug('Starting task request', {
|
|
14211
14219
|
taskId: task.id
|
|
@@ -14216,7 +14224,8 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14216
14224
|
humanCode: task.params.humanCode,
|
|
14217
14225
|
speed: task.params.speed,
|
|
14218
14226
|
volume: task.params.volume >= 0 ? task.params.volume * 100 : undefined,
|
|
14219
|
-
isSubtitle: task.params.isSubtitle
|
|
14227
|
+
isSubtitle: task.params.isSubtitle,
|
|
14228
|
+
audioDrivenVersion: ConfigManager.getInstance().getConfig().audioDrivenVersion
|
|
14220
14229
|
};
|
|
14221
14230
|
// 根据播报类型设置特定参数
|
|
14222
14231
|
if (task.params.type === exports.BroadcastType.TEXT) {
|
|
@@ -14231,7 +14240,7 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14231
14240
|
method: 'POST',
|
|
14232
14241
|
headers: {
|
|
14233
14242
|
'Content-Type': 'application/json',
|
|
14234
|
-
'x_auth_token': ConfigManager.getInstance().
|
|
14243
|
+
'x_auth_token': ((_a = ConfigManager.getInstance().getConfig()) === null || _a === void 0 ? void 0 : _a.token) || ''
|
|
14235
14244
|
},
|
|
14236
14245
|
body: JSON.stringify(requestBody),
|
|
14237
14246
|
signal: task.controller.signal,
|
|
@@ -14271,6 +14280,7 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14271
14280
|
}
|
|
14272
14281
|
// 处理音频数据
|
|
14273
14282
|
if (response.data) {
|
|
14283
|
+
this.hasReceivedAudio = true;
|
|
14274
14284
|
// 自定义音频播报时,如果服务器未返回音频URL,使用传入的audioUrl
|
|
14275
14285
|
if (task.params.type === exports.BroadcastType.AUDIO && task.params.audioUrl && !response.data.voiceUrl) {
|
|
14276
14286
|
response.data.voiceUrl = task.params.audioUrl;
|
|
@@ -14423,7 +14433,6 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14423
14433
|
* @private
|
|
14424
14434
|
*/
|
|
14425
14435
|
BroadcastService.prototype.getBroadcastApiPath = function (type) {
|
|
14426
|
-
ConfigManager.getInstance().getEnv();
|
|
14427
14436
|
switch (type) {
|
|
14428
14437
|
case exports.BroadcastType.TEXT:
|
|
14429
14438
|
return '/aiep-openapi/avatar-interaction/v1/broadcast/text';
|
|
@@ -14460,11 +14469,6 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14460
14469
|
BroadcastService.prototype.handleError = function (error) {
|
|
14461
14470
|
var _a, _b;
|
|
14462
14471
|
this.logger.error('Broadcast error occurred', error);
|
|
14463
|
-
// 清理控制器
|
|
14464
|
-
if (this.activeController) {
|
|
14465
|
-
this.activeController.abort();
|
|
14466
|
-
this.activeController = null;
|
|
14467
|
-
}
|
|
14468
14472
|
// 触发错误回调
|
|
14469
14473
|
(_b = (_a = this.callbacks).onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);
|
|
14470
14474
|
};
|
|
@@ -14493,6 +14497,17 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14493
14497
|
break;
|
|
14494
14498
|
}
|
|
14495
14499
|
};
|
|
14500
|
+
/**
|
|
14501
|
+
* 清理队列处理定时器
|
|
14502
|
+
* @description 清理队列处理定时器
|
|
14503
|
+
* @private
|
|
14504
|
+
*/
|
|
14505
|
+
BroadcastService.prototype.clearQueueProcessTimer = function () {
|
|
14506
|
+
if (this.queueProcessTimer) {
|
|
14507
|
+
clearInterval(this.queueProcessTimer);
|
|
14508
|
+
this.queueProcessTimer = null;
|
|
14509
|
+
}
|
|
14510
|
+
};
|
|
14496
14511
|
return BroadcastService;
|
|
14497
14512
|
}(UnityBaseService);
|
|
14498
14513
|
|
|
@@ -14511,13 +14526,11 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14511
14526
|
* @param config - Unity配置对象
|
|
14512
14527
|
* @description 初始化数字人加载器,创建Unity加载器实例
|
|
14513
14528
|
*/
|
|
14514
|
-
function ZEEAvatarLoader(
|
|
14529
|
+
function ZEEAvatarLoader() {
|
|
14515
14530
|
/** Avatar API实例 */
|
|
14516
14531
|
this.apiService = null;
|
|
14517
14532
|
/** Unity实例 */
|
|
14518
14533
|
this.unityInstance = null;
|
|
14519
|
-
// 同时设置到配置管理器中
|
|
14520
|
-
ConfigManager.getInstance().setConfig(config);
|
|
14521
14534
|
this.loader = new UnityLoader();
|
|
14522
14535
|
}
|
|
14523
14536
|
/**
|
|
@@ -14631,14 +14644,22 @@ var ZEEAvatarSDKLib = (function (exports) {
|
|
|
14631
14644
|
* @protected
|
|
14632
14645
|
*/
|
|
14633
14646
|
ZEEAvatarLoader.prototype.initGlobalConfig = function () {
|
|
14634
|
-
var
|
|
14635
|
-
|
|
14647
|
+
var config = ConfigManager.getInstance().getConfig();
|
|
14648
|
+
var globalParams = {
|
|
14649
|
+
token: config === null || config === void 0 ? void 0 : config.token,
|
|
14636
14650
|
apiBaseUrl: ConfigManager.getInstance().getApiBaseUrl(false),
|
|
14637
|
-
idleMotionList:
|
|
14638
|
-
|
|
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
|
|
14639
14658
|
};
|
|
14640
|
-
|
|
14641
|
-
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);
|
|
14642
14663
|
};
|
|
14643
14664
|
return ZEEAvatarLoader;
|
|
14644
14665
|
}();
|