@7365admin1/layer-common 4.35.1-staging.413 → 4.35.1-staging.414

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 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.413",
5
+ "version": "4.35.1-staging.414",
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.",
@@ -180,6 +180,24 @@ export function writeLivePref(storage: Pick<Storage, "setItem"> | undefined, on:
180
180
  /** hls.js errors that mean "this browser cannot decode the codec", not "the camera is down". */
181
181
  const CODEC_ERRORS = new Set(["manifestIncompatibleCodecsError", "bufferAddCodecError", "bufferIncompatibleCodecsError"]);
182
182
 
183
+ /**
184
+ * hls.js live settings. The robot camera (EZVIZ via PadBot) serves plain HLS
185
+ * v3: 4 s segments, a 3-segment window, no LL-HLS parts. hls.js's default
186
+ * sits 3 segments (12 s) behind the newest picture and never catches up after
187
+ * a hiccup - the owner's "10-15 s delay". Now: 6 s behind (1.5 segments, so
188
+ * one late segment does not stall), play up to 1.2x to win back time lost to
189
+ * a hiccup, and jump forward if it ever falls 14 s behind.
190
+ * ponytail: a lower-latency protocol (FLV / WebRTC) is not offered by PadBot's
191
+ * §6.5 video API; ask PadBot if 6 s is still too slow.
192
+ */
193
+ export const LIVE_HLS_CONFIG = {
194
+ enableWorker: true,
195
+ lowLatencyMode: false,
196
+ liveSyncDuration: 6,
197
+ liveMaxLatencyDuration: 14,
198
+ maxLiveSyncPlaybackRate: 1.2,
199
+ } as const;
200
+
183
201
  /**
184
202
  * Plays one live-view URL into `video`. Returns a stop function that frees the
185
203
  * player and the connection.
@@ -286,7 +304,7 @@ export function startLivePlayer(
286
304
  video.addEventListener("error", noteDecode);
287
305
  let recoveries = 0;
288
306
  const Base = Hls.DefaultConfig?.loader;
289
- const h = (hls = new Hls({ enableWorker: true, lowLatencyMode: false, ...(Base ? { fLoader: strayAudLoader(Base) } : {}) }));
307
+ const h = (hls = new Hls({ ...LIVE_HLS_CONFIG, ...(Base ? { fLoader: strayAudLoader(Base) } : {}) }));
290
308
  h.on("hlsError", (_e, data) => {
291
309
  noteDecode();
292
310
  if (!data.fatal) return;