@xmov/avatar 2.1.2 → 2.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmov/avatar",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "description": "魔珐数字人 JS-SDK",
5
5
  "type": "module",
6
6
  "source": "src/index.ts",
package/src/index.ts CHANGED
@@ -516,7 +516,11 @@ export default class XmovAvatar {
516
516
  }
517
517
  }
518
518
 
519
- async init(params: IInitParams): Promise<ISessionResponse | null | undefined> {
519
+ async init(params: IInitParams): Promise<void> {
520
+ await this.initializeSession(params);
521
+ }
522
+
523
+ protected async initializeSession(params: IInitParams): Promise<ISessionResponse | null | undefined> {
520
524
  // 浏览器能力检查
521
525
  const capabilityReport = await checkCapability(this.options.audioOnlyMode);
522
526
  if (!capabilityReport.supported) {
@@ -1168,6 +1172,8 @@ export default class XmovAvatar {
1168
1172
  }
1169
1173
 
1170
1174
  protected start() {
1175
+ this.renderScheduler.render();
1176
+ this.ttsa?.start();
1171
1177
  // 先发布在线状态,再启动渲染:
1172
1178
  // 避免先 render() 触发 rendering -> visible(5) 后再发 online(0),造成 0/5 状态横跳
1173
1179
  if (this.pendingInvisibleMode) {
@@ -1178,9 +1184,6 @@ export default class XmovAvatar {
1178
1184
  // 避免重连重建房间过程中(资源未下载完)反复触发 online -> visible 状态横跳
1179
1185
  this.onStatusChange(AvatarStatus.online);
1180
1186
  }
1181
- this.renderScheduler.render();
1182
- this.ttsa?.start();
1183
-
1184
1187
  }
1185
1188
 
1186
1189
  protected onTtsaReady(_sessionInfo?: ISessionResponse) {
@@ -1590,6 +1593,7 @@ export default class XmovAvatar {
1590
1593
  * 切换隐身模式(暂停/恢复音视频实时渲染)
1591
1594
  */
1592
1595
  public switchInvisibleMode(): void {
1596
+ console.log("")
1593
1597
  if (this._isClientMode) { this._apiForwarder?.switchInvisibleMode(); return; }
1594
1598
  if (!this.renderScheduler) {
1595
1599
  (window as any).avatarSDKLogger?.warn(