@spatius/avatarkit 1.2.0-beta.3 → 1.2.0

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,10 +5,10 @@ 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.3] - 2026-06-25
8
+ ## [1.2.0] - 2026-06-28
9
9
 
10
- ### Added
11
- - New `ErrorCode.unsupportedAvatarAsset`. When loading an avatar whose asset requires a newer SDK, the load now fails fast with this error (surfaced via the existing `AvatarError` / `onError` path) instead of rendering incorrectly, prompting an SDK upgrade.
10
+ ### Fixed
11
+ - Fixed the opening transition being dropped and a brief stutter at the start of the second and subsequent turns in a continuous conversation.
12
12
 
13
13
  ## [1.2.0-beta.2] - 2026-06-23
14
14
 
@@ -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-Dgung4xA.js";
4
+ import { A as APP_CONFIG, l as logger, e as errorToMessage, a as logEvent } from "./index-CZsHxG4F.js";
5
5
  class StreamingAudioPlayer {
6
6
  // Mark if AudioContext is being resumed, avoid concurrent resume requests
7
7
  constructor(options) {
@@ -195,7 +195,7 @@ class StreamingAudioPlayer {
195
195
  /**
196
196
  * Start new session (stop current and start fresh)
197
197
  */
198
- async startNewSession(audioChunks) {
198
+ async startNewSession(audioChunks, leadingSilenceMs = 0) {
199
199
  this.stop();
200
200
  this.sessionId = `session_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
201
201
  this.audioChunks = [];
@@ -205,8 +205,14 @@ class StreamingAudioPlayer {
205
205
  this.pausedAudioContextTime = 0;
206
206
  this.autoContinue = false;
207
207
  this.log("Starting new session", {
208
- chunks: audioChunks.length
208
+ chunks: audioChunks.length,
209
+ leadingSilenceMs
209
210
  });
211
+ if (leadingSilenceMs > 0) {
212
+ const silenceSamples = Math.floor(leadingSilenceMs / 1e3 * this.sampleRate) * this.channelCount;
213
+ const silencePcm = new Uint8Array(silenceSamples * 2);
214
+ this.addChunk(silencePcm, false);
215
+ }
210
216
  for (const chunk of audioChunks) {
211
217
  this.addChunk(chunk.data, chunk.isLast);
212
218
  }
@@ -525,14 +531,16 @@ class StreamingAudioPlayer {
525
531
  * Start playback manually (for delayed start scenarios)
526
532
  * This allows starting playback after transition animation completes
527
533
  */
528
- play() {
534
+ async play() {
529
535
  if (this.isPlaying) {
530
536
  return;
531
537
  }
532
538
  this.autoStartEnabled = true;
533
- this.startPlayback().catch((err) => {
539
+ try {
540
+ await this.startPlayback();
541
+ } catch (err) {
534
542
  logger.error("[StreamingAudioPlayer] Failed to start playback from play():", err);
535
- });
543
+ }
536
544
  }
537
545
  /**
538
546
  * Mark playback as ended