@spatialwalk/avatarkit 1.0.0-beta.52 → 1.0.0-beta.54
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
|
@@ -5,6 +5,16 @@ 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.54] - 2025-01-05
|
|
9
|
+
|
|
10
|
+
### 🐛 Bugfix
|
|
11
|
+
- **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.
|
|
12
|
+
|
|
13
|
+
## [1.0.0-beta.53] - 2025-01-05
|
|
14
|
+
|
|
15
|
+
### 🐛 Bugfix
|
|
16
|
+
- **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.
|
|
17
|
+
|
|
8
18
|
## [1.0.0-beta.52] - 2025-01-05
|
|
9
19
|
|
|
10
20
|
### 🔧 Performance Improvements
|
|
@@ -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, e as errorToMessage, l as logEvent, a as logger } from "./index-
|
|
4
|
+
import { A as APP_CONFIG, e as errorToMessage, l as logEvent, a as logger } from "./index-PRpmBehE.js";
|
|
5
5
|
class StreamingAudioPlayer {
|
|
6
6
|
constructor(options) {
|
|
7
7
|
__publicField(this, "audioContext", null);
|
|
@@ -7579,7 +7579,7 @@ const _AnimationPlayer = class _AnimationPlayer {
|
|
|
7579
7579
|
if (this.streamingPlayer) {
|
|
7580
7580
|
return;
|
|
7581
7581
|
}
|
|
7582
|
-
const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-
|
|
7582
|
+
const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-Vmeiag0s.js");
|
|
7583
7583
|
const { AvatarSDK: AvatarSDK2 } = await Promise.resolve().then(() => AvatarSDK$1);
|
|
7584
7584
|
const audioFormat = AvatarSDK2.getAudioFormat();
|
|
7585
7585
|
this.streamingPlayer = new StreamingAudioPlayer({
|
|
@@ -8969,7 +8969,7 @@ class AvatarSDK {
|
|
|
8969
8969
|
}
|
|
8970
8970
|
__publicField(AvatarSDK, "_isInitialized", false);
|
|
8971
8971
|
__publicField(AvatarSDK, "_configuration", null);
|
|
8972
|
-
__publicField(AvatarSDK, "_version", "1.0.0-beta.
|
|
8972
|
+
__publicField(AvatarSDK, "_version", "1.0.0-beta.54");
|
|
8973
8973
|
__publicField(AvatarSDK, "_avatarCore", null);
|
|
8974
8974
|
__publicField(AvatarSDK, "_dynamicSdkConfig", null);
|
|
8975
8975
|
const AvatarSDK$1 = Object.freeze(Object.defineProperty({
|
|
@@ -10619,6 +10619,7 @@ class AvatarController {
|
|
|
10619
10619
|
__publicField(this, "currentKeyframes", []);
|
|
10620
10620
|
__publicField(this, "pendingAudioChunks", []);
|
|
10621
10621
|
__publicField(this, "isPlaying", false);
|
|
10622
|
+
__publicField(this, "isStartingPlayback", false);
|
|
10622
10623
|
__publicField(this, "isConnected", false);
|
|
10623
10624
|
__publicField(this, "currentState", AvatarState.idle);
|
|
10624
10625
|
__publicField(this, "currentConversationId", null);
|
|
@@ -10960,9 +10961,10 @@ class AvatarController {
|
|
|
10960
10961
|
this.currentKeyframes.push(...keyframes);
|
|
10961
10962
|
}
|
|
10962
10963
|
this.emit("keyframesUpdate", this.currentKeyframes);
|
|
10963
|
-
if (!this.isPlaying && this.pendingAudioChunks.length > 0 && this.currentKeyframes.length > 0) {
|
|
10964
|
+
if (!this.isPlaying && !this.isStartingPlayback && this.pendingAudioChunks.length > 0 && this.currentKeyframes.length > 0) {
|
|
10964
10965
|
this.startStreamingPlayback().catch((error) => {
|
|
10965
10966
|
var _a;
|
|
10967
|
+
this.isStartingPlayback = false;
|
|
10966
10968
|
logger.error("[AvatarController] Failed to auto-start playback:", error);
|
|
10967
10969
|
(_a = this.onError) == null ? void 0 : _a.call(this, new SPAvatarError("Failed to start playback", "PLAYBACK_START_FAILED"));
|
|
10968
10970
|
});
|
|
@@ -11185,6 +11187,14 @@ class AvatarController {
|
|
|
11185
11187
|
}
|
|
11186
11188
|
async startStreamingPlaybackInternal() {
|
|
11187
11189
|
var _a, _b, _c;
|
|
11190
|
+
if (this.isPlaying) {
|
|
11191
|
+
this.isStartingPlayback = false;
|
|
11192
|
+
return;
|
|
11193
|
+
}
|
|
11194
|
+
if (this.isStartingPlayback) {
|
|
11195
|
+
return;
|
|
11196
|
+
}
|
|
11197
|
+
this.isStartingPlayback = true;
|
|
11188
11198
|
if (!this.animationPlayer) {
|
|
11189
11199
|
this.animationPlayer = new AnimationPlayer();
|
|
11190
11200
|
}
|
|
@@ -11192,6 +11202,7 @@ class AvatarController {
|
|
|
11192
11202
|
try {
|
|
11193
11203
|
await this.animationPlayer.createAndInitializeStreamingPlayer();
|
|
11194
11204
|
} catch (error) {
|
|
11205
|
+
this.isStartingPlayback = false;
|
|
11195
11206
|
const message = error instanceof Error ? error.message : String(error);
|
|
11196
11207
|
logger.error("[AvatarController] Failed to create streaming player:", message);
|
|
11197
11208
|
logEvent("character_player", "error", {
|
|
@@ -11203,6 +11214,7 @@ class AvatarController {
|
|
|
11203
11214
|
}
|
|
11204
11215
|
}
|
|
11205
11216
|
if (!this.currentKeyframes || this.currentKeyframes.length === 0) {
|
|
11217
|
+
this.isStartingPlayback = false;
|
|
11206
11218
|
logger.warn("[AvatarController] No animation data to play");
|
|
11207
11219
|
return;
|
|
11208
11220
|
}
|
|
@@ -11240,6 +11252,7 @@ class AvatarController {
|
|
|
11240
11252
|
this.currentState = AvatarState.playing;
|
|
11241
11253
|
(_a = this.onConversationState) == null ? void 0 : _a.call(this, this.mapToConversationState(AvatarState.playing));
|
|
11242
11254
|
this.startPlaybackLoop();
|
|
11255
|
+
this.isStartingPlayback = false;
|
|
11243
11256
|
logEvent("character_player", "info", {
|
|
11244
11257
|
avatar_id: this.avatar.id,
|
|
11245
11258
|
event: "playback_started",
|
|
@@ -11250,6 +11263,7 @@ class AvatarController {
|
|
|
11250
11263
|
logger.error("[AvatarController] Failed to start streaming playback:", message);
|
|
11251
11264
|
(_c = this.onError) == null ? void 0 : _c.call(this, new SPAvatarError("Failed to start streaming playback", "INIT_FAILED"));
|
|
11252
11265
|
this.isPlaying = false;
|
|
11266
|
+
this.isStartingPlayback = false;
|
|
11253
11267
|
}
|
|
11254
11268
|
}
|
|
11255
11269
|
checkPlaybackStuck(audioTime) {
|
|
@@ -11506,6 +11520,7 @@ class AvatarController {
|
|
|
11506
11520
|
stopPlayback() {
|
|
11507
11521
|
var _a;
|
|
11508
11522
|
this.stopPlaybackLoop();
|
|
11523
|
+
this.isStartingPlayback = false;
|
|
11509
11524
|
if (this.animationPlayer) {
|
|
11510
11525
|
this.animationPlayer.stop();
|
|
11511
11526
|
const streamingPlayer = this.animationPlayer.getStreamingPlayer();
|
|
@@ -14203,6 +14218,15 @@ class AvatarView {
|
|
|
14203
14218
|
lastTime = currentTime;
|
|
14204
14219
|
if (state === "transitioningToSpeaking" || state === "transitioningToIdle") {
|
|
14205
14220
|
if (this.transitionKeyframes.length === 0) {
|
|
14221
|
+
if (state === "transitioningToSpeaking") {
|
|
14222
|
+
this.setState("speaking");
|
|
14223
|
+
this.avatarController.onTransitionComplete();
|
|
14224
|
+
} else if (state === "transitioningToIdle") {
|
|
14225
|
+
this.setState("idle");
|
|
14226
|
+
this.stopRealtimeAnimationLoop();
|
|
14227
|
+
this.startIdleAnimationLoop();
|
|
14228
|
+
return;
|
|
14229
|
+
}
|
|
14206
14230
|
this.realtimeAnimationLoopId = requestAnimationFrame(renderFrame);
|
|
14207
14231
|
return;
|
|
14208
14232
|
}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED