@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/dist/index.d.ts CHANGED
@@ -114,32 +114,6 @@ interface IUnityMessageSender<T extends string> {
114
114
  /** 发送异步消息到Unity并等待回调 */
115
115
  sendAsyncMessage(methodName: string, operation: T, parameter?: any): Promise<IUnityCallbackResponse>;
116
116
  }
117
- /**
118
- * Unity服务日志级别枚举
119
- * @enum {string}
120
- * @description 定义日志记录的级别
121
- */
122
- declare enum LogLevel {
123
- DEBUG = "debug",
124
- INFO = "info",
125
- WARN = "warn",
126
- ERROR = "error"
127
- }
128
- /**
129
- * Unity服务日志记录器接口
130
- * @interface IUnityLogger
131
- * @description 统一的日志记录接口
132
- */
133
- interface IUnityLogger {
134
- /** 记录调试信息 */
135
- debug(message: string, data?: any): void;
136
- /** 记录一般信息 */
137
- info(message: string, data?: any): void;
138
- /** 记录警告信息 */
139
- warn(message: string, data?: any): void;
140
- /** 记录错误信息 */
141
- error(message: string, error?: Error, data?: any): void;
142
- }
143
117
 
144
118
  /**
145
119
  * @fileoverview 流式播报服务接口定义
@@ -305,8 +279,14 @@ interface IBroadcastAPI {
305
279
  isActive: boolean;
306
280
  isGeneratingAudio: boolean;
307
281
  hasReceivedAudio: boolean;
308
- pendingCallbacks: number;
309
- hasController: boolean;
282
+ queueInfo?: {
283
+ totalTasks: number;
284
+ requestingTasks: number;
285
+ completedTasks: number;
286
+ failedTasks: number;
287
+ totalPendingResponses: number;
288
+ currentSendingSequence: number;
289
+ };
310
290
  };
311
291
  /**
312
292
  * 销毁播报服务
@@ -331,10 +311,8 @@ interface IAvatarSDKConfig {
331
311
  env?: 'dev' | 'test' | 'prod' | 'custom';
332
312
  /** api接口地址,仅当env为custom时有效 */
333
313
  apiUrl?: string;
334
- /** 资源文件地址,仅当env为custom时有效 */
335
- assetsUrl?: string;
336
- /** AB资源文件地址 */
337
- resourcesUrl?: string;
314
+ /** 资源文件地址(父级路径),从平台下载的资源文件所解压出来的目录 */
315
+ assetsUrl: string;
338
316
  /** Unity加载器脚本URL */
339
317
  loaderUrl: string;
340
318
  /** Unity数据文件URL */
@@ -353,6 +331,8 @@ interface IAvatarSDKConfig {
353
331
  broadcastCallbacks?: IBroadcastCallbacks;
354
332
  /** 是否启用调试日志,默认为false */
355
333
  enableDebugLog?: boolean;
334
+ /** 内部 WEBGL 版本 */
335
+ audioDrivenVersion?: string;
356
336
  }
357
337
 
358
338
  /**
@@ -394,6 +374,8 @@ interface IAvatarCallbackResponse extends IUnityCallbackResponse {
394
374
  motionId?: string;
395
375
  /** 动作剩余时间,可选 */
396
376
  motionRemainingTime?: number;
377
+ /** 内部 WEBGL 版本 */
378
+ audioDrivenVersion?: string;
397
379
  };
398
380
  }
399
381
  /**
@@ -454,8 +436,6 @@ interface IAvatarAPI {
454
436
  * @description 提供统一的SDK接口,简化用户使用体验,支持多实例
455
437
  */
