@spatialwalk/avatarkit 1.0.0-beta.1 → 1.0.0-beta.10

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 (67) hide show
  1. package/CHANGELOG.md +177 -0
  2. package/README.md +450 -148
  3. package/dist/{StreamingAudioPlayer-C2TfYsO8.js → StreamingAudioPlayer-Bq2-bQiT.js} +88 -62
  4. package/dist/StreamingAudioPlayer-Bq2-bQiT.js.map +1 -0
  5. package/dist/animation/AnimationWebSocketClient.d.ts.map +1 -1
  6. package/dist/animation/utils/flameConverter.d.ts.map +1 -1
  7. package/dist/audio/AnimationPlayer.d.ts +4 -0
  8. package/dist/audio/AnimationPlayer.d.ts.map +1 -1
  9. package/dist/audio/StreamingAudioPlayer.d.ts +10 -0
  10. package/dist/audio/StreamingAudioPlayer.d.ts.map +1 -1
  11. package/dist/avatar_core_wasm-D4eEi7Eh.js +1666 -0
  12. package/dist/{avatar_core_wasm-DmkU6dYn.js.map → avatar_core_wasm-D4eEi7Eh.js.map} +1 -1
  13. package/dist/avatar_core_wasm.wasm +0 -0
  14. package/dist/config/app-config.d.ts +3 -7
  15. package/dist/config/app-config.d.ts.map +1 -1
  16. package/dist/config/constants.d.ts +19 -3
  17. package/dist/config/constants.d.ts.map +1 -1
  18. package/dist/core/Avatar.d.ts +0 -8
  19. package/dist/core/Avatar.d.ts.map +1 -1
  20. package/dist/core/AvatarController.d.ts +50 -74
  21. package/dist/core/AvatarController.d.ts.map +1 -1
  22. package/dist/core/AvatarDownloader.d.ts +0 -5
  23. package/dist/core/AvatarDownloader.d.ts.map +1 -1
  24. package/dist/core/AvatarKit.d.ts +3 -15
  25. package/dist/core/AvatarKit.d.ts.map +1 -1
  26. package/dist/core/AvatarManager.d.ts.map +1 -1
  27. package/dist/core/AvatarView.d.ts +47 -46
  28. package/dist/core/AvatarView.d.ts.map +1 -1
  29. package/dist/core/NetworkLayer.d.ts +59 -0
  30. package/dist/core/NetworkLayer.d.ts.map +1 -0
  31. package/dist/index-bQnEVIkT.js +5999 -0
  32. package/dist/index-bQnEVIkT.js.map +1 -0
  33. package/dist/index.d.ts +0 -1
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +11 -11
  36. package/dist/renderer/RenderSystem.d.ts +4 -2
  37. package/dist/renderer/RenderSystem.d.ts.map +1 -1
  38. package/dist/renderer/webgl/webglRenderer.d.ts.map +1 -1
  39. package/dist/types/index.d.ts +18 -0
  40. package/dist/types/index.d.ts.map +1 -1
  41. package/dist/utils/cls-tracker.d.ts +17 -0
  42. package/dist/utils/cls-tracker.d.ts.map +1 -0
  43. package/dist/utils/logger.d.ts +1 -1
  44. package/dist/utils/logger.d.ts.map +1 -1
  45. package/package.json +8 -11
  46. package/dist/StreamingAudioPlayer-C2TfYsO8.js.map +0 -1
  47. package/dist/avatar_core_wasm-DmkU6dYn.js +0 -1666
  48. package/dist/config/region-config.d.ts +0 -17
  49. package/dist/config/region-config.d.ts.map +0 -1
  50. package/dist/generated/google/protobuf/any.d.ts +0 -145
  51. package/dist/generated/google/protobuf/any.d.ts.map +0 -1
  52. package/dist/generated/jsonapi/v1/base.d.ts +0 -140
  53. package/dist/generated/jsonapi/v1/base.d.ts.map +0 -1
  54. package/dist/generated/platform/v1/asset_groups.d.ts +0 -225
  55. package/dist/generated/platform/v1/asset_groups.d.ts.map +0 -1
  56. package/dist/generated/platform/v1/assets.d.ts +0 -149
  57. package/dist/generated/platform/v1/assets.d.ts.map +0 -1
  58. package/dist/generated/platform/v1/character.d.ts +0 -395
  59. package/dist/generated/platform/v1/character.d.ts.map +0 -1
  60. package/dist/generated/platform/v1/redeem.d.ts +0 -22
  61. package/dist/generated/platform/v1/redeem.d.ts.map +0 -1
  62. package/dist/index-DwhR9l52.js +0 -9712
  63. package/dist/index-DwhR9l52.js.map +0 -1
  64. package/dist/utils/posthog-tracker.d.ts +0 -82
  65. package/dist/utils/posthog-tracker.d.ts.map +0 -1
  66. package/dist/utils/toast.d.ts +0 -74
  67. package/dist/utils/toast.d.ts.map +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,177 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0-beta.10] - 2025-11-16
