@7365admin1/layer-common 4.35.1-staging.408 → 4.35.1-staging.409
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/package.json +1 -1
- package/utils/robot-control.ts +14 -4
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.35.1-staging.
|
|
5
|
+
"version": "4.35.1-staging.409",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|
package/utils/robot-control.ts
CHANGED
|
@@ -27,11 +27,18 @@ export function liveVideoKind(url: unknown): TVideoKind {
|
|
|
27
27
|
return "page";
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* When to ask for a fresh URL: 30 s before it expires. Null (no scheduled
|
|
32
|
+
* re-mint - the stream's own failure re-mints, with capped backoff) when the
|
|
33
|
+
* expiry is missing, has no time zone, or is under a minute away. PadBot sent
|
|
34
|
+
* "2026-09-26 16:26:02" (no zone): read as local time it was already past, so
|
|
35
|
+
* the old 5 s floor re-minted every ~6 s forever, silently (prod 2026-09-26).
|
|
36
|
+
*/
|
|
31
37
|
export function remintDelayMs(expiresAt: unknown, now: number = Date.now()): number | null {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
if (typeof expiresAt !== "string" || !/(Z|[+-]\d\d:?\d\d)$/i.test(expiresAt.trim())) return null;
|
|
39
|
+
const t = Date.parse(expiresAt);
|
|
40
|
+
if (!Number.isFinite(t) || t - now < 60_000) return null;
|
|
41
|
+
return Math.max(30_000, t - now - 30_000);
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
export const LIVE_NO_PICTURE =
|
|
@@ -199,6 +206,9 @@ export function startLivePlayer(
|
|
|
199
206
|
};
|
|
200
207
|
// ponytail: one 1 s poll instead of juggling media events - videoWidth has no reliable event everywhere.
|
|
201
208
|
const tick = setInterval(() => {
|
|
209
|
+
// A hidden page gets no frames painted (and Chrome pauses muted background
|
|
210
|
+
// video): not the camera's fault, so the watchdogs don't count it.
|
|
211
|
+
if (typeof document !== "undefined" && document.visibilityState === "hidden") return;
|
|
202
212
|
waited += tickMs;
|
|
203
213
|
if (!pictured) {
|
|
204
214
|
if (video.videoWidth > 0) {
|