@spatius/avatarkit 1.2.0-beta.1 → 1.2.0-beta.2
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 +5 -0
- package/dist/{StreamingAudioPlayer-Br8UrVgO.js → StreamingAudioPlayer-CqzPGdy5.js} +1 -1
- package/dist/core/AvatarController.d.ts +1 -8
- package/dist/{index-DHCQ9wsL.js → index-BnubRaUR.js} +10 -120
- package/dist/index.js +1 -1
- package/dist/types/index.d.ts +0 -47
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,11 @@ 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.2.0-beta.2] - 2026-06-23
|
|
9
|
+
|
|
10
|
+
### Removed
|
|
11
|
+
- Post-processing support has been removed from the SDK. The `PostProcessingConfig` type and `AvatarController.setPostProcessingConfig()` are gone; the SDK now renders frames exactly as provided. No effect on standard playback or RTC.
|
|
12
|
+
|
|
8
13
|
## [1.2.0-beta.1] - 2026-06-19
|
|
9
14
|
|
|
10
15
|
### Added
|
|
@@ -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-
|
|
4
|
+
import { A as APP_CONFIG, l as logger, e as errorToMessage, a as logEvent } from "./index-BnubRaUR.js";
|
|
5
5
|
class StreamingAudioPlayer {
|
|
6
6
|
// Mark if AudioContext is being resumed, avoid concurrent resume requests
|
|
7
7
|
constructor(options) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Avatar } from './Avatar';
|
|
2
|
-
import { ConnectionState, AvatarError, DrivingServiceMode, FrameStarvationMode, ConversationState, AnimationType
|
|
2
|
+
import { ConnectionState, AvatarError, DrivingServiceMode, FrameStarvationMode, ConversationState, AnimationType } from '../types';
|
|
3
3
|
import { FrameRateInfo } from '../performance/FrameRateMonitor';
|
|
4
4
|
export declare class AvatarController {
|
|
5
5
|
private networkLayer?;
|
|
@@ -37,7 +37,6 @@ export declare class AvatarController {
|
|
|
37
37
|
set frameRateMonitorEnabled(value: boolean);
|
|
38
38
|
private renderCallback?;
|
|
39
39
|
private characterHandle;
|
|
40
|
-
private postProcessingConfig;
|
|
41
40
|
private lastRenderedFrameIndex;
|
|
42
41
|
private keyframesOffset;
|
|
43
42
|
private readonly MAX_KEYFRAMES;
|
|
@@ -140,12 +139,6 @@ export declare class AvatarController {
|
|
|
140
139
|
* The point count of current avatar, or null if avatar is not loaded.
|
|
141
140
|
*/
|
|
142
141
|
get pointCount(): number | null;
|
|
143
|
-
/**
|
|
144
|
-
* Set post-processing configuration
|
|
145
|
-
* These parameters will be applied in real-time to animation parameters returned by the server
|
|
146
|
-
* @param config Post-processing configuration, or null to clear
|
|
147
|
-
*/
|
|
148
|
-
setPostProcessingConfig(config: PostProcessingConfig | null): void;
|
|
149
142
|
/**
|
|
150
143
|
* Set audio playback volume
|
|
151
144
|
* Note: This only controls the avatar audio player volume, not the system volume
|
|
@@ -12631,7 +12631,7 @@ const _AnimationPlayer = class _AnimationPlayer {
|
|
|
12631
12631
|
if (this.streamingPlayer) {
|
|
12632
12632
|
return;
|
|
12633
12633
|
}
|
|
12634
|
-
const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-
|
|
12634
|
+
const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-CqzPGdy5.js");
|
|
12635
12635
|
const { AvatarSDK: AvatarSDK2 } = await Promise.resolve().then(() => AvatarSDK$1);
|
|
12636
12636
|
const audioFormat = AvatarSDK2.getAudioFormat();
|
|
12637
12637
|
this.streamingPlayer = new StreamingAudioPlayer({
|
|
@@ -14691,7 +14691,7 @@ class AvatarSDK {
|
|
|
14691
14691
|
__publicField(AvatarSDK, "_initializationState", "uninitialized");
|
|
14692
14692
|
__publicField(AvatarSDK, "_initializingPromise", null);
|
|
14693
14693
|
__publicField(AvatarSDK, "_configuration", null);
|
|
14694
|
-
__publicField(AvatarSDK, "_version", "1.2.0-beta.
|
|
14694
|
+
__publicField(AvatarSDK, "_version", "1.2.0-beta.2");
|
|
14695
14695
|
__publicField(AvatarSDK, "_avatarCore", null);
|
|
14696
14696
|
__publicField(AvatarSDK, "_cachedDeviceScore", null);
|
|
14697
14697
|
__publicField(AvatarSDK, "_rendererBackend", null);
|
|
@@ -15859,7 +15859,6 @@ class AvatarController {
|
|
|
15859
15859
|
__publicField(this, "characterHandle", null);
|
|
15860
15860
|
// Character handle for multi-character support
|
|
15861
15861
|
// ========== Post-processing Configuration ==========
|
|
15862
|
-
__publicField(this, "postProcessingConfig", null);
|
|
15863
15862
|
// ========== Playback Loop ==========
|
|
15864
15863
|
__publicField(this, "lastRenderedFrameIndex", -1);
|
|
15865
15864
|
__publicField(this, "keyframesOffset", 0);
|
|
@@ -16663,18 +16662,7 @@ class AvatarController {
|
|
|
16663
16662
|
return avatarCore.getPointCount(this.characterHandle);
|
|
16664
16663
|
}
|
|
16665
16664
|
/**
|
|
16666
|
-
*
|
|
16667
|
-
* These parameters will be applied in real-time to animation parameters returned by the server
|
|
16668
|
-
* @param config Post-processing configuration, or null to clear
|
|
16669
|
-
*/
|
|
16670
|
-
setPostProcessingConfig(config) {
|
|
16671
|
-
this.postProcessingConfig = config;
|
|
16672
|
-
if (this.currentState === AvatarState.paused && this.isPlaying) {
|
|
16673
|
-
this.rerenderCurrentFrame();
|
|
16674
|
-
}
|
|
16675
|
-
}
|
|
16676
|
-
/**
|
|
16677
|
-
* 重新渲染当前帧(用于暂停状态下更新后处理参数或相机配置)
|
|
16665
|
+
* 重新渲染当前帧(用于暂停状态下更新相机配置)
|
|
16678
16666
|
* @internal
|
|
16679
16667
|
*/
|
|
16680
16668
|
async rerenderCurrentFrameIfPaused() {
|
|
@@ -16694,10 +16682,7 @@ class AvatarController {
|
|
|
16694
16682
|
}
|
|
16695
16683
|
try {
|
|
16696
16684
|
const currentFrame = this.currentKeyframes[arrayIndex];
|
|
16697
|
-
|
|
16698
|
-
if (this.postProcessingConfig) {
|
|
16699
|
-
wasmParams = this.applyPostProcessingToParams(wasmParams);
|
|
16700
|
-
}
|
|
16685
|
+
const wasmParams = convertProtoFlameToWasmParams(currentFrame);
|
|
16701
16686
|
const avatarCore = AvatarSDK.getAvatarCore();
|
|
16702
16687
|
if (avatarCore) {
|
|
16703
16688
|
const splatData = await avatarCore.computeFrameFlatFromParams(wasmParams, this.characterHandle ?? void 0);
|
|
@@ -17172,97 +17157,6 @@ class AvatarController {
|
|
|
17172
17157
|
listeners.forEach((callback) => callback(data));
|
|
17173
17158
|
}
|
|
17174
17159
|
}
|
|
17175
|
-
/**
|
|
17176
|
-
* Apply post-processing parameters to a Flame (proto format)
|
|
17177
|
-
* Used for transition animations
|
|
17178
|
-
* @internal
|
|
17179
|
-
*/
|
|
17180
|
-
applyPostProcessingToFlame(flame) {
|
|
17181
|
-
if (!this.postProcessingConfig) {
|
|
17182
|
-
return flame;
|
|
17183
|
-
}
|
|
17184
|
-
let wasmParams = convertProtoFlameToWasmParams(flame);
|
|
17185
|
-
wasmParams = this.applyPostProcessingToParams(wasmParams);
|
|
17186
|
-
return convertWasmParamsToProtoFlame(wasmParams);
|
|
17187
|
-
}
|
|
17188
|
-
/**
|
|
17189
|
-
* Apply post-processing parameters to animation parameters
|
|
17190
|
-
* @internal
|
|
17191
|
-
*/
|
|
17192
|
-
/** @internal */
|
|
17193
|
-
applyPostProcessingToParams(baseParams) {
|
|
17194
|
-
if (!this.postProcessingConfig) {
|
|
17195
|
-
return baseParams;
|
|
17196
|
-
}
|
|
17197
|
-
const result2 = {
|
|
17198
|
-
shape_params: baseParams.shape_params || Array.from({ length: 300 }, () => 0),
|
|
17199
|
-
expr_params: baseParams.expr_params ? [...baseParams.expr_params] : Array.from({ length: 100 }, () => 0),
|
|
17200
|
-
rotation: baseParams.rotation ? [...baseParams.rotation] : [0, 0, 0],
|
|
17201
|
-
translation: baseParams.translation ? [...baseParams.translation] : [0, 0, 0],
|
|
17202
|
-
neck_pose: baseParams.neck_pose ? [...baseParams.neck_pose] : [0, 0, 0],
|
|
17203
|
-
jaw_pose: baseParams.jaw_pose ? [...baseParams.jaw_pose] : [0, 0, 0],
|
|
17204
|
-
eyes_pose: baseParams.eyes_pose ? [...baseParams.eyes_pose] : [0, 0, 0, 0, 0, 0],
|
|
17205
|
-
eyelid: baseParams.eyelid ? [...baseParams.eyelid] : [0, 0],
|
|
17206
|
-
has_eyelid: baseParams.has_eyelid || false
|
|
17207
|
-
};
|
|
17208
|
-
if (this.postProcessingConfig.rotation && result2.rotation) {
|
|
17209
|
-
result2.rotation[0] += this.postProcessingConfig.rotation.x ?? 0;
|
|
17210
|
-
result2.rotation[1] += this.postProcessingConfig.rotation.y ?? 0;
|
|
17211
|
-
result2.rotation[2] += this.postProcessingConfig.rotation.z ?? 0;
|
|
17212
|
-
}
|
|
17213
|
-
if (this.postProcessingConfig.translation && result2.translation) {
|
|
17214
|
-
result2.translation[0] += this.postProcessingConfig.translation.x ?? 0;
|
|
17215
|
-
result2.translation[1] += this.postProcessingConfig.translation.y ?? 0;
|
|
17216
|
-
result2.translation[2] += this.postProcessingConfig.translation.z ?? 0;
|
|
17217
|
-
}
|
|
17218
|
-
if (this.postProcessingConfig.neckPose && result2.neck_pose) {
|
|
17219
|
-
const biasX = this.postProcessingConfig.neckPose.x ?? 0;
|
|
17220
|
-
const biasY = this.postProcessingConfig.neckPose.y ?? 0;
|
|
17221
|
-
const biasZ = this.postProcessingConfig.neckPose.z ?? 0;
|
|
17222
|
-
const weightX = this.postProcessingConfig.neckPose.weightX ?? 1;
|
|
17223
|
-
const weightY = this.postProcessingConfig.neckPose.weightY ?? 1;
|
|
17224
|
-
const weightZ = this.postProcessingConfig.neckPose.weightZ ?? 1;
|
|
17225
|
-
result2.neck_pose[0] = result2.neck_pose[0] * weightX + biasX;
|
|
17226
|
-
result2.neck_pose[1] = result2.neck_pose[1] * weightY + biasY;
|
|
17227
|
-
result2.neck_pose[2] = result2.neck_pose[2] * weightZ + biasZ;
|
|
17228
|
-
}
|
|
17229
|
-
if (this.postProcessingConfig.jawPose && result2.jaw_pose) {
|
|
17230
|
-
const biasX = this.postProcessingConfig.jawPose.x ?? 0;
|
|
17231
|
-
const biasY = this.postProcessingConfig.jawPose.y ?? 0;
|
|
17232
|
-
const biasZ = this.postProcessingConfig.jawPose.z ?? 0;
|
|
17233
|
-
const weight = this.postProcessingConfig.jawPose.weight ?? 1;
|
|
17234
|
-
result2.jaw_pose[0] = result2.jaw_pose[0] * weight + biasX;
|
|
17235
|
-
result2.jaw_pose[1] = result2.jaw_pose[1] * weight + biasY;
|
|
17236
|
-
result2.jaw_pose[2] = result2.jaw_pose[2] * weight + biasZ;
|
|
17237
|
-
}
|
|
17238
|
-
if (this.postProcessingConfig.eyePose && result2.eyes_pose) {
|
|
17239
|
-
const biasX = this.postProcessingConfig.eyePose.x ?? 0;
|
|
17240
|
-
const biasY = this.postProcessingConfig.eyePose.y ?? 0;
|
|
17241
|
-
const biasZ = this.postProcessingConfig.eyePose.z ?? 0;
|
|
17242
|
-
const weightX = this.postProcessingConfig.eyePose.weightX ?? 1;
|
|
17243
|
-
const weightY = this.postProcessingConfig.eyePose.weightY ?? 1;
|
|
17244
|
-
const weightZ = this.postProcessingConfig.eyePose.weightZ ?? 1;
|
|
17245
|
-
result2.eyes_pose[0] = result2.eyes_pose[0] * weightX + biasX;
|
|
17246
|
-
result2.eyes_pose[1] = result2.eyes_pose[1] * weightY + biasY;
|
|
17247
|
-
result2.eyes_pose[2] = result2.eyes_pose[2] * weightZ + biasZ;
|
|
17248
|
-
result2.eyes_pose[3] = result2.eyes_pose[3] * weightX + biasX;
|
|
17249
|
-
result2.eyes_pose[4] = result2.eyes_pose[4] * weightY + biasY;
|
|
17250
|
-
result2.eyes_pose[5] = result2.eyes_pose[5] * weightZ + biasZ;
|
|
17251
|
-
}
|
|
17252
|
-
if (this.postProcessingConfig.eyeBlink !== void 0 && result2.eyelid) {
|
|
17253
|
-
const blinkValue = this.postProcessingConfig.eyeBlink;
|
|
17254
|
-
result2.eyelid[0] = blinkValue;
|
|
17255
|
-
result2.eyelid[1] = blinkValue;
|
|
17256
|
-
result2.has_eyelid = true;
|
|
17257
|
-
}
|
|
17258
|
-
if (this.postProcessingConfig.expressionWeight !== void 0 && result2.expr_params) {
|
|
17259
|
-
const weight = this.postProcessingConfig.expressionWeight;
|
|
17260
|
-
for (let i2 = 0; i2 < result2.expr_params.length; i2++) {
|
|
17261
|
-
result2.expr_params[i2] *= weight;
|
|
17262
|
-
}
|
|
17263
|
-
}
|
|
17264
|
-
return result2;
|
|
17265
|
-
}
|
|
17266
17160
|
}
|
|
17267
17161
|
function errorToMessage(err) {
|
|
17268
17162
|
if (err instanceof Error) {
|
|
@@ -20882,8 +20776,7 @@ class AvatarView {
|
|
|
20882
20776
|
if (arrayIndex >= 0 && arrayIndex < keyframes.length) {
|
|
20883
20777
|
const currentFrame = keyframes[arrayIndex];
|
|
20884
20778
|
this.currentFrame = currentFrame;
|
|
20885
|
-
|
|
20886
|
-
wasmParams = this.avatarController.applyPostProcessingToParams(wasmParams);
|
|
20779
|
+
const wasmParams = convertProtoFlameToWasmParams(currentFrame);
|
|
20887
20780
|
computeInFlight = true;
|
|
20888
20781
|
avatarCore.computeFrameFlatFromParams(wasmParams, this.characterHandle ?? void 0).then((splatData) => {
|
|
20889
20782
|
if (splatData && !this.isPureRenderingMode) {
|
|
@@ -20910,7 +20803,7 @@ class AvatarView {
|
|
|
20910
20803
|
const offset = this.avatarController.getKeyframesOffset();
|
|
20911
20804
|
const targetArrayIdx = targetIdx - offset;
|
|
20912
20805
|
if (targetArrayIdx >= 0 && targetArrayIdx < keyframes.length) {
|
|
20913
|
-
const targetFrame =
|
|
20806
|
+
const targetFrame = keyframes[targetArrayIdx];
|
|
20914
20807
|
this.transitionFrames = this.generateAndAlignTransitionFrames(
|
|
20915
20808
|
this.currentFrame,
|
|
20916
20809
|
targetFrame,
|
|
@@ -21186,10 +21079,9 @@ class AvatarView {
|
|
|
21186
21079
|
const fromFrame = this.currentFrame;
|
|
21187
21080
|
if (fromFrame) {
|
|
21188
21081
|
const firstSpeaking = keyframes[0];
|
|
21189
|
-
const firstSpeakingWithPP = this.avatarController.applyPostProcessingToFlame(firstSpeaking);
|
|
21190
21082
|
this.transitionFrames = this.generateAndAlignTransitionFrames(
|
|
21191
21083
|
fromFrame,
|
|
21192
|
-
|
|
21084
|
+
firstSpeaking,
|
|
21193
21085
|
START_TRANSITION_DURATION_MS,
|
|
21194
21086
|
true
|
|
21195
21087
|
);
|
|
@@ -21221,9 +21113,8 @@ class AvatarView {
|
|
|
21221
21113
|
const fromFrame = this.currentFrame;
|
|
21222
21114
|
if (fromFrame && this.cachedIdleFirstFrame) {
|
|
21223
21115
|
try {
|
|
21224
|
-
const fromFrameWithPP = this.avatarController.applyPostProcessingToFlame(fromFrame);
|
|
21225
21116
|
this.transitionFrames = this.generateAndAlignTransitionFrames(
|
|
21226
|
-
|
|
21117
|
+
fromFrame,
|
|
21227
21118
|
this.cachedIdleFirstFrame,
|
|
21228
21119
|
END_TRANSITION_DURATION_MS,
|
|
21229
21120
|
false
|
|
@@ -21341,8 +21232,7 @@ class AvatarView {
|
|
|
21341
21232
|
try {
|
|
21342
21233
|
const flame = keyframeData;
|
|
21343
21234
|
this.currentFrame = flame;
|
|
21344
|
-
const
|
|
21345
|
-
const wasmParams = convertProtoFlameToWasmParams(processedFlame);
|
|
21235
|
+
const wasmParams = convertProtoFlameToWasmParams(flame);
|
|
21346
21236
|
const avatarCore = AvatarSDK.getAvatarCore();
|
|
21347
21237
|
if (!avatarCore) {
|
|
21348
21238
|
throw new Error("AvatarCore not available");
|
|
@@ -21384,7 +21274,7 @@ class AvatarView {
|
|
|
21384
21274
|
}
|
|
21385
21275
|
let toFrame;
|
|
21386
21276
|
if (to2) {
|
|
21387
|
-
toFrame =
|
|
21277
|
+
toFrame = to2;
|
|
21388
21278
|
} else {
|
|
21389
21279
|
const idleParams = await avatarCore.getCurrentFrameParams(this.activeAnimationState.frameIndex, this.characterId);
|
|
21390
21280
|
toFrame = convertWasmParamsToProtoFlame(idleParams);
|
package/dist/index.js
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -147,53 +147,6 @@ export interface CameraConfig {
|
|
|
147
147
|
up?: [number, number, number];
|
|
148
148
|
aspect?: number;
|
|
149
149
|
}
|
|
150
|
-
/**
|
|
151
|
-
* Post-processing parameter configuration
|
|
152
|
-
* Used to overlay in real-time on animation parameters returned by the server
|
|
153
|
-
*/
|
|
154
|
-
export interface PostProcessingConfig {
|
|
155
|
-
/** Rotation (Euler angles, in radians) */
|
|
156
|
-
rotation?: {
|
|
157
|
-
x?: number;
|
|
158
|
-
y?: number;
|
|
159
|
-
z?: number;
|
|
160
|
-
};
|
|
161
|
-
/** Translation (position offset) */
|
|
162
|
-
translation?: {
|
|
163
|
-
x?: number;
|
|
164
|
-
y?: number;
|
|
165
|
-
z?: number;
|
|
166
|
-
};
|
|
167
|
-
/** Neck pose offset (in radians) */
|
|
168
|
-
neckPose?: {
|
|
169
|
-
x?: number;
|
|
170
|
-
y?: number;
|
|
171
|
-
z?: number;
|
|
172
|
-
weightX?: number;
|
|
173
|
-
weightY?: number;
|
|
174
|
-
weightZ?: number;
|
|
175
|
-
};
|
|
176
|
-
/** Jaw pose offset (in radians) */
|
|
177
|
-
jawPose?: {
|
|
178
|
-
x?: number;
|
|
179
|
-
y?: number;
|
|
180
|
-
z?: number;
|
|
181
|
-
weight?: number;
|
|
182
|
-
};
|
|
183
|
-
/** Eye pose offset (in radians) */
|
|
184
|
-
eyePose?: {
|
|
185
|
-
x?: number;
|
|
186
|
-
y?: number;
|
|
187
|
-
z?: number;
|
|
188
|
-
weightX?: number;
|
|
189
|
-
weightY?: number;
|
|
190
|
-
weightZ?: number;
|
|
191
|
-
};
|
|
192
|
-
/** Eye blink value (-1.0 to 1.0, larger value means more closed) */
|
|
193
|
-
eyeBlink?: number;
|
|
194
|
-
/** Expression weight (0.0-2.0, 0=no expression, 1=normal, >1=enhanced) */
|
|
195
|
-
expressionWeight?: number;
|
|
196
|
-
}
|
|
197
150
|
export interface CharacterInfo {
|
|
198
151
|
pointCount: number;
|
|
199
152
|
hasAnimation: boolean;
|
package/package.json
CHANGED