@spatialwalk/avatarkit 1.0.0-beta.55 → 1.0.0-beta.57
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 +12 -0
- package/dist/{StreamingAudioPlayer-C6hiS_B5.js → StreamingAudioPlayer-Co3xec_k.js} +1 -1
- package/dist/core/AvatarController.d.ts +1 -1
- package/dist/core/AvatarView.d.ts +2 -0
- package/dist/docs/render-flame-api-example.d.ts +28 -0
- package/dist/{index-WcnOBRys.js → index-cfYSlUmQ.js} +46 -14
- package/dist/index.js +1 -1
- package/dist/types/index.d.ts +6 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,9 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.0.0-beta.57] - 2026-01-09
|
|
6
|
+
|
|
7
|
+
### 🐛 Bugfixes
|
|
8
|
+
- **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.
|
|
9
|
+
|
|
10
|
+
## [1.0.0-beta.56] - 2026-01-09
|
|
11
|
+
|
|
5
12
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
13
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
14
|
|
|
15
|
+
## [1.0.0-beta.56] - 2025-01-05
|
|
16
|
+
|
|
17
|
+
### ✨ New Features
|
|
18
|
+
- **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.
|
|
19
|
+
|
|
8
20
|
## [1.0.0-beta.55] - 2025-01-05
|
|
9
21
|
|
|
10
22
|
### ✨ New Features
|
|
@@ -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-cfYSlUmQ.js";
|
|
5
5
|
class StreamingAudioPlayer {
|
|
6
6
|
constructor(options) {
|
|
7
7
|
__publicField(this, "audioContext", null);
|
|
@@ -60,7 +60,7 @@ export declare class AvatarController {
|
|
|
60
60
|
private getEffectiveConversationId;
|
|
61
61
|
getPointCount(): number | null;
|
|
62
62
|
setPostProcessingConfig(config: PostProcessingConfig | null): void;
|
|
63
|
-
private
|
|
63
|
+
private setEyeTrackingConfig;
|
|
64
64
|
private rerenderCurrentFrame;
|
|
65
65
|
setVolume(volume: number): void;
|
|
66
66
|
getVolume(): number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Flame } from '../generated/driveningress/v1/driveningress';
|
|
1
2
|
import { Avatar } from './Avatar';
|
|
2
3
|
import { AvatarController } from './AvatarController';
|
|
3
4
|
export declare class AvatarView {
|
|
@@ -56,6 +57,7 @@ export declare class AvatarView {
|
|
|
56
57
|
private startRealtimeRendering;
|
|
57
58
|
private stopRealtimeRendering;
|
|
58
59
|
dispose(): void;
|
|
60
|
+
renderFlame(flame: Flame): Promise<void>;
|
|
59
61
|
private rerenderCurrentFrameWithNewCamera;
|
|
60
62
|
private handleResize;
|
|
61
63
|
get transform(): {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AvatarView, Flame } from '@spatialwalk/avatarkit';
|
|
2
|
+
declare function initializeSDK(): Promise<void>;
|
|
3
|
+
declare function createAvatarView(characterId: string, container: HTMLElement): Promise<AvatarView>;
|
|
4
|
+
declare function fetchFlameDataFromServer(characterId: string, audioData: ArrayBuffer): Promise<Flame[]>;
|
|
5
|
+
declare class FlameRenderer {
|
|
6
|
+
private avatarView;
|
|
7
|
+
private keyframes;
|
|
8
|
+
private currentFrameIndex;
|
|
9
|
+
private animationFrameId;
|
|
10
|
+
private isPlaying;
|
|
11
|
+
private fps;
|
|
12
|
+
private frameInterval;
|
|
13
|
+
private lastRenderTime;
|
|
14
|
+
constructor(avatarView: AvatarView);
|
|
15
|
+
setKeyframes(keyframes: Flame[]): void;
|
|
16
|
+
start(): void;
|
|
17
|
+
stop(): void;
|
|
18
|
+
renderFrame(frameIndex: number): Promise<void>;
|
|
19
|
+
private renderLoop;
|
|
20
|
+
setFPS(fps: number): void;
|
|
21
|
+
seek(frameIndex: number): void;
|
|
22
|
+
getCurrentFrameIndex(): number;
|
|
23
|
+
getTotalFrames(): number;
|
|
24
|
+
}
|
|
25
|
+
declare function main(): Promise<void>;
|
|
26
|
+
declare function fetchAudioData(): Promise<ArrayBuffer>;
|
|
27
|
+
|
|
28
|
+
export { initializeSDK, createAvatarView, fetchFlameDataFromServer, FlameRenderer, main, fetchAudioData };
|
|
@@ -7639,7 +7639,7 @@ const _AnimationPlayer = class _AnimationPlayer {
|
|
|
7639
7639
|
if (this.streamingPlayer) {
|
|
7640
7640
|
return;
|
|
7641
7641
|
}
|
|
7642
|
-
const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-
|
|
7642
|
+
const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-Co3xec_k.js");
|
|
7643
7643
|
const { AvatarSDK: AvatarSDK2 } = await Promise.resolve().then(() => AvatarSDK$1);
|
|
7644
7644
|
const audioFormat = AvatarSDK2.getAudioFormat();
|
|
7645
7645
|
this.streamingPlayer = new StreamingAudioPlayer({
|
|
@@ -9062,7 +9062,7 @@ class AvatarSDK {
|
|
|
9062
9062
|
}
|
|
9063
9063
|
__publicField(AvatarSDK, "_isInitialized", false);
|
|
9064
9064
|
__publicField(AvatarSDK, "_configuration", null);
|
|
9065
|
-
__publicField(AvatarSDK, "_version", "1.0.0-beta.
|
|
9065
|
+
__publicField(AvatarSDK, "_version", "1.0.0-beta.57");
|
|
9066
9066
|
__publicField(AvatarSDK, "_avatarCore", null);
|
|
9067
9067
|
__publicField(AvatarSDK, "_dynamicSdkConfig", null);
|
|
9068
9068
|
const AvatarSDK$1 = Object.freeze(Object.defineProperty({
|
|
@@ -11212,31 +11212,36 @@ class AvatarController {
|
|
|
11212
11212
|
}
|
|
11213
11213
|
setPostProcessingConfig(config) {
|
|
11214
11214
|
this.postProcessingConfig = config;
|
|
11215
|
-
if (
|
|
11216
|
-
this.
|
|
11217
|
-
logger.warn("[AvatarController] Failed to
|
|
11215
|
+
if (config == null ? void 0 : config.eyefocus) {
|
|
11216
|
+
this.setEyeTrackingConfig(config.eyefocus).catch((error) => {
|
|
11217
|
+
logger.warn("[AvatarController] Failed to set eye tracking config:", error instanceof Error ? error.message : String(error));
|
|
11218
11218
|
});
|
|
11219
11219
|
}
|
|
11220
11220
|
if (this.currentState === AvatarState.paused && this.isPlaying) {
|
|
11221
11221
|
this.rerenderCurrentFrame();
|
|
11222
11222
|
}
|
|
11223
11223
|
}
|
|
11224
|
-
async
|
|
11225
|
-
var _a;
|
|
11224
|
+
async setEyeTrackingConfig(eyefocus) {
|
|
11226
11225
|
const avatarCore = AvatarSDK.getAvatarCore();
|
|
11227
11226
|
if (!avatarCore || !this.characterId) {
|
|
11228
11227
|
return;
|
|
11229
11228
|
}
|
|
11230
11229
|
try {
|
|
11231
|
-
const characterMeta = this.avatar.getCharacterMeta();
|
|
11232
|
-
const eyefocus = (_a = characterMeta.characterSettings) == null ? void 0 : _a.eyefocus;
|
|
11233
11230
|
await avatarCore.setEyeTrackingConfig({
|
|
11234
|
-
enabled,
|
|
11235
|
-
auto_eyelid_adjustment:
|
|
11236
|
-
eyelid_threshold:
|
|
11231
|
+
enabled: eyefocus.enabled,
|
|
11232
|
+
auto_eyelid_adjustment: eyefocus.auto_eyelid_adjustment ?? true,
|
|
11233
|
+
eyelid_threshold: eyefocus.eyelid_threshold ?? 0.2
|
|
11237
11234
|
}, this.characterId);
|
|
11235
|
+
if (eyefocus.targets && eyefocus.targets.length >= 3) {
|
|
11236
|
+
await avatarCore.setGazeTarget(
|
|
11237
|
+
eyefocus.targets[0],
|
|
11238
|
+
eyefocus.targets[1],
|
|
11239
|
+
eyefocus.targets[2],
|
|
11240
|
+
this.characterId
|
|
11241
|
+
);
|
|
11242
|
+
}
|
|
11238
11243
|
} catch (error) {
|
|
11239
|
-
logger.warn("[AvatarController] Failed to
|
|
11244
|
+
logger.warn("[AvatarController] Failed to set eye tracking config:", error instanceof Error ? error.message : String(error));
|
|
11240
11245
|
}
|
|
11241
11246
|
}
|
|
11242
11247
|
async rerenderCurrentFrameIfPaused() {
|
|
@@ -14137,7 +14142,7 @@ class AvatarView {
|
|
|
14137
14142
|
auto_eyelid_adjustment: eyefocus.auto_eyelid_adjustment,
|
|
14138
14143
|
eyelid_threshold: eyefocus.eyelid_threshold
|
|
14139
14144
|
}, this.characterId);
|
|
14140
|
-
if (eyefocus.
|
|
14145
|
+
if (eyefocus.targets && eyefocus.targets.length >= 3) {
|
|
14141
14146
|
await avatarCore.setGazeTarget(
|
|
14142
14147
|
eyefocus.targets[0],
|
|
14143
14148
|
eyefocus.targets[1],
|
|
@@ -14495,6 +14500,9 @@ class AvatarView {
|
|
|
14495
14500
|
}
|
|
14496
14501
|
handleInterrupt() {
|
|
14497
14502
|
const state = this.renderingState;
|
|
14503
|
+
if (state === "idle") {
|
|
14504
|
+
return;
|
|
14505
|
+
}
|
|
14498
14506
|
if (state === "transitioningToIdle") {
|
|
14499
14507
|
return;
|
|
14500
14508
|
}
|
|
@@ -14675,6 +14683,30 @@ class AvatarView {
|
|
|
14675
14683
|
}
|
|
14676
14684
|
}
|
|
14677
14685
|
}
|
|
14686
|
+
async renderFlame(flame) {
|
|
14687
|
+
if (!this.isInitialized || !this.renderSystem) {
|
|
14688
|
+
throw new Error("AvatarView not initialized");
|
|
14689
|
+
}
|
|
14690
|
+
try {
|
|
14691
|
+
const processedFlame = this.avatarController.applyPostProcessingToFlame(flame);
|
|
14692
|
+
const wasmParams = convertProtoFlameToWasmParams(processedFlame);
|
|
14693
|
+
const avatarCore = AvatarSDK.getAvatarCore();
|
|
14694
|
+
if (!avatarCore) {
|
|
14695
|
+
throw new Error("AvatarCore not available");
|
|
14696
|
+
}
|
|
14697
|
+
const splatData = await avatarCore.computeFrameFlatFromParams(
|
|
14698
|
+
wasmParams,
|
|
14699
|
+
this.characterHandle ?? void 0
|
|
14700
|
+
);
|
|
14701
|
+
if (splatData) {
|
|
14702
|
+
this.renderSystem.loadSplatsFromPackedData(splatData);
|
|
14703
|
+
this.renderSystem.renderFrame();
|
|
14704
|
+
}
|
|
14705
|
+
} catch (error) {
|
|
14706
|
+
logger.error("[AvatarView] Failed to render flame:", error instanceof Error ? error.message : String(error));
|
|
14707
|
+
throw error;
|
|
14708
|
+
}
|
|
14709
|
+
}
|
|
14678
14710
|
async rerenderCurrentFrameWithNewCamera() {
|
|
14679
14711
|
if (this.avatarController.state !== AvatarState.paused || this.renderingState !== "speaking" || !this.renderSystem) {
|
|
14680
14712
|
return;
|
package/dist/index.js
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -131,6 +131,11 @@ export interface PostProcessingConfig {
|
|
|
131
131
|
};
|
|
132
132
|
eyeBlink?: number;
|
|
133
133
|
expressionWeight?: number;
|
|
134
|
-
|
|
134
|
+
eyefocus?: {
|
|
135
|
+
enabled: boolean;
|
|
136
|
+
auto_eyelid_adjustment?: boolean;
|
|
137
|
+
eyelid_threshold?: number;
|
|
138
|
+
targets?: number[];
|
|
139
|
+
};
|
|
135
140
|
}
|
|
136
141
|
export * from './character';
|
package/package.json
CHANGED