@sentinel-nvr/web 0.19.2 → 0.20.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.
@@ -1,4 +1,5 @@
1
1
  import {
2
+ GAP_SNAP_MS,
2
3
  PlayerController,
3
4
  SETTLE_CAP_MS,
4
5
  SETTLE_NEAR_MS,
@@ -9,15 +10,17 @@ import {
9
10
  SKIP_LIVE_EDGE_MS,
10
11
  WebRtcSession,
11
12
  carryClipIndex,
13
+ clipAt,
12
14
  mobileClient,
13
15
  rlog,
14
16
  setRlogClient,
15
17
  settleStart,
16
18
  settleStep,
17
19
  skipTarget
18
- } from "../chunk-7W5ORHOB.js";
20
+ } from "../chunk-ZQAVFNC2.js";
19
21
  import "../chunk-P7VKKFVA.js";
20
22
  export {
23
+ GAP_SNAP_MS,
21
24
  PlayerController,
22
25
  SETTLE_CAP_MS,
23
26
  SETTLE_NEAR_MS,
@@ -28,6 +31,7 @@ export {
28
31
  SKIP_LIVE_EDGE_MS,
29
32
  WebRtcSession,
30
33
  carryClipIndex,
34
+ clipAt,
31
35
  mobileClient,
32
36
  rlog,
33
37
  setRlogClient,
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { g as SentinelClient, m as SentinelEventClass, s as SentinelRecentEvent, f as SentinelCamera, k as SentinelEvent, w as SentinelStats, h as SentinelClip } from '../client-BZP21uB4.js';
4
- import { e as PlayerState } from '../controller-DwyUCzWR.js';
4
+ import { e as PlayerState } from '../controller-Ch_YXh1_.js';
5
5
 
6
6
  /**
7
7
  * Minimal translation core with the same dictionary semantics as HAPulse:
package/dist/ui/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PlayerController,
3
3
  rlog
4
- } from "../chunk-7W5ORHOB.js";
4
+ } from "../chunk-ZQAVFNC2.js";
5
5
  import {
6
6
  SENTINEL_CLASS_PRIORITY,
7
7
  SENTINEL_DAY_MS,
@@ -2277,6 +2277,7 @@ function CameraPage(p) {
2277
2277
  useEffect4(() => {
2278
2278
  ctl.current?.setClips(merged.clips, merged.codecs, merged.rangeStart, merged.rangeEnd);
2279
2279
  }, [merged]);
2280
+ const frameServer = useCallback3(() => Object.values(daysRef.current).some((d) => sentinelHasFeature(d, "frame")), []);
2280
2281
  const fetchDay = useCallback3(
2281
2282
  async (ds) => {
2282
2283
  const d = await client.getJson(
@@ -2360,16 +2361,20 @@ function CameraPage(p) {
2360
2361
  setClipEdge(null);
2361
2362
  setLoadError(false);
2362
2363
  loading.current.clear();
2363
- if (startAt) {
2364
- if (posterTs) c.posterEvent(posterTs);
2365
- } else {
2364
+ if (!startAt) {
2366
2365
  c.posterFromSnapshot(lastTileSnapshot(camId));
2367
2366
  c.goLive();
2368
2367
  }
2369
2368
  const t0 = todayStart();
2370
2369
  const target = startAt ? sentinelDayOf(startAt) : t0;
2370
+ const first = ensureDay(target);
2371
+ if (startAt && posterTs)
2372
+ first.then(() => {
2373
+ if (c.camId === camId && ctl.current === c) c.posterEvent(posterTs, frameServer() ? startAt : void 0);
2374
+ }).catch(() => {
2375
+ });
2371
2376
  Promise.all([
2372
- ensureDay(target),
2377
+ first,
2373
2378
  ensureDay(sentinelAddDays(target, -1)),
2374
2379
  target !== t0 ? ensureDay(t0) : Promise.resolve(),
2375
2380
  target === t0 ? Promise.resolve() : ensureDay(sentinelAddDays(target, 1))
@@ -2395,7 +2400,7 @@ function CameraPage(p) {
2395
2400
  deepRef.current = key;
2396
2401
  const c = ctl.current;
2397
2402
  c.freezeCurrent();
2398
- if (posterTs) c.posterEvent(posterTs);
2403
+ if (posterTs) c.posterEvent(posterTs, frameServer() ? startAt : void 0);
2399
2404
  goToDay(sentinelDayOf(startAt), startAt).catch(() => setLoadError(true));
2400
2405
  }, [startAt, posterTs]);
2401
2406
  useEffect4(() => {
@@ -2429,14 +2434,18 @@ function CameraPage(p) {
2429
2434
  ctl.current?.goLive();
2430
2435
  setJump({ ts: Date.now(), n: Date.now() });
2431
2436
  }, []);
2432
- const playEvent = useCallback3((ev) => {
2433
- const c = ctl.current;
2434
- if (!c) return;
2435
- setTab("tl");
2436
- c.freezeCurrent();
2437
- c.posterEvent(ev.timestamp);
2438
- c.playAt(sentinelEventPlayTs(ev), {});
2439
- }, []);
2437
+ const playEvent = useCallback3(
2438
+ (ev) => {
2439
+ const c = ctl.current;
2440
+ if (!c) return;
2441
+ setTab("tl");
2442
+ c.freezeCurrent();
2443
+ const start = sentinelEventPlayTs(ev);
2444
+ c.posterEvent(ev.timestamp, frameServer() ? start : void 0);
2445
+ c.playAt(start, {});
2446
+ },
2447
+ [frameServer]
2448
+ );
2440
2449
  const seekTo = useCallback3(
2441
2450
  (ts) => {
2442
2451
  const c = ctl.current;
@@ -2508,10 +2517,11 @@ function CameraPage(p) {
2508
2517
  const c = ctl.current;
2509
2518
  if (!c) return;
2510
2519
  c.freezeCurrent();
2511
- c.posterEvent(ev.timestamp);
2512
- c.playAt(Math.max(r.from, oldestRec ?? -Infinity), {});
2520
+ const start = Math.max(r.from, oldestRec ?? -Infinity);
2521
+ c.posterEvent(ev.timestamp, frameServer() ? start : void 0);
2522
+ c.playAt(start, {});
2513
2523
  },
2514
- [oldestRec]
2524
+ [oldestRec, frameServer]
2515
2525
  );
2516
2526
  const closeClip = useCallback3(() => {
2517
2527
  setClip(null);