realtime-avatar 0.5.2 → 0.5.3

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/dist/express.js CHANGED
@@ -43,7 +43,7 @@ var RealtimeAvatarHttpError = class extends RealtimeAvatarError {
43
43
 
44
44
  // ../http-client/src/client.ts
45
45
  var DEFAULT_BASE_URL = "https://realtimeavatar.ai/api/v1";
46
- var SDK_VERSION = "0.5.2";
46
+ var SDK_VERSION = "0.5.3";
47
47
  var RealtimeAvatar = class {
48
48
  #apiKey;
49
49
  #baseUrl;
package/dist/hono.js CHANGED
@@ -43,7 +43,7 @@ var RealtimeAvatarHttpError = class extends RealtimeAvatarError {
43
43
 
44
44
  // ../http-client/src/client.ts
45
45
  var DEFAULT_BASE_URL = "https://realtimeavatar.ai/api/v1";
46
- var SDK_VERSION = "0.5.2";
46
+ var SDK_VERSION = "0.5.3";
47
47
  var RealtimeAvatar = class {
48
48
  #apiKey;
49
49
  #baseUrl;
package/dist/index.js CHANGED
@@ -43,7 +43,7 @@ var RealtimeAvatarHttpError = class extends RealtimeAvatarError {
43
43
 
44
44
  // ../http-client/src/client.ts
45
45
  var DEFAULT_BASE_URL = "https://realtimeavatar.ai/api/v1";
46
- var SDK_VERSION = "0.5.2";
46
+ var SDK_VERSION = "0.5.3";
47
47
  var RealtimeAvatar = class {
48
48
  #apiKey;
49
49
  #baseUrl;
package/dist/nextjs.js CHANGED
@@ -43,7 +43,7 @@ var RealtimeAvatarHttpError = class extends RealtimeAvatarError {
43
43
 
44
44
  // ../http-client/src/client.ts
45
45
  var DEFAULT_BASE_URL = "https://realtimeavatar.ai/api/v1";
46
- var SDK_VERSION = "0.5.2";
46
+ var SDK_VERSION = "0.5.3";
47
47
  var RealtimeAvatar = class {
48
48
  #apiKey;
49
49
  #baseUrl;
@@ -96,6 +96,18 @@ type AvatarVideoSurfaceProps = {
96
96
  * keeps the flat cushion.
97
97
  */
98
98
  adaptivePlayout?: boolean;
99
+ /**
100
+ * Called with the receiver playout depth (SECONDS) whenever it changes — the flat
101
+ * default while `adaptivePlayout` is off, the live value while it is on.
102
+ *
103
+ * Read this if anything you render is timed against the avatar's VOICE. The media rides
104
+ * the receiver buffer and a side channel (captions, a transcript reveal) does not, so it
105
+ * has to be held by the same amount or it arrives early — and once the depth moves, a
106
+ * hard-coded copy is wrong by however far the loop has descended. Web got this in 0.5.2;
107
+ * shipping `adaptivePlayout` here without it hands a native consumer the latency knob and
108
+ * no way to keep anything in sync with the voice it just un-buffered.
109
+ */
110
+ onPlayoutDelayChange?: (seconds: number) => void;
99
111
  /** Test id for the box. */
100
112
  testID?: string;
101
113
  };
@@ -897,11 +897,21 @@ function AvatarVideoSurface(props) {
897
897
  children,
898
898
  showLiveBadge = true,
899
899
  adaptivePlayout = false,
900
+ onPlayoutDelayChange,
900
901
  testID
901
902
  } = props;
902
903
  const { videoTrack, audioTrack } = useVoiceAssistant();
903
904
  useAvatarPlayoutDelay(videoTrack, audioTrack);
904
- useAvatarAdaptivePlayoutDelay(videoTrack, audioTrack, adaptivePlayout);
905
+ const playoutDelaySeconds = useAvatarAdaptivePlayoutDelay(
906
+ videoTrack,
907
+ audioTrack,
908
+ adaptivePlayout
909
+ );
910
+ const onPlayoutDelayChangeRef = useRef(onPlayoutDelayChange);
911
+ onPlayoutDelayChangeRef.current = onPlayoutDelayChange;
912
+ useEffect(() => {
913
+ onPlayoutDelayChangeRef.current?.(playoutDelaySeconds);
914
+ }, [playoutDelaySeconds]);
905
915
  const connectionState = useConnectionState();
906
916
  const connected = connectionState === ConnectionState.Connected;
907
917
  const trackProducing = useLiveTrackProducing(
package/dist/server.js CHANGED
@@ -43,7 +43,7 @@ var RealtimeAvatarHttpError = class extends RealtimeAvatarError {
43
43
 
44
44
  // ../http-client/src/client.ts
45
45
  var DEFAULT_BASE_URL = "https://realtimeavatar.ai/api/v1";
46
- var SDK_VERSION = "0.5.2";
46
+ var SDK_VERSION = "0.5.3";
47
47
  var RealtimeAvatar = class {
48
48
  #apiKey;
49
49
  #baseUrl;
@@ -43,7 +43,7 @@ var RealtimeAvatarHttpError = class extends RealtimeAvatarError {
43
43
 
44
44
  // ../http-client/src/client.ts
45
45
  var DEFAULT_BASE_URL = "https://realtimeavatar.ai/api/v1";
46
- var SDK_VERSION = "0.5.2";
46
+ var SDK_VERSION = "0.5.3";
47
47
  var RealtimeAvatar = class {
48
48
  #apiKey;
49
49
  #baseUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "realtime-avatar",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Realtime Avatar SDK. `realtime-avatar` and the route adapters hold your API key and are server-only; `realtime-avatar/react`, `/browser` and `/tools` never can — importing a server entry into a browser build throws at bundle time.",
5
5
  "license": "MIT",
6
6
  "author": "The Influence Company",