456
438
  declare class ZEEAvatarSDK {
457
- /** SDK配置 */
458
- private config;
459
439
  /** SDK唯一标识符 */
460
440
  private readonly instanceId;
461
441
  /** Unity加载器实例 */
@@ -468,6 +448,8 @@ declare class ZEEAvatarSDK {
468
448
  private unityInstance;
469
449
  /** SDK初始化状态 */
470
450
  private isInitialized;
451
+ /** SDK日志 */
452
+ private readonly logger;
471
453
  /**
472
454
  * 构造函数
473
455
  * @param config SDK配置对象
@@ -546,8 +528,14 @@ declare class ZEEAvatarSDK {
546
528
  isActive: boolean;
547
529
  isGeneratingAudio: boolean;
548
530
  hasReceivedAudio: boolean;
549
- pendingCallbacks: number;
550
- hasController: boolean;
531
+ queueInfo?: {
532
+ totalTasks: number;
533
+ requestingTasks: number;
534
+ completedTasks: number;
535
+ failedTasks: number;
536
+ totalPendingResponses: number;
537
+ currentSendingSequence: number;
538
+ };
551
539
  };
552
540
  /**
553
541
  * 销毁SDK实例
@@ -573,7 +561,7 @@ declare class ZEEAvatarSDK {
573
561
  * 获取SDK配置
574
562
  * @returns IAvatarSDKConfig 当前配置
575
563
  */
576
- getConfig(): IAvatarSDKConfig;
564
+ getConfig(): IAvatarSDKConfig | null;
577
565
  /**
578
566
  * 确保SDK已初始化
579
567
  * @private
@@ -581,6 +569,32 @@ declare class ZEEAvatarSDK {
581
569
  private ensureInitialized;
582
570
  }
583
571
 
572
+ /**
573
+ * @fileoverview SDK 版本号常量
574
+ * @description 此文件由构建脚本自动生成,请勿手动修改
575
+ */
576
+ /**
577
+ * SDK 版本号
578
+ * @const {string} SDK_VERSION
579
+ */
580
+ declare const SDK_VERSION = "2.1.1";
581
+
582
+ /**
583
+ * Unity服务日志记录器接口
584
+ * @interface ISimpleLogger
585
+ * @description 统一的日志记录接口
586
+ */
587
+ interface ISimpleLogger {
588
+ /** 记录调试信息 */
589
+ debug(message: string, data?: any): void;
590
+ /** 记录一般信息 */
591
+ info(message: string, data?: any): void;
592
+ /** 记录警告信息 */
593
+ warn(message: string, data?: any): void;
594
+ /** 记录错误信息 */
595
+ error(message: string, error?: Error, data?: any): void;
596
+ }
597
+
584
598
  /**
585
599
  * @fileoverview Unity服务抽象基类
586
600
  * @description 提供Unity服务的通用基础实现,包括回调管理、消息发送、错误处理等功能
@@ -601,7 +615,7 @@ declare abstract class UnityBaseService<T extends string> implements IUnityCallb
601
615
  /** 操作超时时间 */
602
616
  protected readonly timeout: number;
603
617
  /** 日志记录器 */
604
- protected readonly logger: IUnityLogger;
618
+ protected readonly logger: ISimpleLogger;
605
619
  /** 最大重试次数 */
606
620
  protected readonly maxRetries: number;
607
621
  /** SDK实例唯一标识符 */
@@ -751,6 +765,7 @@ declare class AvatarService extends UnityBaseService<AvatarOperationType> implem
751
765
  * ```
752
766
  */
753
767
  initializeAvatar(avatarCode: string, cameraType?: AvatarCameraType): Promise<IAvatarCallbackResponse>;
768
+ handleCallback(operation: AvatarOperationType, code: number, message: string, data?: string): void;
754
769
  /**
755
770
  * 播放数字人动作
756
771
  * @param clipCode - 动作编码
@@ -845,14 +860,14 @@ declare class BroadcastService extends UnityBaseService<BroadcastOperationType>
845
860
  private taskSequence;
846
861
  /** 当前发送任务的序号 */
847
862
  private currentSendingSequence;
848
- /** 是否正在生成音频 */
849
- private isGeneratingAudio;
863
+ /** 是否正在播报音频 */
864
+ private isBroadcastingAudio;
850
865
  /** 是否已经收到音频 */
851
866
  private hasReceivedAudio;
852
867
  /** 队列处理定时器 */
853
868
  private queueProcessTimer;
854
- /** 主请求控制器(兼容性保留) */
855
- private activeController;
869
+ /** 播报完成次数 */
870
+ private broadcastCompletedCount;
856
871
  /**
857
872
  * 构造函数
858
873
  * @param config - 播报服务配置
@@ -959,8 +974,6 @@ declare class BroadcastService extends UnityBaseService<BroadcastOperationType>
959
974
  isActive: boolean;
960
975
  isGeneratingAudio: boolean;
961
976
  hasReceivedAudio: boolean;
962
- pendingCallbacks: number;
963
- hasController: boolean;
964
977
  queueInfo?: {
965
978
  totalTasks: number;
966
979
  requestingTasks: number;
@@ -1084,6 +1097,12 @@ declare class BroadcastService extends UnityBaseService<BroadcastOperationType>
1084
1097
  * @private
1085
1098
  */
1086
1099
  private handleBroadcastError;
1100
+ /**
1101
+ * 清理队列处理定时器
1102
+ * @description 清理队列处理定时器
1103
+ * @private
1104
+ */
1105
+ private clearQueueProcessTimer;
1087
1106
  }
1088
1107
 
1089
1108
  /**
@@ -1158,7 +1177,9 @@ declare enum ResourceErrorCode {
1158
1177
  /** 资源不存在 */
1159
1178
  NOT_FOUND = 3003,
1160
1179
  /** 资源格式不支持 */
1161
- UNSUPPORTED_FORMAT = 3004
1180
+ UNSUPPORTED_FORMAT = 3004,
1181
+ /** 资源版本不兼容 */
1182
+ VERSION_INCOMPATIBLE = 3005
1162
1183
  }
1163
1184
  /**
1164
1185
  * 系统错误码 (4xxx)
@@ -1322,7 +1343,7 @@ declare class ZEEAvatarLoader {
1322
1343
  * @param config - Unity配置对象
1323
1344
  * @description 初始化数字人加载器,创建Unity加载器实例
1324
1345
  */
1325
- constructor(config: IAvatarSDKConfig);
1346
+ constructor();
1326
1347
  /**
1327
1348
  * 初始化数字人SDK
1328
1349
  * @returns Promise<IAvatarAPI> 返回Avatar API的Promise
@@ -1383,5 +1404,5 @@ declare class ZEEAvatarLoader {
1383
1404
  protected initGlobalConfig(): void;
1384
1405
  }
1385
1406
 
1386
- export { AvatarCameraType, AvatarOperationType, AvatarService, BroadcastOperationType, BroadcastService, BroadcastType, ConfigErrorCode, ERROR_CODE_MAP, ErrorCategory, LogLevel, NetworkErrorCode, OperationErrorCode, ResourceErrorCode, SDKError, SystemErrorCode, UnityOperationStatus, ZEEAvatarLoader, ZEEAvatarSDK, getErrorInfo };
1387
- export type { IAvatarAPI, IAvatarCallbackResponse, IAvatarSDKConfig, IBroadcastAPI, IBroadcastCallbacks, IBroadcastParams, IBroadcastResponse, IBroadcastServiceConfig, IUnityCallbackManager, IUnityCallbackResponse, IUnityInstance, IUnityLogger, IUnityMessageSender, IUnityServiceConfig, SDKErrorCode, TOperationType };
1407
+ export { AvatarCameraType, AvatarOperationType, AvatarService, BroadcastOperationType, BroadcastService, BroadcastType, ConfigErrorCode, ERROR_CODE_MAP, ErrorCategory, NetworkErrorCode, OperationErrorCode, ResourceErrorCode, SDKError, SDK_VERSION, SystemErrorCode, UnityOperationStatus, ZEEAvatarLoader, ZEEAvatarSDK, getErrorInfo };
1408
+ export type { IAvatarAPI, IAvatarCallbackResponse, IAvatarSDKConfig, IBroadcastAPI, IBroadcastCallbacks, IBroadcastParams, IBroadcastResponse, IBroadcastServiceConfig, IUnityCallbackManager, IUnityCallbackResponse, IUnityInstance, IUnityMessageSender, IUnityServiceConfig, SDKErrorCode, TOperationType };