@spatialwalk/avatarkit 1.0.0-beta.7 → 1.0.0-beta.71

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.
Files changed (101) hide show
  1. package/CHANGELOG.md +602 -10
  2. package/README.md +475 -312
  3. package/dist/StreamingAudioPlayer-D8Q8WiEg.js +638 -0
  4. package/dist/animation/AnimationWebSocketClient.d.ts +6 -50
  5. package/dist/animation/utils/eventEmitter.d.ts +1 -9
  6. package/dist/animation/utils/flameConverter.d.ts +3 -24
  7. package/dist/audio/AnimationPlayer.d.ts +6 -57
  8. package/dist/audio/StreamingAudioPlayer.d.ts +2 -118
  9. package/dist/avatar_core_wasm-Dv943JJl.js +2696 -0
  10. package/dist/{avatar_core_wasm.wasm → avatar_core_wasm-e68766db.wasm} +0 -0
  11. package/dist/config/app-config.d.ts +3 -4
  12. package/dist/config/constants.d.ts +10 -18
  13. package/dist/config/sdk-config-loader.d.ts +4 -10
  14. package/dist/core/Avatar.d.ts +2 -14
  15. package/dist/core/AvatarController.d.ts +95 -85
  16. package/dist/core/AvatarDownloader.d.ts +7 -92
  17. package/dist/core/AvatarManager.d.ts +22 -12
  18. package/dist/core/AvatarSDK.d.ts +35 -0
  19. package/dist/core/AvatarView.d.ts +55 -140
  20. package/dist/core/NetworkLayer.d.ts +7 -59
  21. package/dist/generated/common/v1/models.d.ts +36 -0
  22. package/dist/generated/driveningress/v1/driveningress.d.ts +0 -1
  23. package/dist/generated/driveningress/v2/driveningress.d.ts +82 -1
  24. package/dist/generated/google/protobuf/struct.d.ts +0 -1
  25. package/dist/generated/google/protobuf/timestamp.d.ts +0 -1
  26. package/dist/index-U8QcNdma.js +16477 -0
  27. package/dist/index.d.ts +2 -4
  28. package/dist/index.js +17 -18
  29. package/dist/renderer/RenderSystem.d.ts +9 -79
  30. package/dist/renderer/covariance.d.ts +3 -11
  31. package/dist/renderer/renderer.d.ts +6 -2
  32. package/dist/renderer/sortSplats.d.ts +3 -10
  33. package/dist/renderer/webgl/reorderData.d.ts +4 -11
  34. package/dist/renderer/webgl/webglRenderer.d.ts +34 -4
  35. package/dist/renderer/webgpu/webgpuRenderer.d.ts +30 -5
  36. package/dist/types/character-settings.d.ts +1 -1
  37. package/dist/types/character.d.ts +3 -15
  38. package/dist/types/index.d.ts +123 -43
  39. package/dist/utils/animation-interpolation.d.ts +4 -15
  40. package/dist/utils/client-id.d.ts +6 -0
  41. package/dist/utils/conversationId.d.ts +10 -0
  42. package/dist/utils/error-utils.d.ts +0 -1
  43. package/dist/utils/id-manager.d.ts +34 -0
  44. package/dist/utils/logger.d.ts +2 -11
  45. package/dist/utils/posthog-tracker.d.ts +8 -0
  46. package/dist/utils/pwa-cache-manager.d.ts +17 -0
  47. package/dist/utils/usage-tracker.d.ts +6 -0
  48. package/dist/vanilla/vite.config.d.ts +2 -0
  49. package/dist/vite.d.ts +19 -0
  50. package/dist/wasm/avatarCoreAdapter.d.ts +15 -126
  51. package/dist/wasm/avatarCoreMemory.d.ts +5 -2
  52. package/package.json +19 -8
  53. package/vite.d.ts +20 -0
  54. package/vite.js +126 -0
  55. package/dist/StreamingAudioPlayer-D7s8q5h0.js +0 -319
  56. package/dist/StreamingAudioPlayer-D7s8q5h0.js.map +0 -1
  57. package/dist/animation/AnimationWebSocketClient.d.ts.map +0 -1
  58. package/dist/animation/utils/eventEmitter.d.ts.map +0 -1
  59. package/dist/animation/utils/flameConverter.d.ts.map +0 -1
  60. package/dist/audio/AnimationPlayer.d.ts.map +0 -1
  61. package/dist/audio/StreamingAudioPlayer.d.ts.map +0 -1
  62. package/dist/avatar_core_wasm-D4eEi7Eh.js +0 -1666
  63. package/dist/avatar_core_wasm-D4eEi7Eh.js.map +0 -1
  64. package/dist/config/app-config.d.ts.map +0 -1
  65. package/dist/config/constants.d.ts.map +0 -1
  66. package/dist/config/sdk-config-loader.d.ts.map +0 -1
  67. package/dist/core/Avatar.d.ts.map +0 -1
  68. package/dist/core/AvatarController.d.ts.map +0 -1
  69. package/dist/core/AvatarDownloader.d.ts.map +0 -1
  70. package/dist/core/AvatarKit.d.ts +0 -66
  71. package/dist/core/AvatarKit.d.ts.map +0 -1
  72. package/dist/core/AvatarManager.d.ts.map +0 -1
  73. package/dist/core/AvatarView.d.ts.map +0 -1
  74. package/dist/core/NetworkLayer.d.ts.map +0 -1
  75. package/dist/generated/driveningress/v1/driveningress.d.ts.map +0 -1
  76. package/dist/generated/driveningress/v2/driveningress.d.ts.map +0 -1
  77. package/dist/generated/google/protobuf/struct.d.ts.map +0 -1
  78. package/dist/generated/google/protobuf/timestamp.d.ts.map +0 -1
  79. package/dist/index-CpSvWi6A.js +0 -6026
  80. package/dist/index-CpSvWi6A.js.map +0 -1
  81. package/dist/index.d.ts.map +0 -1
  82. package/dist/index.js.map +0 -1
  83. package/dist/renderer/RenderSystem.d.ts.map +0 -1
  84. package/dist/renderer/covariance.d.ts.map +0 -1
  85. package/dist/renderer/renderer.d.ts.map +0 -1
  86. package/dist/renderer/sortSplats.d.ts.map +0 -1
  87. package/dist/renderer/webgl/reorderData.d.ts.map +0 -1
  88. package/dist/renderer/webgl/webglRenderer.d.ts.map +0 -1
  89. package/dist/renderer/webgpu/webgpuRenderer.d.ts.map +0 -1
  90. package/dist/types/character-settings.d.ts.map +0 -1
  91. package/dist/types/character.d.ts.map +0 -1
  92. package/dist/types/index.d.ts.map +0 -1
  93. package/dist/utils/animation-interpolation.d.ts.map +0 -1
  94. package/dist/utils/cls-tracker.d.ts +0 -17
  95. package/dist/utils/cls-tracker.d.ts.map +0 -1
  96. package/dist/utils/error-utils.d.ts.map +0 -1
  97. package/dist/utils/logger.d.ts.map +0 -1
  98. package/dist/utils/reqId.d.ts +0 -20
  99. package/dist/utils/reqId.d.ts.map +0 -1
  100. package/dist/wasm/avatarCoreAdapter.d.ts.map +0 -1
  101. package/dist/wasm/avatarCoreMemory.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -5,32 +5,624 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.0-beta.71] - 2026-01-17
