@spatialwalk/avatarkit 1.0.0-beta.63 → 1.0.0-beta.65

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/CHANGELOG.md CHANGED
@@ -2,6 +2,37 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.0.0-beta.65] - 2026-01-14
6
+
7
+ ### 🐛 Bugfixes
8
+ - **Transition Frame Reset Logic** - Fixed issue where `currentPlayingFrame` was not reset after generating transitions, causing jump artifacts on second conversation
9
+ - Reset `currentPlayingFrame` to `null` after generating idle->speaking transitions
10
+ - Reset `currentPlayingFrame` to `null` after generating speaking->idle transitions
11
+ - Reset `currentPlayingFrame` to `null` when entering Idle state
12
+ - Ensures each transition starts from the correct current frame by re-fetching the current state frame when needed
13
+
14
+ ## [1.0.0-beta.64] - 2026-01-14
15
+
16
+ ### ✨ New Features
17
+ - **Vite Plugin for WASM Configuration** - Added `avatarkitVitePlugin` to automate WASM file configuration
18
+ - Automatically handles WASM MIME types in dev server
19
+ - Copies WASM files to dist/assets/ during build
20
+ - Generates `_headers` file for Cloudflare Pages deployment
21
+ - Configures Vite's optimizeDeps, assetsInclude, and assetsInlineLimit
22
+
23
+ ### 🔧 Improvements
24
+ - **Unified Transition Logic** - All transitions now start from the current playing frame, ensuring smooth transitions from any state (Idle, Speaking, or Transitioning)
25
+ - **Idle State Performance** - Optimized idle state to avoid unnecessary frame parameter fetching on every frame
26
+ - **Transition Animation** - Idle->Speaking uses linear interpolation, Speaking->Idle uses Bezier curve easing
27
+
28
+ ### 🐛 Bugfixes
29
+ - Fixed vanilla demo audio context initialization issue
30
+ - Fixed recording button only working once in vanilla demo
31
+ - Fixed host mode data loading to use local files instead of API endpoint
32
+
33
+ ### 📚 Documentation
34
+ - Added transition animation technical specification document for cross-platform alignment
35
+
5
36
  ## [1.0.0-beta.63] - 2026-01-14
6
37
 
7
38
  ### ✨ New Features
package/README.md CHANGED
@@ -18,6 +18,70 @@ Real-time virtual avatar rendering SDK based on 3D Gaussian Splatting, supportin
18
18
  npm install @spatialwalk/avatarkit
19
19
  ```
20
20
 
21
+ ## 🔧 Vite 配置(推荐)
22
+
23
+ 如果你使用 Vite 作为构建工具,强烈推荐使用我们的 Vite 插件来自动处理 WASM 文件配置。插件会自动处理所有必要的配置,让你无需手动设置。
24
+
25
+ ### 使用插件
26
+
27
+ 在 `vite.config.ts` 中添加插件:
28
+
29
+ ```typescript
30
+ import { defineConfig } from 'vite'
31
+ import { avatarkitVitePlugin } from '@spatialwalk/avatarkit/vite'
32
+
33
+ export default defineConfig({
34
+ plugins: [
35
+ avatarkitVitePlugin(), // 添加这一行即可
36
+ ],
37
+ })
38
+ ```
39
+
40
+ ### 插件功能
41
+
42
+ 插件会自动处理:
43
+
44
+ - ✅ **开发服务器**:自动设置 WASM 文件的正确 MIME 类型 (`application/wasm`)
45
+ - ✅ **构建时**:自动复制 WASM 文件到 `dist/assets/` 目录
46
+ - ✅ **Cloudflare Pages**:自动生成 `_headers` 文件
47
+ - ✅ **Vite 配置**:自动配置 `optimizeDeps`、`assetsInclude`、`assetsInlineLimit` 等选项
48
+
49
+ ### 手动配置(不使用插件)
50
+
51
+ 如果你不使用 Vite 插件,需要手动配置以下内容:
52
+
53
+ ```typescript
54
+ // vite.config.ts
55
+ export default defineConfig({
56
+ optimizeDeps: {
57
+ exclude: ['@spatialwalk/avatarkit'],
58
+ },
59
+ assetsInclude: ['**/*.wasm'],
60
+ build: {
61
+ assetsInlineLimit: 0,
62
+ rollupOptions: {
63
+ output: {
64
+ assetFileNames: (assetInfo) => {
65
+ if (assetInfo.name?.endsWith('.wasm')) {
66
+ return 'assets/[name][extname]'
67
+ }
68
+ return 'assets/[name]-[hash][extname]'
69
+ },
70
+ },
71
+ },
72
+ },
73
+ // 开发服务器需要手动配置中间件设置 WASM MIME 类型
74
+ configureServer(server) {
75
+ server.middlewares.use((req, res, next) => {
76
+ if (req.url?.endsWith('.wasm')) {
77
+ res.setHeader('Content-Type', 'application/wasm')
78
+ }
79
+ next()
80
+ })
81
+ },
82
+ })
83
+ ```
84
+
21
85
  ## 🎯 Quick Start
22
86
 
23
87
  ### ⚠️ Important: Audio Context Initialization
@@ -592,17 +656,17 @@ The rendering system automatically selects the best backend, no manual configura
592
656
 
593
657
  ## 🚨 Error Handling
594
658
 
595
- ### SPAvatarError
659
+ ### AvatarError
596
660
 
597
661
  The SDK uses custom error types, providing more detailed error information:
598
662
 
599
663
  ```typescript
600
- import { SPAvatarError } from '@spatialwalk/avatarkit'
664
+ import { AvatarError } from '@spatialwalk/avatarkit'
601
665
 
602
666
  try {
603
667
  await avatarView.avatarController.start()
604
668
  } catch (error) {
605
- if (error instanceof SPAvatarError) {
669
+ if (error instanceof AvatarError) {
606
670
  console.error('SDK Error:', error.message, error.code)
607
671
  } else {
608
672
  console.error('Unknown error:', error)
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { A as APP_CONFIG, l as logger, e as errorToMessage, a as logEvent } from "./index-C1md-jKJ.js";
4
+ import { A as APP_CONFIG, l as logger, e as errorToMessage, a as logEvent } from "./index-xTAIRBMF.js";
5
5
  class StreamingAudioPlayer {
6
6
  constructor(options) {
7
7
  __publicField(this, "audioContext", null);