@spatialwalk/avatarkit 1.0.0-beta.42 → 1.0.0-beta.43
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,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.0.0-beta.43] - 2025-12-29
|
|
9
|
+
|
|
10
|
+
### 🔧 Improvements
|
|
11
|
+
- Remove some unnecessary telemetry reporting
|
|
12
|
+
|
|
8
13
|
## [1.0.0-beta.42] - 2025-12-29
|
|
9
14
|
|
|
10
15
|
### ✨ 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-DiAM42qy.js";
|
|
5
5
|
class StreamingAudioPlayer {
|
|
6
6
|
constructor(options) {
|
|
7
7
|
__publicField(this, "audioContext", null);
|
|
@@ -334,67 +334,6 @@ class StreamingAudioPlayer {
|
|
|
334
334
|
audioContextState: this.audioContext.state
|
|
335
335
|
});
|
|
336
336
|
}
|
|
337
|
-
seek(targetTime, referenceAudioContextTime) {
|
|
338
|
-
if (!this.audioContext) {
|
|
339
|
-
logger.warn("[StreamingAudioPlayer] Cannot seek: AudioContext not initialized");
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
if (this.isPaused && this.audioContext.state === "suspended") {
|
|
343
|
-
this.audioContext.resume().catch(() => {
|
|
344
|
-
});
|
|
345
|
-
this.isPaused = false;
|
|
346
|
-
}
|
|
347
|
-
for (const source of this.activeSources) {
|
|
348
|
-
source.onended = null;
|
|
349
|
-
try {
|
|
350
|
-
source.stop(0);
|
|
351
|
-
} catch {
|
|
352
|
-
}
|
|
353
|
-
try {
|
|
354
|
-
source.disconnect();
|
|
355
|
-
} catch {
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
this.activeSources.clear();
|
|
359
|
-
let accumulatedDuration = 0;
|
|
360
|
-
let targetChunkIndex = 0;
|
|
361
|
-
let targetChunkOffset = 0;
|
|
362
|
-
for (let i = 0; i < this.audioChunks.length; i++) {
|
|
363
|
-
const chunk = this.audioChunks[i];
|
|
364
|
-
const chunkDuration = chunk.data.length / (this.sampleRate * this.channelCount * 2);
|
|
365
|
-
if (accumulatedDuration + chunkDuration >= targetTime) {
|
|
366
|
-
targetChunkIndex = i;
|
|
367
|
-
targetChunkOffset = targetTime - accumulatedDuration;
|
|
368
|
-
break;
|
|
369
|
-
}
|
|
370
|
-
accumulatedDuration += chunkDuration;
|
|
371
|
-
}
|
|
372
|
-
if (targetTime >= accumulatedDuration) {
|
|
373
|
-
targetChunkIndex = this.audioChunks.length;
|
|
374
|
-
targetChunkOffset = 0;
|
|
375
|
-
}
|
|
376
|
-
this.scheduledChunks = targetChunkIndex;
|
|
377
|
-
this.scheduledChunkInfo = [];
|
|
378
|
-
const currentAudioTime = referenceAudioContextTime ?? this.audioContext.currentTime;
|
|
379
|
-
this.sessionStartTime = currentAudioTime - targetTime;
|
|
380
|
-
this.scheduledTime = currentAudioTime;
|
|
381
|
-
if (targetChunkOffset > 0 && targetChunkIndex < this.audioChunks.length) {
|
|
382
|
-
const offsetSamples = Math.floor(targetChunkOffset * this.sampleRate * this.channelCount * 2);
|
|
383
|
-
if (offsetSamples > 0 && offsetSamples < this.audioChunks[targetChunkIndex].data.length) {
|
|
384
|
-
this.audioChunks[targetChunkIndex].data = this.audioChunks[targetChunkIndex].data.slice(offsetSamples);
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
if (this.isPlaying && !this.isPaused) {
|
|
388
|
-
this.scheduleAllChunks();
|
|
389
|
-
}
|
|
390
|
-
this.log("Seeked to position", {
|
|
391
|
-
targetTime,
|
|
392
|
-
targetChunkIndex,
|
|
393
|
-
targetChunkOffset,
|
|
394
|
-
scheduledChunks: this.scheduledChunks,
|
|
395
|
-
sessionStartTime: this.sessionStartTime
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
337
|
stop() {
|
|
399
338
|
if (!this.audioContext) {
|
|
400
339
|
return;
|
|
@@ -43,7 +43,6 @@ export declare class StreamingAudioPlayer {
|
|
|
43
43
|
getAudioContextTime(): number;
|
|
44
44
|
pause(): void;
|
|
45
45
|
resume(): Promise<void>;
|
|
46
|
-
seek(targetTime: number, referenceAudioContextTime?: number): void;
|
|
47
46
|
stop(): void;
|
|
48
47
|
setAutoStart(enabled: boolean): void;
|
|
49
48
|
play(): void;
|
|
@@ -7573,7 +7573,7 @@ const _AnimationPlayer = class _AnimationPlayer {
|
|
|
7573
7573
|
if (this.streamingPlayer) {
|
|
7574
7574
|
return;
|
|
7575
7575
|
}
|
|
7576
|
-
const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-
|
|
7576
|
+
const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-Dy3rj-Pp.js");
|
|
7577
7577
|
const { AvatarSDK: AvatarSDK2 } = await Promise.resolve().then(() => AvatarSDK$1);
|
|
7578
7578
|
const audioFormat = AvatarSDK2.getAudioFormat();
|
|
7579
7579
|
this.streamingPlayer = new StreamingAudioPlayer({
|
|
@@ -7778,7 +7778,6 @@ function clearSdkConfigCache() {
|
|
|
7778
7778
|
configCache.promise = null;
|
|
7779
7779
|
}
|
|
7780
7780
|
const FIRST_USE_KEY = "spavatar_first_use";
|
|
7781
|
-
const LAST_ACTIVE_DATE_KEY = "spavatar_last_active_date";
|
|
7782
7781
|
function isFirstUse() {
|
|
7783
7782
|
try {
|
|
7784
7783
|
const stored = localStorage.getItem(FIRST_USE_KEY);
|
|
@@ -7795,23 +7794,6 @@ function isFirstUse() {
|
|
|
7795
7794
|
return false;
|
|
7796
7795
|
}
|
|
7797
7796
|
}
|
|
7798
|
-
function isDailyActive() {
|
|
7799
|
-
try {
|
|
7800
|
-
const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
7801
|
-
const lastActiveDate = localStorage.getItem(LAST_ACTIVE_DATE_KEY);
|
|
7802
|
-
if (lastActiveDate === today) {
|
|
7803
|
-
return false;
|
|
7804
|
-
}
|
|
7805
|
-
try {
|
|
7806
|
-
localStorage.setItem(LAST_ACTIVE_DATE_KEY, today);
|
|
7807
|
-
return true;
|
|
7808
|
-
} catch {
|
|
7809
|
-
return false;
|
|
7810
|
-
}
|
|
7811
|
-
} catch (error) {
|
|
7812
|
-
return false;
|
|
7813
|
-
}
|
|
7814
|
-
}
|
|
7815
7797
|
class HeartbeatManager {
|
|
7816
7798
|
constructor() {
|
|
7817
7799
|
__publicField(this, "heartbeatTimer", null);
|
|
@@ -8792,7 +8774,7 @@ class AvatarCoreAdapter {
|
|
|
8792
8774
|
}
|
|
8793
8775
|
class AvatarSDK {
|
|
8794
8776
|
static async initialize(appId, configuration) {
|
|
8795
|
-
var _a
|
|
8777
|
+
var _a;
|
|
8796
8778
|
try {
|
|
8797
8779
|
if (this._isInitialized) {
|
|
8798
8780
|
logger.log(`[AvatarSDK] Re-initializing with new environment: ${configuration.environment}`);
|
|
@@ -8823,12 +8805,6 @@ class AvatarSDK {
|
|
|
8823
8805
|
environment: (_a = this._configuration) == null ? void 0 : _a.environment
|
|
8824
8806
|
});
|
|
8825
8807
|
}
|
|
8826
|
-
if (isDailyActive()) {
|
|
8827
|
-
logEvent("sdk_daily_active", "info", {
|
|
8828
|
-
appId: idManager.getAppId(),
|
|
8829
|
-
environment: (_b = this._configuration) == null ? void 0 : _b.environment
|
|
8830
|
-
});
|
|
8831
|
-
}
|
|
8832
8808
|
heartbeatManager.start(this._configuration.environment);
|
|
8833
8809
|
logger.log(`[AvatarSDK] Successfully initialized`);
|
|
8834
8810
|
} catch (error) {
|
|
@@ -8987,7 +8963,7 @@ class AvatarSDK {
|
|
|
8987
8963
|
}
|
|
8988
8964
|
__publicField(AvatarSDK, "_isInitialized", false);
|
|
8989
8965
|
__publicField(AvatarSDK, "_configuration", null);
|
|
8990
|
-
__publicField(AvatarSDK, "_version", "1.0.0-beta.
|
|
8966
|
+
__publicField(AvatarSDK, "_version", "1.0.0-beta.43");
|
|
8991
8967
|
__publicField(AvatarSDK, "_avatarCore", null);
|
|
8992
8968
|
__publicField(AvatarSDK, "_dynamicSdkConfig", null);
|
|
8993
8969
|
const AvatarSDK$1 = Object.freeze(Object.defineProperty({
|
|
@@ -10019,11 +9995,6 @@ class AnimationWebSocketClient extends EventEmitter {
|
|
|
10019
9995
|
this.isConnecting = false;
|
|
10020
9996
|
const message = error instanceof Error ? error.message : String(error);
|
|
10021
9997
|
logger.error("[AnimationWebSocketClient] Connection failed:", message);
|
|
10022
|
-
logEvent("character_animation_service", "error", {
|
|
10023
|
-
characterId,
|
|
10024
|
-
event: "connect_failed",
|
|
10025
|
-
reason: message
|
|
10026
|
-
});
|
|
10027
9998
|
throw error;
|
|
10028
9999
|
}
|
|
10029
10000
|
}
|
|
@@ -10128,11 +10099,6 @@ class AnimationWebSocketClient extends EventEmitter {
|
|
|
10128
10099
|
} else if (event.data instanceof Blob) {
|
|
10129
10100
|
event.data.arrayBuffer().then(this.handleMessage.bind(this)).catch((err) => {
|
|
10130
10101
|
logger.error("[AnimationWebSocketClient] Failed to convert Blob to ArrayBuffer:", err);
|
|
10131
|
-
logEvent("character_animation_service", "error", {
|
|
10132
|
-
characterId: this.currentCharacterId,
|
|
10133
|
-
event: "decode_blob_failed",
|
|
10134
|
-
reason: err instanceof Error ? err.message : String(err)
|
|
10135
|
-
});
|
|
10136
10102
|
this.emit("error", err);
|
|
10137
10103
|
});
|
|
10138
10104
|
} else {
|
|
@@ -10154,11 +10120,6 @@ class AnimationWebSocketClient extends EventEmitter {
|
|
|
10154
10120
|
logger.warn(" 4. Network/firewall blocking the connection");
|
|
10155
10121
|
logger.warn(` Please check browser Network tab for detailed error information`);
|
|
10156
10122
|
}
|
|
10157
|
-
logEvent("character_animation_service", "error", {
|
|
10158
|
-
characterId: this.currentCharacterId,
|
|
10159
|
-
event: "websocket_error",
|
|
10160
|
-
reason: `ReadyState: ${readyState} (${readyStateText}), URL: ${urlForLog}`
|
|
10161
|
-
});
|
|
10162
10123
|
this.emit("error", new Error(`WebSocket error (readyState: ${readyState})`));
|
|
10163
10124
|
if (!this.isManuallyDisconnected && this.currentRetryCount < this.reconnectAttempts) {
|
|
10164
10125
|
this.scheduleReconnect();
|
|
@@ -10205,11 +10166,6 @@ class AnimationWebSocketClient extends EventEmitter {
|
|
|
10205
10166
|
}
|
|
10206
10167
|
if (event.code === 1006) {
|
|
10207
10168
|
logger.warn("[AnimationWebSocketClient] Connection closed abnormally (1006) - possible causes: network issue, server rejection, or protocol mismatch");
|
|
10208
|
-
logEvent("character_animation_service", "warning", {
|
|
10209
|
-
characterId: this.currentCharacterId,
|
|
10210
|
-
event: "websocket_abnormal_close",
|
|
10211
|
-
reason: `Code: ${event.code}, URL: ${urlForLog}`
|
|
10212
|
-
});
|
|
10213
10169
|
}
|
|
10214
10170
|
if (event.code === 1012) {
|
|
10215
10171
|
logEvent("service_restarted", "warning", {
|
|
@@ -10300,10 +10256,6 @@ class AnimationWebSocketClient extends EventEmitter {
|
|
|
10300
10256
|
}
|
|
10301
10257
|
if (message.type === MessageType.MESSAGE_SERVER_ERROR) {
|
|
10302
10258
|
logger.warn("[AnimationWebSocketClient] MESSAGE_SERVER_ERROR received but no error field in message");
|
|
10303
|
-
logEvent("character_animation_service", "warning", {
|
|
10304
|
-
characterId: this.currentCharacterId,
|
|
10305
|
-
event: "message_error_without_payload"
|
|
10306
|
-
});
|
|
10307
10259
|
this.emit("error", new Error("Server returned error message without error details"));
|
|
10308
10260
|
return;
|
|
10309
10261
|
}
|
|
@@ -10373,11 +10325,6 @@ class NetworkLayer {
|
|
|
10373
10325
|
if (!this.dataController.connected) {
|
|
10374
10326
|
this.isFallbackMode = true;
|
|
10375
10327
|
logger.warn(`[NetworkLayer] WebSocket connection timeout (${CONNECTION_TIMEOUT_MS}ms) - entering fallback mode`);
|
|
10376
|
-
logEvent("character_manager", "warning", {
|
|
10377
|
-
avatar_id: this.dataController.getAvatarId(),
|
|
10378
|
-
event: "websocket_connection_timeout_fallback",
|
|
10379
|
-
timeoutMs: CONNECTION_TIMEOUT_MS
|
|
10380
|
-
});
|
|
10381
10328
|
(_b2 = (_a2 = this.dataController).onConnectionState) == null ? void 0 : _b2.call(_a2, ConnectionState.failed);
|
|
10382
10329
|
}
|
|
10383
10330
|
resolve2();
|
|
@@ -10395,10 +10342,6 @@ class NetworkLayer {
|
|
|
10395
10342
|
if (!this.isFallbackMode) {
|
|
10396
10343
|
this.isFallbackMode = true;
|
|
10397
10344
|
logger.warn("[NetworkLayer] WebSocket connection failed - entering fallback mode");
|
|
10398
|
-
logEvent("character_manager", "warning", {
|
|
10399
|
-
avatar_id: this.dataController.getAvatarId(),
|
|
10400
|
-
event: "websocket_connection_failed_fallback"
|
|
10401
|
-
});
|
|
10402
10345
|
}
|
|
10403
10346
|
(_d = (_c = this.dataController).onConnectionState) == null ? void 0 : _d.call(_c, ConnectionState.failed);
|
|
10404
10347
|
throw error;
|
|
@@ -10498,20 +10441,12 @@ class NetworkLayer {
|
|
|
10498
10441
|
this.isFallbackMode = false;
|
|
10499
10442
|
this.dataController.setConnected(true);
|
|
10500
10443
|
(_b = (_a = this.dataController).onConnectionState) == null ? void 0 : _b.call(_a, ConnectionState.connected);
|
|
10501
|
-
logEvent("character_animation_service", "info", {
|
|
10502
|
-
avatar_id: this.dataController.getAvatarId(),
|
|
10503
|
-
event: "connected"
|
|
10504
|
-
});
|
|
10505
10444
|
});
|
|
10506
10445
|
this.wsClient.on("disconnected", () => {
|
|
10507
10446
|
var _a, _b;
|
|
10508
10447
|
this.dataController.setConnected(false);
|
|
10509
10448
|
idManager.clearConnectionId();
|
|
10510
10449
|
(_b = (_a = this.dataController).onConnectionState) == null ? void 0 : _b.call(_a, ConnectionState.disconnected);
|
|
10511
|
-
logEvent("character_animation_service", "warning", {
|
|
10512
|
-
avatar_id: this.dataController.getAvatarId(),
|
|
10513
|
-
event: "disconnected"
|
|
10514
|
-
});
|
|
10515
10450
|
});
|
|
10516
10451
|
this.wsClient.on("reconnecting", () => {
|
|
10517
10452
|
});
|
|
@@ -10519,11 +10454,6 @@ class NetworkLayer {
|
|
|
10519
10454
|
var _a, _b, _c, _d;
|
|
10520
10455
|
const message = error instanceof Error ? error.message : String(error);
|
|
10521
10456
|
logger.error("[NetworkLayer] WebSocket error:", message);
|
|
10522
|
-
logEvent("character_animation_service", "error", {
|
|
10523
|
-
avatar_id: this.dataController.getAvatarId(),
|
|
10524
|
-
event: "websocket_error",
|
|
10525
|
-
reason: message
|
|
10526
|
-
});
|
|
10527
10457
|
(_b = (_a = this.dataController).onConnectionState) == null ? void 0 : _b.call(_a, ConnectionState.failed);
|
|
10528
10458
|
(_d = (_c = this.dataController).onError) == null ? void 0 : _d.call(_c, error);
|
|
10529
10459
|
});
|
|
@@ -10544,11 +10474,6 @@ class NetworkLayer {
|
|
|
10544
10474
|
} catch (error) {
|
|
10545
10475
|
const message2 = error instanceof Error ? error.message : String(error);
|
|
10546
10476
|
logger.error("[NetworkLayer] Failed to handle message:", message2);
|
|
10547
|
-
logEvent("character_manager", "error", {
|
|
10548
|
-
avatar_id: this.dataController.getAvatarId(),
|
|
10549
|
-
event: "handle_message_failed",
|
|
10550
|
-
reason: message2
|
|
10551
|
-
});
|
|
10552
10477
|
}
|
|
10553
10478
|
}
|
|
10554
10479
|
handleAnimationMessage(message) {
|
package/dist/index.js
CHANGED
package/package.json
CHANGED