9
+
10
+ ### 🔧 Improvements
11
+ - **Internal API** - Marked all audio and animation internal classes with `@internal` to prevent public API exposure
12
+ - **Type Safety** - Hidden `AnimationPlayer`, `StreamingAudioPlayer`, `AnimationWebSocketClient`, and related utilities from public API
13
+ - **Internal Documentation** - Fixed missing English translations in `AnimationWebSocketClient.ts`
14
+
15
+ ## [1.0.0-beta.70] - 2026-01-17
16
+
17
+ ### 🔧 Improvements
18
+ - **Code Cleanup** - Removed unused `FlatSplatData` interface from public API
19
+ - **Internal Documentation** - Translated all internal code comments to English for consistency
20
+
21
+ ## [1.0.0-beta.69] - 2026-01-17
22
+
23
+ ### 🔧 Improvements
24
+ - **API Documentation** - All public API comments are now in English with JSDoc support for better IDE IntelliSense
25
+ - **Type Safety** - Removed internal types from public API exports, using `KeyframeData` instead of `Flame`
26
+ - **Build Configuration** - JSDoc comments are now preserved in generated `.d.ts` files
27
+
28
+ ### 📚 Documentation
29
+ - Enhanced audio data format documentation with WAV and MP3 processing examples
30
+
31
+ ## [1.0.0-beta.68] - 2026-01-17
32
+
33
+ ### 🐛 Bugfixes
34
+ - **Vite Plugin WASM File Detection** - Fixed Vite plugin not finding WASM files with hash in consuming projects
35
+ - Plugin now reads JS glue file to extract referenced WASM filename (including hash)
36
+ - Ensures correct WASM file is copied to match JS glue file references
37
+ - Prevents 404 errors when WASM files have content-based hashes
38
+ - Fixes issue where `avatar_core_wasm.wasm` was not found after adding hash support
39
+
40
+ ## [1.0.0-beta.67] - 2026-01-17
41
+
42
+ ### 🐛 Bugfixes
43
+ - **WASM File Hash Support** - Fixed critical issue where WASM files were not being hashed during SDK build
44
+ - WASM files now automatically get content-based hash (e.g., `avatar_core_wasm-{hash}.wasm`)
45
+ - JS glue files are automatically updated to reference the hashed WASM filename
46
+ - Prevents browser cache issues when WASM files are updated
47
+ - Ensures proper version management and cache invalidation
48
+
49
+ ### 🔧 Improvements
50
+ - **Build Process** - Enhanced SDK build process to automatically handle WASM file hashing
51
+ - Hash is calculated based on WASM file content (SHA256, first 8 characters)
52
+ - Build logs now show hash generation progress
53
+ - Compatible with existing Vite plugin for consuming projects
54
+
55
+ ## [1.0.0-beta.65] - 2026-01-14
56
+
57
+ ### 🐛 Bugfixes
58
+ - **Transition Frame Reset Logic** - Fixed issue where `currentPlayingFrame` was not reset after generating transitions, causing jump artifacts on second conversation
59
+ - Reset `currentPlayingFrame` to `null` after generating idle->speaking transitions
60
+ - Reset `currentPlayingFrame` to `null` after generating speaking->idle transitions
61
+ - Reset `currentPlayingFrame` to `null` when entering Idle state
62
+ - Ensures each transition starts from the correct current frame by re-fetching the current state frame when needed
63
+
64
+ ## [1.0.0-beta.64] - 2026-01-14
65
+
66
+ ### ✨ New Features
67
+ - **Vite Plugin for WASM Configuration** - Added `avatarkitVitePlugin` to automate WASM file configuration
68
+ - Automatically handles WASM MIME types in dev server
69
+ - Copies WASM files to dist/assets/ during build
70
+ - Generates `_headers` file for Cloudflare Pages deployment
71
+ - Configures Vite's optimizeDeps, assetsInclude, and assetsInlineLimit
72
+
73
+ ### 🔧 Improvements
74
+ - **Unified Transition Logic** - All transitions now start from the current playing frame, ensuring smooth transitions from any state (Idle, Speaking, or Transitioning)
75
+ - **Idle State Performance** - Optimized idle state to avoid unnecessary frame parameter fetching on every frame
76
+ - **Transition Animation** - Idle->Speaking uses linear interpolation, Speaking->Idle uses Bezier curve easing
77
+
78
+ ### 🐛 Bugfixes
79
+ - Fixed vanilla demo audio context initialization issue
80
+ - Fixed recording button only working once in vanilla demo
81
+ - Fixed host mode data loading to use local files instead of API endpoint
82
+
83
+ ### 📚 Documentation
84
+ - Added transition animation technical specification document for cross-platform alignment
85
+
86
+ ## [1.0.0-beta.63] - 2026-01-14
87
+
88
+ ### ✨ New Features
89
+ - **Audio Context Initialization API** - Added `initializeAudioContext()` method to `AvatarController`
90
+ - Must be called in a user gesture context (click, touchstart, etc.) before any audio operations
91
+ - Ensures AudioContext is created and initialized in a user gesture context, preventing browser security policy issues
92
+ - All audio operations (`send()`, `yieldAudioData()`, `start()`, `playback()`, etc.) now require prior initialization
93
+
94
+ ### 🔧 Improvements
95
+ - **Initialization Flow** - Removed all lazy initialization logic for audio context
96
+ - Audio context initialization is now centralized in `initializeAudioContext()` method
97
+ - All audio operations check for initialization before proceeding
98
+ - Clear error messages when audio operations are attempted without initialization
99
+
100
+ ### 🐛 Bugfixes
101
+ - **Audio Context User Gesture Requirement** - Fixed issue where AudioContext could not be properly initialized when external applications request recording permissions
102
+ - Audio context must now be initialized in user gesture context, ensuring browser security policies are satisfied
103
+
104
+ ## [1.0.0-beta.62] - 2026-01-14
105
+
106
+ ### ✨ New Features
107
+ - **Bezier Curve Transition Animation** - Implemented Bezier curve easing functions for smoother transitions
108
+ - Added Bezier curve interpolation with different curves for different facial components (jaw, expression, eye, neck, global)
109
+ - Replaced linear interpolation with Bezier curve interpolation for more natural animation
110
+ - Split transition duration into start (200ms) and end (1600ms) for different transition types
111
+
112
+ ### 🔧 Improvements
113
+ - **Transition API Enhancement** - Updated `generateTransitionFromIdle()` to support both start and end transitions
114
+ - Added `transitionType` parameter: `'start'` for Idle -> Flame, `'end'` for Flame -> Idle
115
+ - Removed deprecated linear interpolation code and unused easing functions
116
+
117
+ ## [1.0.0-beta.61] - 2026-01-14
118
+
119
+ ### 🔧 Improvements
120
+ - **Telemetry Events Update** - Updated telemetry events with new parameters and structure
121
+ - `sdk_initialized`: Added `env` and `dsm` parameters
122
+ - `driving_service_latency`: Replaced `driving_latency`, now tracks `tap_0`, `tap_1`, `tap_2`, `tap_f` timestamps (Number type, milliseconds)
123
+ - `avatar_active`: New event for avatar view activity tracking with `env` and `dsm` parameters, reported on first render and every 10 minutes
124
+ - **Heartbeat Refactoring** - Removed `HeartbeatManager`, integrated heartbeat functionality into `NetworkLayer` (driving service heartbeat) and `AvatarView` (avatar active heartbeat)
125
+
126
+ ## [1.0.0-beta.60] - 2026-01-14
127
+
128
+ ### 🔧 Configuration Changes
129
+ - **PostHog Configuration** - PostHog telemetry now always uses the international site regardless of environment configuration
130
+
131
+ ## [1.0.0-beta.59] - 2026-01-14
132
+
133
+ ### 🐛 Bugfixes
134
+ - **AudioContext Auto-Resume** - Fixed issue where audio playback would get stuck after external applications request recording permissions. AudioContext now automatically resumes when suspended during playback
135
+ - **PostHog Instance Initialization** - Fixed PostHog named instance initialization to avoid conflicts with external PostHog instances
136
+
137
+ ## [1.0.0-beta.58] - 2026-01-14
138
+
139
+ ### ✨ New Features
140
+ - **Pure Rendering Mode APIs** - Added `renderFlame()` and `generateTransitionFromIdle()` methods to `AvatarView` for external-controlled rendering without audio synchronization
141
+
142
+ ## [1.0.0-beta.57] - 2026-01-09
143
+
144
+ ### 🐛 Bugfixes
145
+ - **Idle Animation Jiggle Fix** - Fixed issue where idle animation would "jiggle" before transitioning to speaking when external audio and animation data were sent. The `handleInterrupt()` method now correctly skips processing when already in `Idle` state, preventing unnecessary idle loop restarts.
146
+
147
+ ## [1.0.0-beta.56] - 2026-01-09
148
+
149
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
150
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
151
+
152
+ ## [1.0.0-beta.56] - 2025-01-05
153
+
154
+ ### ✨ New Features
155
+ - **Eye Tracking Config API** - Changed `eyeTrackingEnabled` to complete `eyefocus` configuration object in `PostProcessingConfig`. External callers must provide full `eyefocus` configuration (enabled, auto_eyelid_adjustment, eyelid_threshold, targets) instead of just a boolean flag.
156
+
157
+ ## [1.0.0-beta.55] - 2025-01-05
158
+
159
+ ### ✨ New Features
160
+ - **Eye Tracking Control** - Added `eyeTrackingEnabled` parameter to `PostProcessingConfig`, allowing external control of eye tracking enable/disable state in real-time
161
+ - **Point Count API** - Added `getPointCount()` method to `AvatarController` to get the point cloud count of the current avatar
162
+
163
+ ## [1.0.0-beta.54] - 2025-01-05
164
+
165
+ ### 🐛 Bugfix
166
+ - **Transition Animation Completion** - Fixed issue where `onTransitionComplete()` was not called when `transitionKeyframes` was empty, causing audio playback to freeze after transition animations. Now, when there are no transition frames, the state correctly transitions to `Speaking` and `onTransitionComplete()` is called to start audio playback.
167
+
168
+ ## [1.0.0-beta.53] - 2025-01-05
169
+
170
+ ### 🐛 Bugfix
171
+ - **Race Condition Fix** - Fixed race condition where `startStreamingPlaybackInternal()` could be called multiple times when `yieldKeyframes` received data rapidly, causing audio chunks to be cleared and playback to freeze after transition animations. Added `isStartingPlayback` flag to prevent concurrent execution.
172
+
173
+ ## [1.0.0-beta.52] - 2025-01-05
174
+
175
+ ### 🔧 Performance Improvements
176
+ - **Telemetry Optimization** - Consolidated resource download telemetry: removed individual `resource_download` events and added cache information (`cache_hit`, `cache_type`) to total duration metrics (`template_resources_load_measure` and `download_avatar_assets_total_measure`). This enables analysis of download times for cache misses while reducing telemetry overhead.
177
+
178
+ ## [1.0.0-beta.51] - 2025-01-05
179
+
180
+ ### 🐛 Bugfix
181
+ - **Character Settings Update** - Fixed issue where cached Avatar instances would not update `characterSettings` in resources when `characterMeta` was updated. Now `resources.characterSettings` is synchronized when `characterMeta` changes, ensuring new `AvatarView` instances use the latest configuration.
182
+
183
+ ### ✨ New Features
184
+ - **Post-Processing Config Enhancement** - Added `translation` and `eyePose` fields to `PostProcessingConfig` interface:
185
+ - `translation`: Position offset (x, y, z)
186
+ - `eyePose`: Eye pose offset with bias and weights (x, y, z, weightX, weightY, weightZ), applied to both left and right eyes
187
+
188
+ ## [1.0.0-beta.50] - 2025-01-05
189
+
190
+ ### 🔧 Performance Improvements
191
+ - **Removed CORS Preflight for Meta API** - Removed authentication headers (`X-App-Id` and `Authorization`) and unnecessary `Content-Type` header from avatar metadata API requests. This eliminates CORS preflight requests for simple GET requests, improving loading performance.
192
+
193
+ ## [1.0.0-beta.49] - 2025-01-05
194
+
195
+ ### 🐛 Bugfix
196
+ - **Template Cache Version** - Fixed issue where template cache would be incorrectly cleared when switching between different SDK versions. Now uses independent template resource version (1.0.0) instead of SDK version, allowing different SDK versions to share the same template cache when template resources are identical.
197
+
198
+ ## [1.0.0-beta.48] - 2025-01-05
199
+
200
+ ### ✨ New Features
201
+ - **PWA Cache Management** - Added automatic PWA cache management for avatar and template resources to improve loading performance
202
+
203
+ ### 🔧 Performance Improvements
204
+ - **Cache Hit Rate Metrics** - Resource downloads now report cache status for analytics
205
+
206
+ ## [1.0.0-beta.47] - 2025-12-29
207
+
208
+ ### 🐛 Bugfix
209
+ - **Avatar Meta Update** - Fixed issue where cached Avatar instances would return stale avatar metadata even when the latest metadata was fetched. Now the avatar metadata is always updated to the latest version when loading an avatar, even if the version number hasn't changed.
210
+
211
+ ## [1.0.0-beta.46] - 2025-12-29
212
+
213
+ ### 🐛 Bugfix
214
+ - Expose `getCharacterMeta()` method in `Avatar` class as public API
215
+
216
+ ## [1.0.0-beta.45] - 2025-12-29
217
+
218
+ ### ✨ New Features
219
+ - **Immediate Rendering on Pause** - When playback is paused, updating post-processing parameters or camera configuration will immediately re-render the current frame:
220
+ - Post-processing parameters (rotation, neck pose, jaw pose, eye blink, etc.) now apply immediately when updated during pause
221
+ - Camera configuration (position, target, FOV, etc.) now applies immediately when updated during pause
222
+ - During normal playback, these updates still apply on the next frame as before
223
+
224
+ ### 🔄 API Changes
225
+
226
+ ### 🔄 API Changes
227
+ - **AvatarView Ready Promise Replaced with Callback** - Replaced `ready: Promise<void>` property with `onFirstRendering?: () => void` callback for better async handling:
228
+ - Removed `ready` Promise property
229
+ - Added `onFirstRendering` optional callback that is called when the first frame is rendered
230
+ - Callback-based approach is more idiomatic and easier to use than Promise-based approach
231
+
232
+ ### 🗑️ Removed
233
+ - **Removed unused `seek()` method** - Removed unused and buggy `seek()` method from `StreamingAudioPlayer`
234
+
235
+ ## [1.0.0-beta.44] - 2025-12-29
236
+
237
+ ### 🔧 Performance Improvements
238
+ - **Removed unnecessary headers from static resource requests** - Removed `X-App-Id` and `Authorization` headers from static resource downloads (shape.pb, point_cloud.ply, camera.json, etc.) to avoid CORS preflight requests and improve loading performance
239
+
240
+ ## [1.0.0-beta.43] - 2025-12-29
241
+
242
+ ### 🔧 Improvements
243
+ - Remove some unnecessary telemetry reporting
244
+
245
+ ## [1.0.0-beta.42] - 2025-12-29
246
+
247
+ ### ✨ New Features
248
+ - **PostHog Telemetry Configuration** - PostHog telemetry reporting now supports separate configuration for domestic (CN) and international (INTL) environments:
249
+ - Separate PostHog hosts and API keys for CN and INTL environments
250
+ - Compression disabled for domestic self-hosted instance, enabled for international official PostHog
251
+ - Localhost domain filtering to avoid test data pollution
252
+
253
+ ## [1.0.0-beta.41] - 2025-12-29
254
+
255
+ ### 🔄 Breaking Changes
256
+ - **Background Image Support Removed** - Removed background image functionality from `AvatarView`:
257
+ - Removed `isOpaque` getter/setter property
258
+ - Removed `setBackgroundImage()` method
259
+ - Removed background image loading from `AvatarDownloader`
260
+ - Canvas now always uses transparent background
261
+
262
+ ## [1.0.0-beta.40] - 2025-12-27
263
+
264
+ ### 🔧 API Improvements
265
+ - Extended post-processing parameter configuration interface
266
+
267
+ ## [1.0.0-beta.39] - 2025-12-27
268
+
269
+ ### 🔧 Improvements
270
+ - Filter localhost domain from telemetry reporting to avoid test data pollution
271
+
272
+ ## [1.0.0-beta.38] - 2025-12-27
273
+
274
+ ### 🔄 Breaking Changes
275
+ - Migrated telemetry reporting from Tencent Cloud CLS to PostHog
276
+
277
+ ### ✨ New Features
278
+ - Implemented download queue for character resource loading
279
+
280
+ ## [1.0.0-beta.37] - 2025-12-24
281
+
282
+ ### 🐛 Bugfix
283
+ - Various bug fixes and improvements
284
+
285
+ ## [1.0.0-beta.36] - 2025-12-20
286
+
287
+ ### ✨ New Features
288
+ - **Audio Sample Rate Configuration** - Added configurable audio sample rate support in SDK initialization
289
+ - Added `audioFormat` configuration option with `channelCount` (fixed to 1) and `sampleRate` (supports: 8000, 16000, 22050, 24000, 32000, 44100, 48000 Hz, default: 16000)
290
+ - Audio recording and playback now automatically use the configured sample rate
291
+ - Vanilla demo updated with sample rate dropdown selector for easy testing
292
+
293
+ ## [1.0.0-beta.35] - 2025-12-16
294
+
295
+ ### 🔄 API Changes
296
+ - **Avatar Transform API** - Changed `setTransform` method to `transform` getter/setter property for more idiomatic JavaScript API. Now supports both reading and setting transform values.
297
+
298
+ ## [1.0.0-beta.34] - 2025-12-16
299
+
300
+ ### ✨ New Features
301
+ - **Avatar Transform API** - Added `setTransform` method to `AvatarView` for controlling avatar position and scale within the canvas. Supports normalized coordinates (-1 to 1) for position and scale factor.
302
+
303
+ ## [1.0.0-beta.32] - 2025-12-16
304
+
305
+ ### 🔄 Breaking Changes
306
+ - **Host Mode Interface** - Updated `yieldFramesData` method to accept binary data array instead of single binary data. The method now processes multiple protobuf-encoded Message objects in a single call.
307
+
308
+ ## [1.0.0-beta.31] - 2025-12-16
309
+
310
+ ### 🐛 Bugfix
311
+ - **Environment CORS Issue** - Fixed CORS issues when requesting configuration and avatar data APIs. SDK now provides default configuration fallback when config requests fail, ensuring smooth operation across different environments.
312
+
313
+ ## [1.0.0-beta.30] - 2025-12-15
314
+
315
+ ### 🐛 Bugfix
316
+ - **Template Resources Duplicate Download** - Fixed issue where template resources were being re-downloaded for each new avatar load. Template resources are now only loaded once during SDK initialization and reused for all avatars.
317
+
318
+ ## [1.0.0-beta.29] - 2025-12-15
319
+
320
+ ### 🔄 Breaking Changes
321
+ - **Environment Enum** - Removed `Environment.test`. Only `Environment.cn` and `Environment.intl` are now supported. Environment configuration must be explicitly provided.
322
+ - **Log Level Default** - Default log level changed from `LogLevel.all` to `LogLevel.off`. Set `logLevel: LogLevel.all` in configuration to enable all logs.
323
+
324
+ ### ✨ New Features
325
+ - **Avatar Caching** - Added avatar caching methods in `AvatarManager`:
326
+ - `retrieve(id: string): Avatar | undefined` - Get cached avatar by ID
327
+ - `clear(id: string): void` - Clear cached avatar for specific ID
328
+ - `clearAll(): void` - Clear all cached avatars
329
+ - `clearCache()` is now deprecated, use `clearAll()` instead
330
+ - **Background Image Support** - Added background image control in `AvatarView`:
331
+ - `isOpaque: boolean` - Getter/setter to control canvas background transparency
332
+ - `setBackgroundImage(image: HTMLImageElement | string | null): void` - Set or remove background image
333
+
334
+ ### 🔧 Improvements
335
+ - **Avatar Version Checking** - Avatar cache now automatically checks version and reloads if cached avatar version differs from latest metadata
336
+ - **Concurrent Loading** - Multiple concurrent `load()` calls for the same avatar ID now reuse the same loading promise
337
+
338
+ ## [1.0.0-beta.28] - 2025-12-08
339
+
340
+ ### 🔄 Breaking Changes
341
+ - **Class Renamed** - `AvatarKit` class has been renamed to `AvatarSDK` for better consistency
342
+ - Update all imports: `import { AvatarKit } from '@spatialwalk/avatarkit'` → `import { AvatarSDK } from '@spatialwalk/avatarkit'`
343
+ - Update all API calls: `AvatarKit.initialize()` → `AvatarSDK.initialize()`
344
+ - All static methods and properties remain the same, only the class name has changed
345
+
346
+ ### 🔧 Improvements
347
+ - **Rendering Optimizations** - Added fragment shader discard optimization to improve performance and edge quality
348
+ - **Shader Alignment** - Removed view matrix transpose to align with Android SDK implementation
349
+ - **Resource Cleanup** - Removed unused `frameMono` and `audioMono` resources from SDK and tests
350
+
351
+ ## [1.0.0-beta.27] - 2025-12-04
352
+
353
+ ### 🐛 Bugfix
354
+
355
+ ## [1.0.0-beta.26] - 2025-12-03
356
+
357
+ ### ✨ New Features
358
+ - **Log Level Configuration** - Added `logLevel` configuration option to control SDK logging verbosity
359
+ - `LogLevel.off` - Disable all logs
360
+ - `LogLevel.error` - Only error logs
361
+ - `LogLevel.warning` - Warning and error logs
362
+ - `LogLevel.all` - All logs (default)
363
+ - **Standardized CLS Logging Events** - All CLS logging events now use standardized field names for better querying
364
+ - Standard events: `sdk_initialized`, `send_audio_failed`, `message_error`, `heartbeat_failed`, `service_restarted`, `session_token_invalid`, `session_token_expired`, `yield_animation_failed`, `fetch_avatar_metadata_failed`, `download_avatar_assets_failed`, `avatar_active`
365
+ - Standard fields: `req_id`, `con_id`, `avatar_id`, `description`
366
+ - **End-to-End Latency Tracking** - Added `driving_service_latency` event to track latency metrics for both SDK and Host modes
367
+ - Tracks: `tap_0`, `tap_1`, `tap_2`, `tap_f` timestamps (Number type, milliseconds)
368
+ - Automatically reported once per conversation when first frame is received
369
+
370
+ ### 🔧 Improvements
371
+ - **CLS Configuration Alignment** - Updated CLS endpoints and Topic IDs to match iOS SDK configuration
372
+ - **Default API Endpoints** - Fixed default API endpoint for `intl` environment to `api.intl.spatialwalk.cloud`
373
+ - **Error Code Enum** - Added new error codes: `appIDUnrecognized`, `sessionTokenInvalid`, `sessionTokenExpired`, `failedToFetchAvatarMetadata`, `failedToDownloadAvatarAssets`
374
+
375
+ ### 🗑️ Removed
376
+ - **Redundant Log Events** - Removed unnecessary log events: `playback_paused`, `playback_resumed`, `reconnecting`, `connect_success`, `server_error`, `decode_failed`
377
+
378
+ ## [1.0.0-beta.25] - 2025-12-03
379
+
380
+ ### 🔧 Improvements
381
+ - **Removed Audio Buffer Limit** - Removed the 100 chunk limit on pending audio buffers to allow unlimited audio data buffering
382
+
383
+ ## [1.0.0-beta.24] - 2025-11-26
384
+
385
+ ### 🔧 API Changes
386
+ - **Backend Endpoints Updated** - Backend API endpoints have been updated for all environments
387
+
388
+ ## [1.0.0-beta.23] - 2025-11-26
389
+
390
+ ### 🔧 API Changes
391
+ - **Breaking Change** - `playback()` method is no longer supported and has been removed from public API
392
+
393
+ ## [1.0.0-beta.22] - 2025-11-26
394
+
395
+ ### 🔧 API Changes
396
+ - **State Callback Renamed** - `onAvatarState` has been renamed to `onConversationState` for better clarity
397
+ - The callback now uses `ConversationState` enum with states: `idle` and `playing`
398
+ - **Environment Enum Updated** - `Environment.us` has been renamed to `Environment.intl` for better internationalization support
399
+ - All references to `Environment.us` should be updated to `Environment.intl`
400
+ - Remote config endpoints now use `intl` instead of `us`
401
+
402
+ ### ✨ New Features
403
+ - **Volume Control** - Added volume control API for audio playback
404
+ - `setVolume(volume: number)` - Set audio volume (0.0 to 1.0)
405
+ - `getVolume(): number` - Get current audio volume
406
+ - Volume control only affects the avatar's audio player, not system volume
407
+ - Volume changes take effect immediately, including for currently playing audio
408
+
409
+ ## [1.0.0-beta.21] - 2025-11-25
410
+
411
+ ### ✨ New Features
412
+ - **SDK Mode Connection Timeout Fallback** - Enhanced fallback mechanism for SDK mode:
413
+ - If WebSocket connection fails to establish within 15 seconds, the SDK automatically enters fallback mode
414
+ - In fallback mode, audio data can still be sent and will play normally, even though no animation data will be received
415
+ - Connection failures also trigger this fallback mechanism
416
+ - `ConnectionState.connecting` and `ConnectionState.failed` events are emitted to notify external applications
417
+ - Concurrent connection attempts are prevented to avoid race conditions
418
+
419
+ ### 🔧 Improvements
420
+ - Improved connection state management: `isConnected` now accurately reflects actual connection status (false in fallback mode)
421
+ - Added `canSend()` method in `NetworkLayer` to check if audio can be sent (including fallback mode)
422
+ - Better separation of concerns: connection state checks are now handled by `NetworkLayer`, while playback logic remains in `AvatarController`
423
+
424
+ ## [1.0.0-beta.20] - 2025-11-25
425
+
426
+ ### 🔧 Improvements
427
+ - Removed 1-second audio buffer requirement for auto-starting playback in Host mode
428
+
429
+ ## [1.0.0-beta.19] - 2025-11-25
430
+
431
+ ### 📚 Documentation
432
+ - **Fixed misleading documentation** - Corrected Host mode API documentation to accurately reflect that `yieldAudioData()` can be called directly to start a new session without requiring `playback()` first
433
+ - Removed misleading "after playback() is called" comments
434
+ - Clarified two ways to start a session: using `playback()` for existing data, or `yieldAudioData()` directly for streaming
435
+ - Updated all examples and workflow descriptions to reflect correct API usage
436
+
437
+ ## [1.0.0-beta.18] - 2025-11-25
438
+
439
+ ### 🔧 API Changes
440
+ - **Renamed `reqId` to `conversationId`** - Updated terminology for better clarity
441
+ - All methods and parameters that used `reqId` now use `conversationId`
442
+ - `getCurrentReqId()` → `getCurrentConversationId()`
443
+ - `generateReqId()` → `generateConversationId()`
444
+ - Updated all event logs and documentation to use `conversationId`
445
+ - Note: Protobuf protocol still uses `reqId` field name internally, but SDK API uses `conversationId`
446
+
447
+ ### 📚 Documentation
448
+ - Enhanced Host mode documentation to clearly emphasize the workflow: send audio data first to get conversationId, then use that conversationId to send animation data
449
+ - Updated Host Mode Example and Host Mode Flow sections with clearer step-by-step instructions
450
+
451
+ ## [1.0.0-beta.17] - 2025-11-24
452
+
453
+ ### ✨ New Features
454
+ - **Audio-Only Fallback Mechanism** - SDK now includes automatic fallback to audio-only playback when animation data is unavailable
455
+ - SDK mode: Automatically enters audio-only mode when server returns an error
456
+ - Host mode: Automatically enters audio-only mode when empty animation data is provided
457
+ - Once in audio-only mode, subsequent animation data for that session is ignored
458
+ - Fallback mode is interruptible, just like normal playback mode
459
+
460
+ ### 🔧 API Changes
461
+ - **Playback Mode Configuration** - Moved playback mode configuration from `AvatarView` constructor to `AvatarSDK.initialize()`
462
+ - Playback mode is now determined by `drivingServiceMode` in `AvatarSDK.initialize()` configuration
463
+ - `AvatarView` constructor now only requires `avatar` and `container` parameters
464
+ - Removed `AvatarViewOptions` interface
465
+ - `container` parameter is now required (no longer optional)
466
+ - **Method Renames** - Renamed methods in `AvatarController` for Host mode to better reflect their purpose
467
+ - `play()` → `playback()`: Renamed to better reflect that the method is used for playback of existing data (replay mode)
468
+ - Old API: `avatarController.play(initialAudioChunks, initialKeyframes)`
469
+ - New API: `avatarController.playback(initialAudioChunks, initialKeyframes)`
470
+ - `sendAudioChunk()` → `yieldAudioData()`: Renamed to better reflect that the method yields/streams audio data
471
+ - Old API: `avatarController.sendAudioChunk(data, isLast)`
472
+ - New API: `avatarController.yieldAudioData(data, isLast)`
473
+ - `sendKeyframes()` → `yieldFramesData()`: Renamed to better reflect that the method yields/streams animation keyframes
474
+ - Old API: `avatarController.sendKeyframes(keyframes, reqId)`
475
+ - New API: `avatarController.yieldFramesData(keyframes, conversationId)`
476
+
477
+ ### 🔧 Improvements
478
+ - Extended transition animation duration from 200ms to 400ms for smoother end-of-playback transitions
479
+
480
+ ### 📚 Documentation
481
+ - Updated README.md to use "SDK mode" and "Host mode" terminology instead of "Network mode" and "External data mode"
482
+ - Added fallback mechanism documentation
483
+ - Updated API reference to reflect new constructor signature
484
+
485
+ ## [1.0.0-beta.16] - 2025-11-21
486
+
487
+ ### ✨ New Features
488
+ - **Multi-AvatarView Support** - SDK now supports multiple `AvatarView` instances simultaneously
489
+ - Each `AvatarView` instance can manage its own avatar independently
490
+ - Multiple avatars can be displayed and controlled at the same time
491
+ - Each instance maintains its own rendering context, playback state, and network connection
492
+ - Removed the previous limitation of "only one AvatarView instance at a time"
493
+
494
+ ### 📚 Documentation
495
+ - Updated README.md to reflect multi-avatar support capabilities
496
+ - Added multi-avatar usage examples
497
+ - Removed outdated limitation notes about single AvatarView instance
498
+
499
+ ---
500
+
501
+ ## [1.0.0-beta.15] - 2025-11-20
502
+
503
+ ### ✨ New Features
504
+ - Added authentication support for API requests
505
+ - `appId` is now automatically included in HTTP headers (`X-App-Id`) and WebSocket URL query parameters
506
+ - `sessionToken` is now automatically included in HTTP headers (`Authorization: Bearer {token}`) and WebSocket URL query parameters
507
+ - All network requests (avatar loading, resource downloads, WebSocket connections) now include authentication credentials
508
+
509
+ ### 🔧 Improvements
510
+ - Fixed canvas resize handling for different aspect ratios
511
+ - Projection matrix is now correctly updated when canvas aspect ratio changes
512
+ - Rendering system properly handles portrait (9:16) and landscape (16:9) aspect ratios
513
+ - Canvas automatically adapts to container size changes via ResizeObserver
514
+
515
+ ### 🐛 Bug Fixes
516
+ - Fixed `RenderSystem.handleResize()` to update projection matrix when canvas size changes
517
+ - Previously only updated aspect ratio, now also updates projection matrix for correct rendering
518
+
519
+ ---
520
+
521
+ ## [1.0.0-beta.14] - 2025-11-18
522
+
523
+ ### ✨ New Features
524
+ - Added pause and resume functionality for avatar playback
525
+ - New `pause()` method to pause audio and animation playback
526
+ - New `resume()` method to resume playback from paused state
527
+ - Added `paused` state to `AvatarState` enum
528
+ - State changes are communicated via `onAvatarState` callback
529
+ - Works in both network mode and external data mode
530
+
531
+ ### 🔧 Improvements
532
+ - Canvas now uses container's full dimensions instead of fixed 1:1 aspect ratio
533
+ - Canvas automatically adapts to container size (width and height)
534
+ - External developers can control canvas aspect ratio by setting container dimensions
535
+ - Rendering system correctly handles any aspect ratio without distortion
536
+
537
+ ---
538
+
539
+ ## [1.0.0-beta.13] - 2025-11-17
540
+
541
+ ### 🔒 API Improvements
542
+ - Reduced console noise by setting default log level to Warning
543
+ - Logger now only outputs warnings and errors by default
544
+ - Set `VITE_DEBUG_LOG=true` to enable all logs
545
+ - Simplified logger configuration using `setGlobalLogLevel(LogLevel.Warning)`
546
+
547
+ ### 🐛 Bug Fixes
548
+ - Fixed SDK config loader warning in non-debug mode
549
+ - Config loading failures are now silently handled in production
550
+ - Warnings only shown when `VITE_DEBUG_LOG=true`
551
+
552
+ ---
553
+
554
+ ## [1.0.0-beta.12] - 2025-11-17
555
+
556
+ ### 🔒 API Improvements
557
+ - Marked performance monitoring APIs as internal
558
+ - `RenderPerformanceStats` interface and `getPerformanceStats()` method are now marked with `@internal` tag
559
+ - These APIs are not exposed in the public TypeScript definitions
560
+ - Reverted performance monitoring implementation to simpler version (only `renderTime` and `sortTime`)
561
+
562
+ ---
563
+
564
+ ## [1.0.0-beta.11] - 2025-11-17
565
+
566
+ ### 📚 Documentation
567
+ - Updated demo repository link in README.md
568
+ - Changed example project link from `Avatarkit-web-demo` to `AvatarSDK-Web-Demo` to match the new repository name
569
+
570
+ ---
571
+
572
+ ## [1.0.0-beta.10] - 2025-11-16
573
+
574
+ ### 🔒 API Improvements
575
+ - Cleaned up public API to hide internal implementation details
576
+ - Marked internal methods with `@internal` JSDoc tag to exclude them from TypeScript declarations
577
+ - Removed unused environment configuration options (`realtimeApiBaseUrl`, `realtimeWsUrl`)
578
+ - Added `appId` getter to `AvatarSDK` for accessing initialized app ID
579
+ - Internal methods like `getEnvironmentConfig`, `logEvent`, `getCanvas`, `getCameraConfig`, `updateCameraConfig` are now properly hidden from public API
580
+
581
+ ### 🐛 Bug Fixes
582
+ - Fixed memory leaks when disposing AvatarView instances
583
+ - Improved resource cleanup to prevent memory leaks when switching or disposing avatar instances
584
+ - Properly clears all callbacks, event listeners, and large data buffers on disposal
585
+
586
+ ---
587
+ ## [1.0.0-beta.9] - 2025-11-15
588
+
589
+ ### 🐛 Bug Fixes
590
+ - Fixed memory leaks when disposing AvatarView instances
591
+ - Improved resource cleanup to prevent memory leaks when switching or disposing avatar instances
592
+ - Properly clears all callbacks, event listeners, and large data buffers on disposal
593
+
594
+ ---
595
+
596
+ ## [1.0.0-beta.8] - 2025-11-14
597
+
598
+ ### 🐛 Bug Fixes
599
+ - Fixed audio-animation synchronization issue after normal playback completion
600
+ - Playback state is now properly cleaned up when audio finishes normally, preventing synchronization issues in subsequent conversations
601
+
602
+ ---
603
+
8
604
  ## [1.0.0-beta.7] - 2025-11-14