9
+
10
+ ### 🔒 API Improvements
11
+ - Cleaned up public API to hide internal implementation details
12
+ - Marked internal methods with `@internal` JSDoc tag to exclude them from TypeScript declarations
13
+ - Removed unused environment configuration options (`realtimeApiBaseUrl`, `realtimeWsUrl`)
14
+ - Added `appId` getter to `AvatarKit` for accessing initialized app ID
15
+ - Internal methods like `getEnvironmentConfig`, `logEvent`, `getCanvas`, `getCameraConfig`, `updateCameraConfig` are now properly hidden from public API
16
+
17
+ ### 🐛 Bug Fixes
18
+ - Fixed memory leaks when disposing AvatarView instances
19
+ - Improved resource cleanup to prevent memory leaks when switching or disposing avatar instances
20
+ - Properly clears all callbacks, event listeners, and large data buffers on disposal
21
+
22
+ ---
23
+ ## [1.0.0-beta.9] - 2025-11-15
24
+
25
+ ### 🐛 Bug Fixes
26
+ - Fixed memory leaks when disposing AvatarView instances
27
+ - Improved resource cleanup to prevent memory leaks when switching or disposing avatar instances
28
+ - Properly clears all callbacks, event listeners, and large data buffers on disposal
29
+
30
+ ---
31
+
32
+ ## [1.0.0-beta.8] - 2025-11-14
33
+
34
+ ### 🐛 Bug Fixes
35
+ - Fixed audio-animation synchronization issue after normal playback completion
36
+ - Playback state is now properly cleaned up when audio finishes normally, preventing synchronization issues in subsequent conversations
37
+
38
+ ---
39
+
40
+ ## [1.0.0-beta.7] - 2025-11-14
41
+
42
+ ### 🔄 Refactoring
43
+ - Improved rendering state management for better stability and maintainability
44
+
45
+ ### 🐛 Bug Fixes
46
+ - Fixed interrupt not generating transition animation when interrupting during playback
47
+ - Fixed transition animation being regenerated and reset in external data mode when sending keyframes after playback starts
48
+
49
+ ---
50
+
51
+ ## [1.0.0-beta.6] - 2025-11-14
52
+
53
+ ### 🐛 Bug Fixes
54
+ - Fixed transition animation being regenerated and reset in external data mode when sending keyframes after playback starts, causing the transition to play twice
55
+
56
+ ---
57
+
58
+ ## [1.0.0-beta.5] - 2025-11-14
59
+
60
+ ### 🐛 Bug Fixes
61
+ - Fixed missing `AvatarPlaybackMode` enum export in published package
62
+
63
+ ---
64
+
65
+ ## [1.0.0-beta.4] - 2025-11-14
66
+
67
+ ### 🔄 Updates
68
+ - Updated WASM module (avatar_core_wasm.wasm)
69
+
70
+ ---
71
+
72
+ ## [1.0.0-beta.3] - 2025-11-13
73
+
74
+ ### 🎉 Major Changes
75
+
76
+ #### Architecture Refactoring - Three-Layer Architecture
77
+ - **Rendering Layer (AvatarView)**: Pure rendering responsibility, receives rendering instructions from the playback layer
78
+ - **Playback Layer (AvatarController)**: Unified data controller responsible for audio playback and animation rendering synchronization
79
+ - **Network Layer (NetworkLayer)**: Optional network communication layer, automatically composed only in network mode
80
+
81
+ #### Dual Playback Mode Support
82
+ - **Network Mode**:
83
+ - Send audio data to server via WebSocket
84
+ - Automatically receive and play animation data returned from server
85
+ - Use `controller.start()` and `controller.send()` methods
86
+
87
+ - **External Data Mode**:
88
+ - External components fully control audio and animation data acquisition
89
+ - SDK only responsible for synchronized playback of externally provided data
90
+ - Use `controller.play()`, `controller.sendAudioChunk()` and `controller.sendKeyframes()` methods
91
+
92
+ ### ✨ New Features
93
+
94
+ - **Transition Animation Optimization**:
95
+ - Transition animation duration adjusted to 200ms
96
+ - Improved audio-animation synchronization logic, ensuring audio and animation start playing together after transition animation ends
97
+ - Optimized transition frame generation and alignment logic
98
+
99
+ - **Camera Configuration Enhancement**:
100
+ - Default transparent background, background rendering functionality removed
101
+ - Camera configuration aligned with iOS (Reversed-Z projection, near=0.01, far=100)
102
+ - Support dynamic camera configuration loading from characterSettings and camera.json
103
+
104
+ - **Audio Sample Rate Configuration**:
105
+ - Updated default audio sample rate to 16kHz (previously 24kHz) to match backend requirements
106
+ - Audio format requirement: 16kHz mono PCM16
107
+
108
+ - **Telemetry Migration**:
109
+ - Migrated from PostHog to Tencent Cloud CLS (Cloud Log Service)
110
+ - Support environment-based dynamic configuration (cn/test/us)
111
+ - Support both Token and SecretId/SecretKey authentication methods
112
+ - Aligned with iOS SDK configuration
113
+
114
+ ### 🔧 API Changes
115
+
116
+ #### Breaking Changes
117
+
118
+ - **AvatarView Constructor**:
119
+ ```typescript
120
+ // Old API
121
+ new AvatarView(avatar, container)
122
+
123
+ // New API
124
+ new AvatarView(avatar, {
125
+ container: container,
126
+ playbackMode: AvatarPlaybackMode.network // or AvatarPlaybackMode.external
127
+ })
128
+ ```
129
+
130
+ - **AvatarController Methods**:
131
+ - Network Mode: `start()` / `close()` / `send()`
132
+ - External Data Mode: `play()` / `sendAudioChunk()` / `sendKeyframes()`
133
+ - Common Methods: `interrupt()` / `clear()` / `dispose()`
134
+
135
+ - **Removed Properties**:
136
+ - `realtimeStartTime` property removed (no longer needed)
137
+
138
+ ### 🐛 Bug Fixes
139
+
140
+ - Fixed audio-animation desynchronization during transition animation
141
+ - Fixed animation freezing issue in external data mode
142
+ - Fixed audio playback speed abnormality caused by sample rate mismatch
143
+ - Fixed camera configuration priority logic
144
+ - Fixed WebSocket connection state callback timing issues
145
+
146
+ ### 📚 Documentation
147
+
148
+ - Updated README.md with detailed explanation of three-layer architecture and two playback modes
149
+ - Added audio format requirements documentation (16kHz mono PCM16)
150
+ - Updated API reference documentation and code examples
151
+ - Added architecture diagrams and flowcharts
152
+
153
+ ### 🧪 Testing
154
+
155
+ - Updated unit tests to cover new architecture
156
+ - Added unit tests for external data mode
157
+ - Updated E2E tests to use new API
158
+ - All tests passing (69 unit tests + 24 E2E tests)
159
+
160
+ ### 🔄 Internal Changes
161
+
162
+ - Refactored `AvatarController` into unified playback layer
163
+ - Extracted `NetworkLayer` as independent component
164
+ - Optimized animation playback loop and audio-animation synchronization logic
165
+ - Updated WASM module (avatar_core_wasm.wasm)
166
+ - Improved error handling and logging
167
+
168
+ ### 📦 Dependencies
169
+
170
+ - No new dependencies added
171
+ - Maintained existing dependency versions
172
+
173
+ ---
174
+
175
+ ## [1.0.0-beta.2] - Previous Version
176
+
177
+ (Previous version changelog entries...)