@sentinel-nvr/web 0.15.0 → 0.16.1

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/README.md CHANGED
@@ -36,6 +36,7 @@ on older servers, but only get their full behaviour with the matching plugin ver
36
36
  | 0.13.x | any (smaller pictures: ≥ 1.2.0; older plugins ignore `w=` and send full-size snapshots) | opening a camera: the tile's loaded picture is the poster at once (tiles load with `crossOrigin="anonymous"`, `rememberTileSnapshot` exported for host cards), live starts without waiting for the day loads (a failed load no longer blocks it), tiles ask for `api/snapshot&w=640/960`, the fresh poster for 1280. 0.13.1: an MJPEG fallback taken before the codec was known switches to MSE-live once the day loads bring it — client only. |
37
37
  | 0.14.x | any | Picture-in-Picture note + "Open in Safari" in iPhone/iPad Home-Screen apps (Apple blocks PiP there); `PlayerController.pip()` resolves its outcome. Client only. |
38
38
  | 0.15.x | any (priority order from the server: ≥ 1.3.0; older servers are sorted client-side) | event classes by priority (a cyclist is a person), class filters hide an event only when all its classes are off, chips count every contained class — client only. |
39
+ | 0.16.x | any (spans: ≥ 1.3.0) | events as time spans: bar from first sighting to last movement on the timeline, running events pulse, duration/„running“ in the list (`endTs`/`open`); older servers show plain markers. |
39
40
 
40
41
  Lab note: Scrypted's WebRTC sink re-encodes (1280 px, 15 fps) for clients that are not Windows/macOS/iOS and report a
41
42
  screen below 1920 physical pixels, unless the source declares a width ≤ 1280. Plugin ≥ 1.2.0 declares it for recorded
@@ -1,4 +1,4 @@
1
- export { S as SENTINEL_CLASS_PRIORITY, a as SENTINEL_DAY_MS, b as SENTINEL_ENDPOINT_PATH, c as SENTINEL_EVENT_CLASSES, d as SentinelBox, e as SentinelCamera, f as SentinelClient, g as SentinelClip, h as SentinelClipsResponse, i as SentinelEvent, j as SentinelEventBox, k as SentinelEventClass, l as SentinelHttpError, m as SentinelRecentEvent, n as SentinelRun, o as SentinelSetup, p as SentinelStats, q as SentinelStorageForecast, r as SentinelStorageStatus, s as exchangeSentinelToken, t as parseSentinelSetup, u as sentinelAddDays, v as sentinelAtTime, w as sentinelClassOf, x as sentinelClassesOf, y as sentinelClipIndexFor, z as sentinelClipRuns, A as sentinelDayEnd, B as sentinelDayOf, C as sentinelEntryUrl, D as sentinelEventHidden, E as sentinelEventPlayTs, F as sentinelHumanBytes, G as sentinelLoginBase, H as sentinelMergeDays, I as sentinelPublicBase, J as sentinelStorageForecast, K as sentinelTimelineLink, L as sentinelUrl, M as sentinelWallMarks, N as sentinelWallSeconds, O as timeoutSignal } from '../client-au18O0ne.js';
1
+ export { S as SENTINEL_CLASS_PRIORITY, a as SENTINEL_DAY_MS, b as SENTINEL_ENDPOINT_PATH, c as SENTINEL_EVENT_CLASSES, d as SENTINEL_MIN_SPAN_MS, e as SentinelBox, f as SentinelCamera, g as SentinelClient, h as SentinelClip, i as SentinelClipsResponse, j as SentinelEvent, k as SentinelEventBox, l as SentinelEventClass, m as SentinelHttpError, n as SentinelRecentEvent, o as SentinelRun, p as SentinelSetup, q as SentinelStats, r as SentinelStorageForecast, s as SentinelStorageStatus, t as exchangeSentinelToken, u as parseSentinelSetup, v as sentinelAddDays, w as sentinelAtTime, x as sentinelClassOf, y as sentinelClassesOf, z as sentinelClipIndexFor, A as sentinelClipRuns, B as sentinelDayEnd, C as sentinelDayOf, D as sentinelDuration, E as sentinelEntryUrl, F as sentinelEventHidden, G as sentinelEventPlayTs, H as sentinelEventSpan, I as sentinelHumanBytes, J as sentinelLoginBase, K as sentinelMergeDays, L as sentinelPublicBase, M as sentinelStorageForecast, N as sentinelTimelineLink, O as sentinelUrl, P as sentinelWallMarks, Q as sentinelWallSeconds, R as timeoutSignal } from '../client-DS5wDfMN.js';
2
2
 