9
605
 
10
606
  ### 🔄 Refactoring
11
- - Refactored rendering state management using state machine pattern
12
- - Replaced multiple boolean flags (`isRealtimePlaying`, `isTransitioning`, `endToIdleAfterTransition`) with a single `RenderingState` enum
13
- - Unified state transitions through `setState()` method
14
- - Simplified state checks and reduced code complexity
15
- - Improved maintainability and clarity of state transitions
607
+ - Improved rendering state management for better stability and maintainability
16
608
 
17
609
  ### 🐛 Bug Fixes
18
610
  - Fixed interrupt not generating transition animation when interrupting during playback
19
- - Fixed transition animation being regenerated and reset when `sendKeyframes()` is called after `play()` in external data mode
611
+ - Fixed transition animation being regenerated and reset in external data mode when sending keyframes after playback starts
20
612
 
21
613
  ---
22
614
 
23
615
  ## [1.0.0-beta.6] - 2025-11-14
24
616
 
25
617
  ### 🐛 Bug Fixes
26
- - Fixed transition animation being regenerated and reset when `sendKeyframes()` is called after `play()` in external data mode, causing the transition to play twice
618
+ - Fixed transition animation being regenerated and reset in external data mode when sending keyframes after playback starts, causing the transition to play twice
27
619
 
28
620
  ---
29
621
 
30
622
  ## [1.0.0-beta.5] - 2025-11-14
31
623
 
32
624
  ### 🐛 Bug Fixes
33
- - Fixed missing `AvatarPlaybackMode` enum export in published package
625
+ - Fixed missing `DrivingServiceMode` enum export in published package
34
626
 
35
627
  ---
36
628
 
@@ -59,7 +651,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
59
651
  - **External Data Mode**:
60
652
  - External components fully control audio and animation data acquisition
61
653
  - SDK only responsible for synchronized playback of externally provided data
62
- - Use `controller.play()`, `controller.sendAudioChunk()` and `controller.sendKeyframes()` methods
654
+ - Use `controller.playback()`, `controller.yieldAudioData()` and `controller.yieldFramesData()` methods
63
655
 
64
656
  ### ✨ New Features
65
657
 
@@ -95,7 +687,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
95
687
  // New API
96
688
  new AvatarView(avatar, {
97
689
  container: container,
98
- playbackMode: AvatarPlaybackMode.network // or AvatarPlaybackMode.external
690
+ playbackMode: DrivingServiceMode.sdk // or DrivingServiceMode.host
99
691
  })
100
692
  ```
101
693