realtime-avatar 0.11.1 → 0.11.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/dist/{chunk-2TQVKQJJ.js → chunk-MJJ6GSAU.js} +1 -1
- package/dist/{chunk-X3XXLAJJ.js → chunk-SKXUGNEK.js} +1 -1
- package/dist/express.js +2 -2
- package/dist/hono.js +2 -2
- package/dist/index.js +1 -1
- package/dist/nextjs.js +2 -2
- package/dist/react-native.js +8 -6
- package/dist/react.js +9 -7
- package/dist/server.js +1 -1
- package/dist/tanstack-start.js +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RealtimeAvatar, isQueued, RealtimeAvatarHttpError } from './chunk-
|
|
1
|
+
import { RealtimeAvatar, isQueued, RealtimeAvatarHttpError } from './chunk-SKXUGNEK.js';
|
|
2
2
|
|
|
3
3
|
// ../proxy/src/config.ts
|
|
4
4
|
var json = (body, status = 200) => new Response(JSON.stringify(body), {
|
|
@@ -218,7 +218,7 @@ function isTransient(cause) {
|
|
|
218
218
|
|
|
219
219
|
// ../http-client/src/client.ts
|
|
220
220
|
var DEFAULT_BASE_URL = "https://realtimeavatar.ai/api/v1";
|
|
221
|
-
var SDK_VERSION = "0.11.
|
|
221
|
+
var SDK_VERSION = "0.11.2";
|
|
222
222
|
var RealtimeAvatar = class {
|
|
223
223
|
#apiKey;
|
|
224
224
|
#baseUrl;
|
package/dist/express.js
CHANGED
package/dist/hono.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, clipLibraryDeclarationSchema, isQueued, verifyTranscript } from './chunk-
|
|
1
|
+
export { RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, clipLibraryDeclarationSchema, isQueued, verifyTranscript } from './chunk-SKXUGNEK.js';
|
package/dist/nextjs.js
CHANGED
package/dist/react-native.js
CHANGED
|
@@ -837,9 +837,10 @@ var step = (g, s, nowMs, cfg = DEFAULT_GOVERNOR_CONFIG) => {
|
|
|
837
837
|
return { governor: g };
|
|
838
838
|
}
|
|
839
839
|
};
|
|
840
|
-
var resolveLowCapQuality = (declaredLayerQualities) => {
|
|
840
|
+
var resolveLowCapQuality = (declaredLayerQualities, failures = 0) => {
|
|
841
841
|
const sorted = [...declaredLayerQualities].sort((a, b) => a - b);
|
|
842
|
-
|
|
842
|
+
if (sorted.length < 2) return 1;
|
|
843
|
+
return failures >= 1 ? sorted[0] : sorted[sorted.length - 2];
|
|
843
844
|
};
|
|
844
845
|
|
|
845
846
|
// ../client/src/react/use-quality-governor.ts
|
|
@@ -959,10 +960,11 @@ function useAvatarQualityGovernor(input) {
|
|
|
959
960
|
return { freezeMs: 0, jitterRising: false };
|
|
960
961
|
}
|
|
961
962
|
};
|
|
962
|
-
const applyCap = (cap) => {
|
|
963
|
+
const applyCap = (cap, failures = 0) => {
|
|
963
964
|
try {
|
|
964
965
|
const lowCap = resolveLowCapQuality(
|
|
965
|
-
(targetPublication?.trackInfo?.layers ?? []).map((l) => l.quality)
|
|
966
|
+
(targetPublication?.trackInfo?.layers ?? []).map((l) => l.quality),
|
|
967
|
+
failures
|
|
966
968
|
);
|
|
967
969
|
targetPublication?.setVideoQuality?.(cap === "low" ? lowCap : VideoQuality.HIGH);
|
|
968
970
|
} catch {
|
|
@@ -987,13 +989,13 @@ function useAvatarQualityGovernor(input) {
|
|
|
987
989
|
pausedSinceTick = false;
|
|
988
990
|
const { governor, action } = step(gov, signal, Date.now(), config);
|
|
989
991
|
gov = governor;
|
|
990
|
-
if (action) applyCap(action.setCap);
|
|
992
|
+
if (action) applyCap(action.setCap, gov.failures);
|
|
991
993
|
} catch {
|
|
992
994
|
} finally {
|
|
993
995
|
tickRunning = false;
|
|
994
996
|
}
|
|
995
997
|
};
|
|
996
|
-
applyCap(gov.cap);
|
|
998
|
+
applyCap(gov.cap, gov.failures);
|
|
997
999
|
const handle = setInterval(() => void tick(), tickMs);
|
|
998
1000
|
return () => {
|
|
999
1001
|
disposed = true;
|
package/dist/react.js
CHANGED
|
@@ -1038,9 +1038,10 @@ var step = (g, s, nowMs, cfg = DEFAULT_GOVERNOR_CONFIG) => {
|
|
|
1038
1038
|
return { governor: g };
|
|
1039
1039
|
}
|
|
1040
1040
|
};
|
|
1041
|
-
var resolveLowCapQuality = (declaredLayerQualities) => {
|
|
1041
|
+
var resolveLowCapQuality = (declaredLayerQualities, failures = 0) => {
|
|
1042
1042
|
const sorted = [...declaredLayerQualities].sort((a, b) => a - b);
|
|
1043
|
-
|
|
1043
|
+
if (sorted.length < 2) return 1;
|
|
1044
|
+
return failures >= 1 ? sorted[0] : sorted[sorted.length - 2];
|
|
1044
1045
|
};
|
|
1045
1046
|
|
|
1046
1047
|
// ../client/src/react/use-quality-governor.ts
|
|
@@ -1160,10 +1161,11 @@ function useAvatarQualityGovernor(input) {
|
|
|
1160
1161
|
return { freezeMs: 0, jitterRising: false };
|
|
1161
1162
|
}
|
|
1162
1163
|
};
|
|
1163
|
-
const applyCap = (cap) => {
|
|
1164
|
+
const applyCap = (cap, failures = 0) => {
|
|
1164
1165
|
try {
|
|
1165
1166
|
const lowCap = resolveLowCapQuality(
|
|
1166
|
-
(targetPublication?.trackInfo?.layers ?? []).map((l) => l.quality)
|
|
1167
|
+
(targetPublication?.trackInfo?.layers ?? []).map((l) => l.quality),
|
|
1168
|
+
failures
|
|
1167
1169
|
);
|
|
1168
1170
|
targetPublication?.setVideoQuality?.(cap === "low" ? lowCap : VideoQuality.HIGH);
|
|
1169
1171
|
} catch {
|
|
@@ -1188,13 +1190,13 @@ function useAvatarQualityGovernor(input) {
|
|
|
1188
1190
|
pausedSinceTick = false;
|
|
1189
1191
|
const { governor, action } = step(gov, signal, Date.now(), config);
|
|
1190
1192
|
gov = governor;
|
|
1191
|
-
if (action) applyCap(action.setCap);
|
|
1193
|
+
if (action) applyCap(action.setCap, gov.failures);
|
|
1192
1194
|
} catch {
|
|
1193
1195
|
} finally {
|
|
1194
1196
|
tickRunning = false;
|
|
1195
1197
|
}
|
|
1196
1198
|
};
|
|
1197
|
-
applyCap(gov.cap);
|
|
1199
|
+
applyCap(gov.cap, gov.failures);
|
|
1198
1200
|
const handle = setInterval(() => void tick(), tickMs);
|
|
1199
1201
|
return () => {
|
|
1200
1202
|
disposed = true;
|
|
@@ -1476,7 +1478,7 @@ function isFrameFlowingAt(snapshot) {
|
|
|
1476
1478
|
}
|
|
1477
1479
|
function freezeMsFromFrameGap(gapMs) {
|
|
1478
1480
|
if (!Number.isFinite(gapMs) || gapMs <= AVATAR_FRAME_GAP_FREEZE_FLOOR_MS) return 0;
|
|
1479
|
-
return gapMs;
|
|
1481
|
+
return gapMs - AVATAR_FRAME_GAP_FREEZE_FLOOR_MS;
|
|
1480
1482
|
}
|
|
1481
1483
|
function isFrameFreezeInhibited(snapshot) {
|
|
1482
1484
|
return snapshot.hidden || snapshot.resumePending || !snapshot.trackProducing || !snapshot.seenFrame || snapshot.lastFrameAtMs === null;
|
package/dist/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, clipLibraryDeclarationSchema, isQueued, verifyTranscript } from './chunk-
|
|
1
|
+
export { RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, clipLibraryDeclarationSchema, isQueued, verifyTranscript } from './chunk-SKXUGNEK.js';
|
package/dist/tanstack-start.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "realtime-avatar",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.2",
|
|
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",
|