3
3
  /**
4
4
  * Locale-aware, translation-free formatting (Intl only). Word-dependent helpers
package/dist/api/index.js CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  SENTINEL_DAY_MS,
4
4
  SENTINEL_ENDPOINT_PATH,
5
5
  SENTINEL_EVENT_CLASSES,
6
+ SENTINEL_MIN_SPAN_MS,
6
7
  SentinelClient,
7
8
  SentinelHttpError,
8
9
  exchangeSentinelToken,
@@ -20,9 +21,11 @@ import {
20
21
  sentinelClipRuns,
21
22
  sentinelDayEnd,
22
23
  sentinelDayOf,
24
+ sentinelDuration,
23
25
  sentinelEntryUrl,
24
26
  sentinelEventHidden,
25
27
  sentinelEventPlayTs,
28
+ sentinelEventSpan,
26
29
  sentinelHumanBytes,
27
30
  sentinelLoginBase,
28
31
  sentinelMergeDays,
@@ -34,12 +37,13 @@ import {
34
37
  sentinelWallSeconds,
35
38
  timeoutSignal,
36
39
  weekdayShorts
37
- } from "../chunk-7EXBV2ZE.js";
40
+ } from "../chunk-Y4WFO6G3.js";
38
41
  export {
39
42
  SENTINEL_CLASS_PRIORITY,
40
43
  SENTINEL_DAY_MS,
41
44
  SENTINEL_ENDPOINT_PATH,
42
45
  SENTINEL_EVENT_CLASSES,
46
+ SENTINEL_MIN_SPAN_MS,
43
47
  SentinelClient,
44
48
  SentinelHttpError,
45
49
  exchangeSentinelToken,
@@ -57,9 +61,11 @@ export {
57
61
  sentinelClipRuns,
58
62
  sentinelDayEnd,
59
63
  sentinelDayOf,
64
+ sentinelDuration,
60
65
  sentinelEntryUrl,
61
66
  sentinelEventHidden,
62
67
  sentinelEventPlayTs,
68
+ sentinelEventSpan,
63
69
  sentinelHumanBytes,
64
70
  sentinelLoginBase,
65
71
  sentinelMergeDays,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  timeoutSignal
3
- } from "./chunk-7EXBV2ZE.js";
3
+ } from "./chunk-Y4WFO6G3.js";
4
4
 
5
5
  // src/player/rlog.ts
6
6
  var brand = "web";
@@ -322,6 +322,29 @@ function skipTarget(live, currentTs, ms, now) {
322
322
  return ts;
323
323
  }
324
324
 
325
+ // src/player/settle.ts
326
+ var SETTLE_NEAR_MS = 5e3;
327
+ var SETTLE_V_MIN = 0.5;
328
+ var SETTLE_V_MAX = 2;
329
+ var SETTLE_STALL_MS = 3e3;
330
+ var SETTLE_PROGRESS_MS = 1e3;
331
+ var SETTLE_CAP_MS = 3e4;
332
+ function settleStart(pos, target, now) {
333
+ return { t0: now, best: Math.abs(pos - target), bestAt: now };
334
+ }
335
+ function settleStep(s, x, target, now) {
336
+ const d = Math.abs(x.pos - target);
337
+ const v = x.prev && x.at > x.prev.at ? (x.pos - x.prev.pos) / (x.at - x.prev.at) : null;
338
+ if (d <= SETTLE_NEAR_MS && (x.r == null || x.r === 1) && v != null && v >= SETTLE_V_MIN && v <= SETTLE_V_MAX)
339
+ return "arrived";
340
+ if (d <= s.best - SETTLE_PROGRESS_MS) {
341
+ s.best = d;
342
+ s.bestAt = now;
343
+ } else if (d > s.best) s.best = d;
344
+ if (now - s.t0 >= SETTLE_CAP_MS || now - s.bestAt >= SETTLE_STALL_MS) return "giveup";
345
+ return "wait";
346
+ }
347
+
325
348
  // src/player/controller.ts
326
349
  var MSCls = window.ManagedMediaSource || window.MediaSource;
327
350
  var SWAP_MS = 2600;
@@ -329,6 +352,7 @@ var MARK_CAP_MS = 12e3;
329
352
  var LIFT_FRAMES = 2;
330
353
  var LIFT_FADE_MS = 120;
331
354
  var SCRUB_OFF_DELAY_MS = 1500;
355
+ var SETTLE_CHECK_MS = 250;
332
356
  var TARGET_FLOOR_MS = 120;
333
357
  var TARGET_MIN_STEP_MS = 250;
334
358
  var POSTER_SNAPSHOT_W = 1280;
@@ -400,6 +424,9 @@ var PlayerController = class {
400
424
  // position for a moment after a seek — ignore far-off values in that window.
401
425
  cmdSeq = 0;
402
426
  seekAt = 0;
427
+ /** the last relay-pos answers as they came (picture position, server rate, the answer before in the same command
428
+ * generation) — the end of a scrub gesture waits for the picture to play at 1× at the target (settle.ts) */
429
+ rwPoll = null;
403
430
  // live session (W) + live MSE (L)
