@spatialwalk/avatarkit 1.0.0-beta.102 → 1.0.0-beta.103

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,12 @@ 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.103]
9
+
10
+ ### 🔧 Internal
11
+
12
+ - Optimize internal type exports
13
+
8
14
  ## [1.0.0-beta.102]
9
15
 
10
16
  ### 🐛 Bugfixes
@@ -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-DNq7oTVY.js";
4
+ import { A as APP_CONFIG, l as logger, e as errorToMessage, a as logEvent } from "./index-BqX6ubaV.js";
5
5
  class StreamingAudioPlayer {
6
6
  // Mark if AudioContext is being resumed, avoid concurrent resume requests
7
7
  constructor(options) {
@@ -1,4 +1,4 @@
1
- import { CameraConfig, KeyframeData } from '../types';
1
+ import { CameraConfig } from '../types';
2
2
  import { Avatar } from './Avatar';
3
3
  import { AvatarController } from './AvatarController';
4
4
  export declare class AvatarView {
@@ -57,19 +57,6 @@ export declare class AvatarView {
57
57
  * 更新相机配置
58
58
  */
59
59
  updateCameraConfig(cameraConfig: CameraConfig): void;
60
- /**
61
- * Render specified keyframe (pure rendering mode, no audio-animation synchronization)
62
- * Suitable for scenarios where external application controls audio playback and animation playback
63
- * @param keyframeData - Keyframe data
64
- * @param enableIdleRendering - Whether to enable idle loop rendering. true: Enable idle rendering and return immediately (skip this keyframe); false: Disable idle rendering and process keyframe (default)
65
- */
66
- renderFlame(keyframeData: KeyframeData, enableIdleRendering?: boolean): Promise<void>;
67
- generateTransition(options: {
68
- from?: KeyframeData;
69
- to?: KeyframeData;
70
- frameCount: number;
71
- useLinear?: boolean;
72
- }): Promise<KeyframeData[]>;
73
60
  /**
74
61
  * Render a single animation frame from raw protobuf data.
75
62
  *
@@ -107,6 +94,22 @@ export declare class AvatarView {
107
94
  * Start idle animation (stop pure rendering mode, resume idle loop).
108
95
  */
109
96
  startIdle(): void;
97
+ /**
98
+ * Generate transition frames from protobuf data.
99
+ *
100
+ * Decodes the protobuf, extracts the target keyframe, and generates
101
+ * transition frames from the current idle position to the target.
102
+ * The caller is responsible for playing the returned frames at the desired cadence.
103
+ *
104
+ * @param data - Raw protobuf bytes containing the target frame
105
+ * @param frameCount - Number of transition frames to generate
106
+ * @param options - Additional options
107
+ * @param options.useLinear - Use linear interpolation (default: true)
108
+ * @returns Array of opaque keyframe data for sequential playback
109
+ */
110
+ generateTransitionFromProtobuf(data: ArrayBuffer | Uint8Array, frameCount: number, options?: {
111
+ useLinear?: boolean;
112
+ }): Promise<unknown[]>;
110
113
  /**
111
114
  * Cancel any in-progress frame sequence playback.
112
115
  * Called by renderFromProtobuf when streaming frames arrive during transition.
@@ -9508,7 +9508,7 @@ const _AnimationPlayer = class _AnimationPlayer {
9508
9508
  if (this.streamingPlayer) {
9509
9509
  return;
9510
9510
  }
9511
- const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-tmb18x3O.js");
9511
+ const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-CxtOBEsC.js");
9512
9512
  const { AvatarSDK: AvatarSDK2 } = await Promise.resolve().then(() => AvatarSDK$1);
9513
9513
  const audioFormat = AvatarSDK2.getAudioFormat();
9514
9514
  this.streamingPlayer = new StreamingAudioPlayer({
@@ -11548,7 +11548,7 @@ class AvatarSDK {
11548
11548
  __publicField(AvatarSDK, "_initializationState", "uninitialized");
11549
11549
  __publicField(AvatarSDK, "_initializingPromise", null);
11550
11550
  __publicField(AvatarSDK, "_configuration", null);
11551
- __publicField(AvatarSDK, "_version", "1.0.0-beta.102");
11551
+ __publicField(AvatarSDK, "_version", "1.0.0-beta.103");
11552
11552
  __publicField(AvatarSDK, "_avatarCore", null);
11553
11553
  __publicField(AvatarSDK, "_dynamicSdkConfig", null);
11554
11554
  __publicField(AvatarSDK, "_cachedDeviceScore", null);
@@ -17954,9 +17954,9 @@ class AvatarView {
17954
17954
  }
17955
17955
  /**
17956
17956
  * Render specified keyframe (pure rendering mode, no audio-animation synchronization)
17957
- * Suitable for scenarios where external application controls audio playback and animation playback
17958
17957
  * @param keyframeData - Keyframe data
17959
- * @param enableIdleRendering - Whether to enable idle loop rendering. true: Enable idle rendering and return immediately (skip this keyframe); false: Disable idle rendering and process keyframe (default)
17958
+ * @param enableIdleRendering - Whether to enable idle loop rendering
17959
+ * @internal
17960
17960
  */
17961
17961
  async renderFlame(keyframeData, enableIdleRendering) {
17962
17962
  if (!this.isInitialized || !this.renderSystem) {
@@ -17987,6 +17987,7 @@ class AvatarView {
17987
17987
  throw error;
17988
17988
  }
17989
17989
  }
17990
+ /** @internal */
17990
17991
  async generateTransition(options) {
17991
17992
  if (!this.isInitialized) {
17992
17993
  throw new Error("AvatarView not initialized");
@@ -18098,6 +18099,30 @@ class AvatarView {
18098
18099
  startIdle() {
18099
18100
  this.renderFlame(void 0, true);
18100
18101
  }
18102
+ /**
18103
+ * Generate transition frames from protobuf data.
18104
+ *
18105
+ * Decodes the protobuf, extracts the target keyframe, and generates
18106
+ * transition frames from the current idle position to the target.
18107
+ * The caller is responsible for playing the returned frames at the desired cadence.
18108
+ *
18109
+ * @param data - Raw protobuf bytes containing the target frame
18110
+ * @param frameCount - Number of transition frames to generate
18111
+ * @param options - Additional options
18112
+ * @param options.useLinear - Use linear interpolation (default: true)
18113
+ * @returns Array of opaque keyframe data for sequential playback
18114
+ */
18115
+ async generateTransitionFromProtobuf(data, frameCount, options) {
18116
+ const keyframes = decodeAnimationKeyframes(data);
18117
+ if (!keyframes || keyframes.length === 0) {
18118
+ return [];
18119
+ }
18120
+ return this.generateTransition({
18121
+ to: keyframes[0],
18122
+ frameCount,
18123
+ useLinear: (options == null ? void 0 : options.useLinear) ?? true
18124
+ });
18125
+ }
18101
18126
  /**
18102
18127
  * Cancel any in-progress frame sequence playback.
18103
18128
  * Called by renderFromProtobuf when streaming frames arrive during transition.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b, c, m, f, d, j, g, C, i, D, E, k, h, L, R, n } from "./index-DNq7oTVY.js";
1
+ import { b, c, m, f, d, j, g, C, i, D, E, k, h, L, R, n } from "./index-BqX6ubaV.js";
2
2
  export {
3
3
  b as Avatar,
4
4
  c as AvatarController,
@@ -119,26 +119,6 @@ export interface CameraConfig {
119
119
  up?: [number, number, number];
120
120
  aspect?: number;
121
121
  }
122
- /**
123
- * Animation keyframe data
124
- * Used to represent avatar pose and expression parameters
125
- */
126
- export interface KeyframeData {
127
- /** Translation [x, y, z] */
128
- translation: number[];
129
- /** Rotation [x, y, z] (Euler angles, in radians) */
130
- rotation: number[];
131
- /** Neck pose [x, y, z] (in radians) */
132
- neckPose: number[];
133
- /** Jaw pose [x, y, z] (in radians) */
134
- jawPose: number[];
135
- /** Eye pose [x, y, z, x, y, z] (3 parameters for each eye) */
136
- eyePose: number[];
137
- /** Eyelid [x, y] */
138
- eyeLid: number[];
139
- /** Expression parameters array */
140
- expression: number[];
141
- }
142
122
  /**
143
123
  * Post-processing parameter configuration
144
124
  * Used to overlay in real-time on animation parameters returned by the server
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spatialwalk/avatarkit",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.102",
4
+ "version": "1.0.0-beta.103",
5
5
  "packageManager": "pnpm@10.18.2",
6
6
  "description": "AvatarKit SDK - 3D Gaussian Splatting Avatar Rendering SDK",
7
7
  "author": "AvatarKit Team",