404
431
  w;
405
432
  L = {
@@ -1418,6 +1445,7 @@ var PlayerController = class {
1418
1445
  this.rw = void 0;
1419
1446
  this.rwBase = null;
1420
1447
  this.rwPosTs = null;
1448
+ this.rwPoll = null;
1421
1449
  this.rwScrub = false;
1422
1450
  this.rwSeekBusy = false;
1423
1451
  this.rwPending = null;
@@ -1673,10 +1701,10 @@ var PlayerController = class {
1673
1701
  const s = this.rw;
1674
1702
  if (!s?.active || !s.id) return;
1675
1703
  if (this.rwScrub === on && !(force && !on)) return;
1704
+ const c = this.currentTs();
1676
1705
  this.rwScrub = on;
1677
1706
  this.cmdSeq++;
1678
1707
  if (!on) {
1679
- const c = this.currentTs();
1680
1708
  this.rwSrate = 1;
1681
1709
  this.rwRate = this.rate;
1682
1710
  if (c != null) {
@@ -1777,6 +1805,14 @@ var PlayerController = class {
1777
1805
  this.wdDead = 0;
1778
1806
  this.rwPosTs = d.t;
1779
1807
  this.rwPosAt = Date.now();
1808
+ const P = this.rwPoll;
1809
+ this.rwPoll = {
1810
+ t: d.t,
1811
+ at: this.rwPosAt,
1812
+ r: typeof d.r === "number" && isFinite(d.r) ? d.r : null,
1813
+ seq,
1814
+ prev: P && P.seq === seq ? { pos: P.t, at: P.at } : null
1815
+ };
1780
1816
  if ((this.rwScrub || this.scrubMoves > 0) && typeof d.r === "number" && isFinite(d.r) && d.r)
1781
1817
  this.rwRate = d.r;
1782
1818
  this.emit();
@@ -2425,8 +2461,9 @@ var PlayerController = class {
2425
2461
  }
2426
2462
  }
2427
2463
  }
2428
- /** true between the end of a gesture and the profile switch back (SCRUB_OFF_DELAY_MS): the timeline must not auto-follow
2429
- * the playhead in that window — the servo is still converging on the centre the user left */
2464
+ /** true between the end of a gesture and the profile switch back (SCRUB_OFF_DELAY_MS, on the relay until the picture has
2465
+ * reached the target): the timeline must not auto-follow the playhead in that window — the servo is still converging on
2466
+ * the centre the user left, and the timeline stays parked there */
2430
2467
  scrubSettling() {
2431
2468
  return this.scrubOffT !== 0;
2432
2469
  }
@@ -2459,16 +2496,49 @@ var PlayerController = class {
2459
2496
  if (!this.rw?.active) this.scrubSeek(ts);
2460
2497
  else if (this.rw.id) this.recRelayTarget(this.clampRange(ts));
2461
2498
  }
2462
- /** gesture settled → final target, then back to the normal profile after SCRUB_OFF_DELAY_MS of quiet (a new gesture cancels it) */
2499
+ /** gesture settled → final target, then back to the normal profile after SCRUB_OFF_DELAY_MS of quiet (a new gesture cancels
2500
+ * it). A steered relay gesture keeps its target until the picture has arrived (settle.ts): the server steers on in the
2501
+ * scrub profile and scrubSettling() keeps the timeline parked on the centre the user left. */
2463
2502
  scrubIdle(ts) {
2464
2503
  if (ts != null && this.rw?.active && this.rw.id && this.scrubMoves > 0) this.recRelayTarget(this.clampRange(ts));
2465
2504
  if (this.scrubOffT) clearTimeout(this.scrubOffT);
2466
- this.scrubOffT = window.setTimeout(() => {
2467
- this.scrubOffT = 0;
2505
+ const s = this.rw, idleAt = Date.now();
2506
+ let track = null;
2507
+ const off = () => {
2468
2508
  const steered = this.scrubMoves > 0;
2469
- this.scrubMoves = 0;
2509
+ if (steered && s?.active && s.id && this.rw === s) {
2510
+ const now = Date.now();
2511
+ const P = this.rwPoll, target = this.rwLastTarget;
2512
+ let st;
2513
+ if (!P || !target) st = "none";
2514
+ else if (this.rwTargetBusy || this.rwPendingTarget != null)
2515
+ st = "wait";
2516
+ else
2517
+ st = settleStep(
2518
+ track ??= settleStart(P.t, target, now),
2519
+ { pos: P.t, at: P.at, r: P.r, prev: P.prev },
2520
+ target,
2521
+ now
2522
+ );
2523
+ if (st === "wait") {
2524
+ if (now - idleAt < SCRUB_OFF_DELAY_MS + SETTLE_CAP_MS) {
2525
+ this.scrubOffT = window.setTimeout(off, SETTLE_CHECK_MS);
2526
+ return;
2527
+ }
2528
+ st = "giveup";
2529
+ }
2530
+ if (st !== "arrived" || now - idleAt > SCRUB_OFF_DELAY_MS + SETTLE_CHECK_MS)
2531
+ rlog("settle", {
2532
+ how: st,
2533
+ ms: now - idleAt,
2534
+ dSec: P && target ? Math.round((P.t - target) / 100) / 10 : null
2535
+ });
2536
+ }
2537
+ this.scrubOffT = 0;
2470
2538
  this.recRelayScrub(false, steered);
2471
- }, SCRUB_OFF_DELAY_MS);
2539
+ this.scrubMoves = 0;
2540
+ };
2541
+ this.scrubOffT = window.setTimeout(off, SCRUB_OFF_DELAY_MS);
2472
2542
  }
2473
2543
  // ---- visibility ---------------------------------------------------------------------------
2474
2544
  hiddenTs = null;
@@ -2508,6 +2578,14 @@ export {
2508
2578
  WebRtcSession,
2509
2579
  SKIP_LIVE_EDGE_MS,
2510
2580
  skipTarget,
2581
+ SETTLE_NEAR_MS,
2582
+ SETTLE_V_MIN,
2583
+ SETTLE_V_MAX,
2584
+ SETTLE_STALL_MS,
2585
+ SETTLE_PROGRESS_MS,
2586
+ SETTLE_CAP_MS,
2587
+ settleStart,
2588
+ settleStep,
2511
2589
  PlayerController
2512
2590
  };
2513
- //# sourceMappingURL=chunk-4RUVCMQ6.js.map
2591
+ //# sourceMappingURL=chunk-JRYP7MG6.js.map