@sentinel-nvr/web 0.5.5 → 0.6.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.
@@ -266,6 +266,10 @@ var WebRtcSession = class {
266
266
 
267
267
  // src/player/controller.ts
268
268
  var MSCls = window.ManagedMediaSource || window.MediaSource;
269
+ var SWAP_MS = 2600;
270
+ var SCRUB_OFF_DELAY_MS = 1500;
271
+ var SCRUB_HOLD_SEEK_MS = 4500;
272
+ var SCRUB_LAND_MS = 5e3;
269
273
  var PlayerController = class {
270
274
  v;
271
275
  fz;
@@ -312,6 +316,12 @@ var PlayerController = class {
312
316
  recoveries = 0;
313
317
  posterUntilSeek = false;
314
318
  seekTarget = 0;
319
+ // seek → visible swap (see SWAP_MS); posterFor = event the pending poster belongs to; scrubOffT = delayed profile switch
320
+ swapPending = false;
321
+ swapFrames = -1;
322
+ swapT = 0;
323
+ posterFor = 0;
324
+ scrubOffT = 0;
315
325
  // relay-pos answers are only valid for the command generation they were asked under; a poll sent BEFORE a
316
326
  // seek/rate change and answered after it would drag the playhead back to the old position (and the
317
327
  // auto-follow timeline with it → visible back-and-forth). seekAt: the server may still report the pre-swap
@@ -577,19 +587,61 @@ var PlayerController = class {
577
587
  }
578
588
  }
579
589
  }
590
+ /** copy the current video picture onto the freeze canvas (false = nothing to copy yet) */
591
+ drawVideo() {
592
+ const v = this.v, fc = this.fz;
593
+ if (!v.videoWidth || !v.videoHeight || v.readyState < 2) return false;
594
+ if (fc.width !== v.videoWidth) fc.width = v.videoWidth;
595
+ if (fc.height !== v.videoHeight) fc.height = v.videoHeight;
596
+ fc.getContext("2d").drawImage(v, 0, 0, fc.width, fc.height);
597
+ fc.classList.remove("hidden");
598
+ fc.dataset.src = "video";
599
+ return true;
600
+ }
580
601
  freezeShow(hold = false) {
581
602
  try {
582
- const v = this.v, fc = this.fz;
583
- if (!v.videoWidth || !v.videoHeight || v.readyState < 2) return;
584
- if (fc.width !== v.videoWidth) fc.width = v.videoWidth;
585
- if (fc.height !== v.videoHeight) fc.height = v.videoHeight;
586
- fc.getContext("2d").drawImage(v, 0, 0, fc.width, fc.height);
587
- fc.classList.remove("hidden");
588
- fc.dataset.src = "video";
589
- this.freezeArm(hold);
603
+ if (this.drawVideo()) this.freezeArm(hold);
604
+ } catch {
605
+ }
606
+ }
607
+ /** poster/freeze stays until the seek's picture is visible (swapVisible), 6 s safety net */
608
+ holdUntilSwap() {
609
+ if (this.freezeT) clearTimeout(this.freezeT);
610
+ this.freezeTok = null;
611
+ this.posterUntilSeek = true;
612
+ this.freezeT = window.setTimeout(() => this.swapVisible(), 6e3);
613
+ }
614
+ /** Event click inside a running relay session: the current picture stands still at once (the old position must not keep
615
+ * playing while the event frame loads); the event frame replaces it, the picture at the target lifts it. */
616
+ freezeCurrent() {
617
+ if (!this.rw?.active || !this.rw.id) return;
618
+ try {
619
+ if (this.drawVideo()) this.holdUntilSwap();
590
620
  } catch {
591
621
  }
592
622
  }
623
+ /** the picture of the last seek is on screen: lift a held poster, report playing */
624
+ swapVisible() {
625
+ if (this.swapT) {
626
+ clearTimeout(this.swapT);
627
+ this.swapT = 0;
628
+ }
629
+ this.swapPending = false;
630
+ if (this.posterUntilSeek) this.freezeHide();
631
+ if (this.label === "loading" && this.rw?.active) this.setLabel("playing");
632
+ }
633
+ /** seek answered: the new picture is on screen SWAP_MS later (plus proof of a presented frame) */
634
+ swapArm() {
635
+ if (this.swapT) clearTimeout(this.swapT);
636
+ this.swapFrames = this.presentedFrames();
637
+ const check = () => {
638
+ this.swapT = 0;
639
+ if (!this.swapPending || !this.rw?.active) return;
640
+ if (this.presentedFrames() > this.swapFrames) this.swapVisible();
641
+ else this.swapT = window.setTimeout(check, 100);
642
+ };
643
+ this.swapT = window.setTimeout(check, SWAP_MS);
644
+ }
593
645
  freezeFromImage(img, hold, untilSeek = false, kind = "image") {
594
646
  try {
595
647
  if (!img.naturalWidth || !img.naturalHeight) return false;
@@ -600,12 +652,8 @@ var PlayerController = class {
600
652
  fc.classList.remove("hidden");
601
653
  fc.dataset.src = kind;
602
654
  this.setAspect(img.naturalWidth, img.naturalHeight);
603
- if (untilSeek) {
604
- if (this.freezeT) clearTimeout(this.freezeT);
605
- this.freezeTok = null;
606
- this.posterUntilSeek = true;
607
- this.freezeT = window.setTimeout(() => this.freezeHide(), 6e3);
608
- } else this.freezeArm(hold);
655
+ if (untilSeek) this.holdUntilSwap();
656
+ else this.freezeArm(hold);
609
657
  return true;
610
658
  } catch {
611
659
  return false;
@@ -632,11 +680,14 @@ var PlayerController = class {
632
680
  /** Event click: the stored frame is the poster until the seek lands. */
633
681
  posterEvent(ts) {
634
682
  const cam = this.camId;
683
+ this.posterFor = ts;
635
684
  const img = new Image();
636
685
  img.crossOrigin = "anonymous";
637
686
  img.onload = () => {
638
- if (this.camId !== cam) return;
639
- this.freezeFromImage(img, true, !!this.rw?.active && !!this.rw.id, "event");
687
+ if (this.camId !== cam || this.posterFor !== ts || this.destroyed) return;
688
+ const inSession = !!this.rw?.active && !!this.rw.id;
689
+ if (inSession && !this.swapPending) return;
690
+ this.freezeFromImage(img, true, inSession, "event");
640
691
  };
641
692
  img.src = this.api.url(`api/evframe?camera=${encodeURIComponent(cam)}&ts=${ts}`);
642
693
  }
@@ -947,6 +998,15 @@ var PlayerController = class {
947
998
  }
948
999
  recWebrtcTeardown() {
949
1000
  this.posterUntilSeek = false;
1001
+ this.swapPending = false;
1002
+ if (this.swapT) {
1003
+ clearTimeout(this.swapT);
1004
+ this.swapT = 0;
1005
+ }
1006
+ if (this.scrubOffT) {
1007
+ clearTimeout(this.scrubOffT);
1008
+ this.scrubOffT = 0;
1009
+ }
950
1010
  this.stopRelayPoll();
951
1011
  this.rw?.stop();
952
1012
  this.rw = void 0;
@@ -1084,17 +1144,23 @@ var PlayerController = class {
1084
1144
  this.wdGrace = Date.now() + 5e3;
1085
1145
  this.rwPosTs = ts;
1086
1146
  this.rwPosAt = Date.now();
1087
- this.setLabel("loading");
1147
+ this.setLabel(this.rwScrub ? "scrub" : "loading");
1088
1148
  this.rwSeekBusy = true;
1089
1149
  this.seekTarget = ts;
1090
1150
  this.seekAt = Date.now();
1091
1151
  this.cmdSeq++;
1152
+ this.swapPending = true;
1153
+ if (this.swapT) {
1154
+ clearTimeout(this.swapT);
1155
+ this.swapT = 0;
1156
+ }
1092
1157
  const done = (ok) => {
1093
1158
  this.rwSeekBusy = false;
1094
1159
  if (!ok) {
1095
1160
  this.relayRecover();
1096
1161
  return;
1097
1162
  }
1163
+ if (this.swapPending) this.swapArm();
1098
1164
  const p = this.rwPending;
1099
1165
  this.rwPending = null;
1100
1166
  if (p && this.rw?.id) this.recRelaySeek(p.ts, p.rate, p.srate);
@@ -1158,6 +1224,7 @@ var PlayerController = class {
1158
1224
  this.rwPosTs = c;
1159
1225
  this.rwPosAt = Date.now();
1160
1226
  }
1227
+ if (this.label === "scrub") this.setLabel("playing");
1161
1228
  }
1162
1229
  this.wdLastCt = -1;
1163
1230
  this.wdLastAt = Date.now();
@@ -1204,7 +1271,7 @@ var PlayerController = class {
1204
1271
  this.wdLastAt = Date.now();
1205
1272
  this.recoveries = 0;
1206
1273
  if (!this.posterUntilSeek) this.freezeHide();
1207
- if (this.label === "loading") this.setLabel("playing");
1274
+ if (this.label === "loading" && !this.swapPending) this.setLabel("playing");
1208
1275
  } else if (this.rwScrub) this.wdLastAt = Date.now();
1209
1276
  else if (Date.now() - this.wdLastAt > 4e3 && Date.now() > this.wdGrace) {
1210
1277
  this.wdLastAt = Date.now();
@@ -1239,7 +1306,6 @@ var PlayerController = class {
1239
1306
  this.wdDead = 0;
1240
1307
  this.rwPosTs = d.t;
1241
1308
  this.rwPosAt = Date.now();
1242
- if (this.posterUntilSeek && Math.abs(d.t - this.seekTarget) < 4e3 && !this.rwSeekBusy && !this.rwPending) this.freezeHide();
1243
1309
  this.emit();
1244
1310
  } else if (d && d.t <= 0) {
1245
1311
  if (++this.wdDead >= 3) {
@@ -1823,6 +1889,10 @@ var PlayerController = class {
1823
1889
  /** first gesture: scrub profile on (relay); MSE: freeze + pause */
1824
1890
  scrubBegin() {
1825
1891
  this.chaseAbort();
1892
+ if (this.scrubOffT) {
1893
+ clearTimeout(this.scrubOffT);
1894
+ this.scrubOffT = 0;
1895
+ }
1826
1896
  if (!this.rw?.active) {
1827
1897
  this.freezeShow();
1828
1898
  if (!this.live) {
@@ -1832,7 +1902,6 @@ var PlayerController = class {
1832
1902
  }
1833
1903
  }
1834
1904
  }
1835
- this.recRelayScrub(true);
1836
1905
  }
1837
1906
  /** scroll position + velocity (timeline-ms per wall-s) while the gesture runs */
1838
1907
  scrubMove(_centerTs, vel, smoothTs) {
@@ -1845,6 +1914,7 @@ var PlayerController = class {
1845
1914
  if (Math.abs(r) < 0.1) return;
1846
1915
  r = Math.min(3e3, Math.max(-3e3, r));
1847
1916
  r = Math.abs(r) >= 10 ? Math.round(r) : Math.round(r * 10) / 10;
1917
+ this.recRelayScrub(true);
1848
1918
  const tgt = this.clampRange(smoothTs), cur = this.currentTs();
1849
1919
  const drift = cur == null ? null : tgt - cur;
1850
1920
  if (drift == null || Math.abs(drift) > Math.max(4500, 1200 * Math.abs(r))) this.scrubSeek(tgt, r);
@@ -1858,9 +1928,44 @@ var PlayerController = class {
1858
1928
  }
1859
1929
  this.playAt(this.clampRange(ts), { scrub: true, srate });
1860
1930
  }
1861
- /** gesture settled → normal profile, base rate */
1862
- scrubIdle() {
1863
- this.recRelayScrub(false);
1931
+ /** true between the end of a gesture and its landing/profile switch (SCRUB_OFF_DELAY_MS): the timeline must not auto-follow
1932
+ * the playhead in that window — the time-lapse overshot the centre, following would drag the view away and the landing
1933
+ * seek would drag it back (visible back-and-forth of the timeline itself) */
1934
+ scrubSettling() {
1935
+ return this.scrubOffT !== 0;
1936
+ }
1937
+ /** drift between the timeline centre and the playhead (null without a position) */
1938
+ scrubDrift(ts) {
1939
+ const c = this.currentTs();
1940
+ return c == null ? null : this.clampRange(ts) - c;
1941
+ }
1942
+ /** brief hold mid-gesture (relay): time-lapse → 1× in place; a seek only when the picture is far off (each seek = ~2.4 s
1943
+ * of stale stream before the new picture — a seek per wheel step made the picture run back and forth). MSE: preview seek. */
1944
+ scrubHold(ts) {
1945
+ if (!this.rw?.active) {
1946
+ this.scrubSeek(ts);
1947
+ return;
1948
+ }
1949
+ if (!this.rw.id) return;
1950
+ const d = this.scrubDrift(ts);
1951
+ if (d == null || Math.abs(d) > Math.max(SCRUB_HOLD_SEEK_MS, 1200 * Math.abs(this.rwRate))) {
1952
+ this.scrubSeek(ts, 1);
1953
+ return;
1954
+ }
1955
+ if (this.rwScrub && this.rwSrate !== 1) this.recRelayRate(1);
1956
+ }
1957
+ /** gesture settled → after SCRUB_OFF_DELAY_MS of quiet (a new gesture cancels it): land exactly on the centre if the
1958
+ * time-lapse drifted, then back to the normal profile. Landing per pause would be a seek per wheel step again. */
1959
+ scrubIdle(ts) {
1960
+ if (this.scrubOffT) clearTimeout(this.scrubOffT);
1961
+ this.scrubOffT = window.setTimeout(() => {
1962
+ this.scrubOffT = 0;
1963
+ if (ts != null && this.rw?.active && this.rw.id) {
1964
+ const d = this.scrubDrift(ts);
1965
+ if (d != null && Math.abs(d) > SCRUB_LAND_MS) this.scrubSeek(ts, 1);
1966
+ }
1967
+ this.recRelayScrub(false);
1968
+ }, SCRUB_OFF_DELAY_MS);
1864
1969
  }
1865
1970
  // ---- visibility ---------------------------------------------------------------------------
1866
1971
  hiddenTs = null;
@@ -1894,4 +1999,4 @@ export {
1894
1999
  WebRtcSession,
1895
2000
  PlayerController
1896
2001
  };
1897
- //# sourceMappingURL=chunk-VHZTAIPQ.js.map
2002
+ //# sourceMappingURL=chunk-2AXKPVPR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/player/rlog.ts","../src/player/webrtc.ts","../src/player/controller.ts"],"sourcesContent":["/**\n * Client telemetry → the plugin's `api/clientlog` → its server log as `[client]`\n * lines (phones have no console; this is how playback problems on a device get\n * diagnosed). `brand` tags which host emitted the line (e.g. 'sentinel', 'hapulse').\n */\n\nimport type { SentinelClient } from '../api';\n\nlet brand = 'web';\n\nlet client: SentinelClient | null = null;\n\nexport function setRlogClient(c: SentinelClient | null, b?: string): void {\n client = c;\n if (b) brand = b;\n}\n\nexport function rlog(tag: string, data?: Record<string, unknown>): void {\n if (!client) return;\n let line: string;\n try {\n line = JSON.stringify({ tag, b: brand, d: data ?? null, ua: navigator.userAgent.slice(0, 80) });\n } catch {\n line = JSON.stringify({ tag, b: brand });\n }\n client.postText('api/clientlog', line);\n}\n","/**\n * WebRTC session over the plugin's WebSocket signaling (docs/API.md §6).\n * Battle-tested flow: options first, createLocalDescription/setRemoteDescription\n * RPCs, trickle ICE, stream composed from ALL receivers (Safari attached an\n * audio-only stream forever when the audio track arrived first), fresh offer on\n * renegotiation, dec-check after connect with a one-time TURN-relay retry on a\n * media blackhole. The API client is injected (hosts may run on another origin).\n */\nimport type { SentinelClient } from '../api';\nimport { rlog } from './rlog';\n\nexport interface SessionCallbacks {\n onStream: (ms: MediaStream) => void;\n onFail: (reason: string) => void;\n onSessionId?: (id: string) => void;\n}\nexport interface SessionOptions { camId: string; mode: 'live' | 'recorded'; startMs?: number; compat?: boolean; forceRelay?: boolean; kind?: string; }\n\nlet forceRelayGlobal = false;\n\nexport function mobileClient(): boolean {\n return /iPhone|iPod|Android|Mobile/i.test(navigator.userAgent) || (navigator.maxTouchPoints > 1 && Math.min(screen.width || 9999, screen.height || 9999) < 920);\n}\nfunction rtcOptions() {\n let capabilities: unknown;\n try { capabilities = RTCRtpReceiver.getCapabilities ? { audio: RTCRtpReceiver.getCapabilities('audio'), video: RTCRtpReceiver.getCapabilities('video') } : undefined; } catch { /* none */ }\n return { userAgent: navigator.userAgent, capabilities, screen: { devicePixelRatio: window.devicePixelRatio || 1, width: screen.width || 1920, height: screen.height || 1080 } };\n}\n\nexport class WebRtcSession {\n ws: WebSocket | undefined; pc: RTCPeerConnection | undefined; id: string | undefined; active = false;\n private connectT: number | undefined; private trackSig = ''; private api: SentinelClient; private opts: SessionOptions; private cb: SessionCallbacks;\n constructor(api: SentinelClient, opts: SessionOptions, cb: SessionCallbacks) { this.api = api; this.opts = opts; this.cb = cb; }\n get connected(): boolean { const s = this.pc?.iceConnectionState; return s === 'connected' || s === 'completed'; }\n\n start(): void {\n const params: Record<string, string> = {};\n if (this.opts.mode === 'recorded') { params.mode = 'recorded'; params.start = String(Math.round(this.opts.startMs || 0)); }\n if (this.opts.compat ?? mobileClient()) params.compat = '1';\n let ws: WebSocket;\n try { ws = new WebSocket(this.api.signalingUrl(this.opts.camId, params)); } catch { this.cb.onFail('ws'); return; }\n this.ws = ws; this.active = true;\n this.connectT = window.setTimeout(() => {\n if (this.active && this.ws === ws && !this.connected) {\n rlog('connect-timeout', { kind: this.opts.mode, ice: this.pc?.iceConnectionState });\n if (!forceRelayGlobal) { forceRelayGlobal = true; rlog('retry-relay-only', { kind: this.opts.mode }); this.stop(); this.start(); return; }\n this.fail('timeout');\n }\n }, 12000);\n ws.onopen = () => { try { ws.send(JSON.stringify({ type: 'options', options: rtcOptions() })); } catch { /* ignore */ } };\n ws.onerror = () => { if (this.active && this.ws === ws && !this.pc) this.fail('ws-error'); };\n ws.onclose = () => { if (this.active && this.ws === ws && !this.connected) this.fail('ws-closed'); };\n ws.onmessage = (ev) => {\n let msg: any; try { msg = JSON.parse(ev.data); } catch { return; }\n if (msg.type === 'createLocalDescription') this.createLocal(ws, msg);\n else if (msg.type === 'setRemoteDescription') this.setRemote(ws, msg);\n else if (msg.type === 'addIceCandidate') this.pc?.addIceCandidate(msg.candidate).catch(() => { /* ignore */ });\n else if (msg.type === 'sessionStarted') { this.id = msg.id; this.cb.onSessionId?.(msg.id); }\n else if (msg.type === 'error') { if (this.active && this.ws === ws) this.fail(msg.reason || 'error'); }\n };\n }\n\n stop(): void {\n this.active = false;\n if (this.connectT) { clearTimeout(this.connectT); this.connectT = undefined; }\n try { if (this.ws) { this.ws.onmessage = null; this.ws.onclose = null; this.ws.onerror = null; this.ws.close(); } } catch { /* ignore */ }\n try { if (this.pc) { this.pc.ontrack = null; this.pc.oniceconnectionstatechange = null; this.pc.onicecandidate = null; this.pc.close(); } } catch { /* ignore */ }\n this.ws = undefined; this.pc = undefined; this.id = undefined; this.trackSig = '';\n }\n\n private fail(reason: string): void { if (!this.active) return; this.stop(); this.cb.onFail(reason); }\n\n private ensurePc(setup: any): RTCPeerConnection {\n if (this.pc) return this.pc;\n let cfg: RTCConfiguration = (setup && setup.configuration) || { iceServers: [{ urls: 'stun:stun.l.google.com:19302' }] };\n if (forceRelayGlobal) cfg = { ...cfg, iceTransportPolicy: 'relay' };\n const pc = new RTCPeerConnection(cfg);\n this.pc = pc;\n if (setup?.datachannel) { try { const dc = pc.createDataChannel(setup.datachannel.label, setup.datachannel.dict); dc.binaryType = 'arraybuffer'; } catch { /* ignore */ } }\n if (setup?.audio) { try { pc.addTransceiver('audio', { direction: setup.audio.direction || 'recvonly' }); } catch { /* ignore */ } }\n if (setup?.video) { try { pc.addTransceiver('video', { direction: setup.video.direction || 'recvonly' }); } catch { /* ignore */ } }\n pc.ontrack = () => {\n if (!this.active || this.pc !== pc) return;\n const ms = new MediaStream();\n pc.getReceivers().forEach(r => { if (r.track) ms.addTrack(r.track); });\n if (!ms.getVideoTracks().length) return; // audio-first: wait for the video event\n const sig = ms.getTracks().map(t => t.id).sort().join(',');\n if (this.trackSig === sig) return;\n this.trackSig = sig;\n this.cb.onStream(ms);\n };\n pc.oniceconnectionstatechange = () => {\n if (!this.active || this.pc !== pc) return;\n const st = pc.iceConnectionState;\n if (st === 'connected' || st === 'completed') {\n if (this.connectT) { clearTimeout(this.connectT); this.connectT = undefined; }\n window.setTimeout(() => {\n if (!this.active || this.pc !== pc) return;\n pc.getStats().then(s => {\n let dec = -1, recv = -1, vBytes = -1, aBytes = -1;\n s.forEach((r: any) => {\n if (r.type === 'inbound-rtp' && (r.kind || r.mediaType) === 'video') { dec = r.framesDecoded || 0; recv = r.framesReceived ?? -1; vBytes = r.bytesReceived || 0; }\n if (r.type === 'inbound-rtp' && (r.kind || r.mediaType) === 'audio') aBytes = r.bytesReceived || 0;\n });\n if (dec <= 0) {\n rlog('dec-check-fail', { kind: this.opts.mode, dec, recv, vBytes, aBytes, relayForced: forceRelayGlobal });\n if (!forceRelayGlobal && vBytes <= 0 && aBytes <= 0) { forceRelayGlobal = true; rlog('retry-relay-only', { kind: this.opts.mode }); this.stop(); this.start(); return; }\n this.fail('no-decode');\n }\n else rlog('dec-ok', { kind: this.opts.mode, dec, relayForced: forceRelayGlobal });\n }).catch(() => { /* ignore */ });\n }, this.opts.mode === 'live' ? 5000 : 9000);\n }\n if (st === 'failed') { rlog('ice-failed', { kind: this.opts.mode }); this.fail('ice-failed'); }\n };\n return pc;\n }\n\n private createLocal(ws: WebSocket, msg: any): void {\n const pc = this.ensurePc(msg.setup);\n const mid = this.connected;\n if (mid) rlog('reneg', { dtype: msg.dtype, kind: this.opts.mode });\n const reply = (desc: RTCSessionDescriptionInit) => { try { ws.send(JSON.stringify({ type: 'response', reqId: msg.reqId, description: { type: desc.type, sdp: desc.sdp } })); } catch { /* ignore */ } };\n pc.onicecandidate = (ev) => { if (ev.candidate) { try { ws.send(JSON.stringify({ type: 'iceCandidate', candidate: JSON.parse(JSON.stringify(ev.candidate)) })); } catch { /* ignore */ } } };\n const p = msg.dtype === 'offer'\n ? pc.createOffer({ offerToReceiveAudio: !!msg.setup?.audio, offerToReceiveVideo: !!msg.setup?.video }).then(o => pc.setLocalDescription(o).then(() => reply(o)))\n : pc.createAnswer().then(a => pc.setLocalDescription(a).then(() => reply(a)));\n p.catch(e => { rlog('createLocal-fail', { dtype: msg.dtype, name: e?.name, mid }); if (!mid) this.fail('createLocal'); });\n }\n\n private setRemote(ws: WebSocket, msg: any): void {\n const pc = this.ensurePc(msg.setup);\n const mid = this.connected;\n pc.setRemoteDescription(msg.description)\n .then(() => { try { ws.send(JSON.stringify({ type: 'response', reqId: msg.reqId, ok: true })); } catch { /* ignore */ } })\n .catch(e => { rlog('sRD-fail', { name: e?.name, mid }); try { ws.send(JSON.stringify({ type: 'response', reqId: msg.reqId, ok: false })); } catch { /* ignore */ } if (!mid) this.fail('sRD'); });\n }\n}\n","/**\n * PlayerController — the whole playback brain of the NVR. Framework-free: it owns\n * a <video>, a freeze <canvas> and an MJPEG <img> inside a stage element, and\n * reports state through `onState`; the host only renders what it says.\n *\n * Host seams: the API client is injected; status labels are i18n KEY suffixes\n * (`nvr.player.<label>`) the host translates; `storagePrefix` namespaces the\n * remembered stage aspect per camera; `brand` tags telemetry lines. The MSE paths\n * are gated on `SentinelClient.corsMedia`; posters load with crossOrigin so the\n * freeze canvas stays untainted. The host CSS must define a `.hidden` class.\n *\n * Paths: LIVE = WebRTC (sink) → MSE live (fMP4, no audio) → MJPEG <img>.\n * RECORDED = WebRTC relay (server-seekable, scrub time-lapse in place) →\n * MSE fallback (progressive segments, trick-play chase) → native <video src>.\n */\nimport type { SentinelClip as Clip, SentinelClient } from '../api';\nimport { rlog, setRlogClient } from './rlog';\nimport { WebRtcSession, mobileClient } from './webrtc';\n\n/** `label` is an i18n key suffix: nvr.player.<label> */\nexport type PlayerLabel = 'live' | 'liveWebrtc' | 'liveMse' | 'liveMjpeg' | 'loading' | 'playing' | 'paused' | 'scrub' | 'noRecording' | '';\nexport interface PlayerState {\n live: boolean; label: PlayerLabel; playhead: number | null; rate: number; sound: boolean; paused: boolean;\n transport: 'webrtc' | 'mse' | 'mjpeg' | 'relay' | 'native' | 'none'; muted: boolean;\n}\nexport interface PlayerRefs { video: HTMLVideoElement; freeze: HTMLCanvasElement; img: HTMLImageElement; stage: HTMLElement; }\nexport interface PlayerOptions {\n onState: (s: PlayerState) => void;\n onClipsRefresh: () => Promise<Clip[]>;\n /** localStorage key prefix for the remembered stage aspect per camera (default 'snvr-ar-'). */\n storagePrefix?: string;\n /** telemetry brand tag written into api/clientlog lines (default 'web'). */\n brand?: string;\n}\ntype Opts = PlayerOptions;\n\nconst MSCls: typeof MediaSource | undefined = (window as any).ManagedMediaSource || window.MediaSource;\n/** Seek → picture. Measured in the lab (scripts/seek-swap-test.js + RTSP tap, 23.09.2026, 14 seeks): the relay answers a seek\n * after ~10 ms, the NEW position leaves mediamtx ~1.08 s later and reaches the screen after 2.2–2.6 s (sink ffmpeg + 500 ms\n * jitter buffer + render). Until then the OLD position keeps playing — a poster (event frame / frozen picture) must stay up that\n * long, else old frames flash through (\"springt hin und her\"). A profile switch does NOT reset this latency (measured). */\nconst SWAP_MS = 2600;\n/** Scrub profile (640 all-intra) → normal (1280) only after the gesture has been quiet this long: a scroll–pause–scroll pattern\n * restarted the transcoder twice per pause (server log: profile switch every 1–2 s, 30 restarts in one session). */\nconst SCRUB_OFF_DELAY_MS = 1500;\n/** hold mid-gesture: seek only if the playhead is further than this from the centre; idle: land if further than this */\nconst SCRUB_HOLD_SEEK_MS = 4500, SCRUB_LAND_MS = 5000; // landing tolerance > one camera GOP (4 s): a seek lands on the keyframe BEFORE the target by design\n\nexport class PlayerController {\n private v!: HTMLVideoElement; private fz!: HTMLCanvasElement; private img!: HTMLImageElement; private stage!: HTMLElement;\n private api: SentinelClient; private opts: Opts;\n camId = ''; camName = ''; clips: Clip[] = []; codecs: string | null = null; rangeStart = 0; rangeEnd = 0;\n live = false; rate = 1; soundOn = false; recPaused = false; recPausedTs: number | null = null;\n recWebrtcDisabled = false; label: PlayerLabel = ''; transport: PlayerState['transport'] = 'none';\n // relay session (RW)\n private rw: WebRtcSession | undefined; private rwStartMs = 0; private rwBase: number | null = null; private rwPosTs: number | null = null; private rwPosAt = 0;\n private rwRate = 1; private rwSrate = 1; private rwScrub = false; private rwSeekBusy = false; private rwPending: { ts: number; rate: number; srate: number } | null = null;\n private rwLastSeekTs: number | null = null; private rwLastSeekAt = 0; private rwRateBusy = false; private rwPendingRate: number | null = null; private rwLastRateAt = 0;\n private relayPoll: number | undefined; private wdLastCt = -1; private wdLastAt = 0; private wdDead = 0; private wdGrace = 0; private wdResumeLogged = false; private recoveries = 0;\n private posterUntilSeek = false; private seekTarget = 0;\n // seek → visible swap (see SWAP_MS); posterFor = event the pending poster belongs to; scrubOffT = delayed profile switch\n private swapPending = false; private swapFrames = -1; private swapT = 0; private posterFor = 0; private scrubOffT = 0;\n // relay-pos answers are only valid for the command generation they were asked under; a poll sent BEFORE a\n // seek/rate change and answered after it would drag the playhead back to the old position (and the\n // auto-follow timeline with it → visible back-and-forth). seekAt: the server may still report the pre-swap\n // position for a moment after a seek — ignore far-off values in that window.\n private cmdSeq = 0; private seekAt = 0;\n // live session (W) + live MSE (L)\n private w: WebRtcSession | undefined; private L = { active: false, ms: null as MediaSource | null, sb: null as SourceBuffer | null, abort: null as AbortController | null, queue: [] as Uint8Array[], restarts: 0, lastTrim: 0, stallT: 0 };\n // recorded MSE (M)\n private M = { ms: null as MediaSource | null, sb: null as SourceBuffer | null, base: 0, nextIdx: -1, end: 0, active: false, feeding: false, abort: null as AbortController | null, q: [] as Uint8Array[], segFirst: false, segOff: 0, pendingSeek: null as number | null, mmsGo: true };\n private CH = { active: false, target: 0, timer: 0 };\n private curClipId: string | null = null; private playIndex = -1; private lastLoad = 0; private pendingTs: number | null = null; private pendingT: number | undefined;\n // frame counter / freeze\n private fc = { n: 0, tok: {} as object }; private freezeT = 0; private freezeTok: object | null = null;\n private cad = { t: 0, last: -1, lastNew: 0, stalls: 0, maxStall: 0, frames0: -1, t0: 0, gapMax: 0 };\n private stallTimer = 0; private destroyed = false; private liveRestartT = 0;\n private unlisten: (() => void)[] = [];\n\n private arPrefix: string;\n constructor(api: SentinelClient, opts: Opts) { this.api = api; this.opts = opts; this.arPrefix = opts.storagePrefix ?? 'snvr-ar-'; setRlogClient(api, opts.brand); }\n\n attach(r: PlayerRefs): void {\n this.v = r.video; this.fz = r.freeze; this.img = r.img; this.stage = r.stage;\n const v = this.v;\n const on = (n: string, f: () => void) => { v.addEventListener(n, f); this.unlisten.push(() => v.removeEventListener(n, f)); };\n on('timeupdate', () => { if (this.live) return; if (this.rw?.active && this.rwBase == null && v.currentTime > 0) this.rwBase = v.currentTime; const ts = this.currentTs(); if (ts == null) return; if (this.M.active || this.rw?.active) { const i = this.clipIndexFor(ts); if (i >= 0) this.playIndex = i; } this.feed(); this.emit(); });\n on('waiting', () => { if (this.live) { if (this.L.active && !this.L.stallT) this.L.stallT = window.setTimeout(() => { this.L.stallT = 0; if (this.live && this.L.active && v.readyState < 3) this.liveRestart(); }, 4000); return; } if (!this.rw?.active) this.setLabel('loading'); if (!this.M.active || this.stallTimer) return; this.stallTimer = window.setTimeout(() => { this.stallTimer = 0; this.handleStall(); }, 600); });\n on('seeking', () => { if (!this.live && !this.rw?.active) this.setLabel('loading'); });\n for (const n of ['loadeddata', 'playing', 'canplay', 'seeked']) on(n, () => { if (v.videoWidth) this.freezeHide(); if (!this.live && this.label === 'loading') this.setLabel('playing'); if (this.L.stallT) { clearTimeout(this.L.stallT); this.L.stallT = 0; } this.emit(); });\n on('pause', () => { if (this.L.stallT) { clearTimeout(this.L.stallT); this.L.stallT = 0; } this.emit(); });\n on('play', () => this.emit());\n // the stage box follows the picture's real aspect where the layout uses it (mobile: no letterbox bars for 4:3 cameras)\n on('loadedmetadata', () => this.setAspect(this.v.videoWidth, this.v.videoHeight));\n on('resize', () => this.setAspect(this.v.videoWidth, this.v.videoHeight));\n on('volumechange', () => this.emit());\n on('error', () => { const e = v.error; rlog('video-error', { code: e?.code, msg: e?.message?.slice(0, 120), src: v.getAttribute('src') ? 'src' : 'srcObject' }); });\n on('ended', () => { if (this.live || this.M.active || this.rw?.active) return; const n = this.playIndex + 1; if (n < this.clips.length) { const c = this.clips[n]!; this.curClipId = c.id; this.playIndex = n; v.src = this.api.url(`api/segment?id=${encodeURIComponent(c.videoId || c.id)}`); v.load(); v.onloadedmetadata = () => { v.playbackRate = this.rate; try { v.currentTime = 0; } catch { /* ignore */ } this.safePlay(); }; this.setLabel('playing'); } });\n this.pendingT = window.setInterval(() => { if (this.pendingTs != null && Date.now() - this.lastLoad >= 200) { const t = this.pendingTs; this.pendingTs = null; this.playAt(t, { scrub: true }); } }, 120);\n const vis = () => this.onVisibility(); document.addEventListener('visibilitychange', vis); this.unlisten.push(() => document.removeEventListener('visibilitychange', vis));\n const edge = window.setInterval(() => { if (this.live && this.L.active) this.liveEdge(); }, 1000); this.unlisten.push(() => clearInterval(edge));\n }\n\n destroy(): void {\n this.destroyed = true;\n // no path may (re)start a stream on a destroyed controller: the 1-s live\n // restart timer, a pending async load in the host, a visibility change …\n this.live = false; this.recPaused = false;\n if (this.liveRestartT) { clearTimeout(this.liveRestartT); this.liveRestartT = 0; }\n this.recWebrtcTeardown(); this.webrtcTeardown(); this.mseTeardown(); this.liveTeardown(); this.chaseAbort();\n if (this.pendingT) clearInterval(this.pendingT);\n for (const u of this.unlisten) u();\n try { this.v.pause(); this.v.srcObject = null; this.v.removeAttribute('src'); } catch { /* ignore */ }\n }\n\n setCamera(camId: string, name: string): void {\n if (camId !== this.camId) { this.recWebrtcDisabled = false; this.recoveries = 0; }\n this.camId = camId; this.camName = name;\n // last known picture aspect of this camera: the stage has the right shape before any poster/video arrives\n let ar = ''; try { ar = localStorage.getItem(this.arPrefix + camId) || ''; } catch { /* ignore */ }\n if (ar) this.stage.style.setProperty('--stage-ar', ar); else this.stage.style.removeProperty('--stage-ar');\n }\n /** picture aspect → stage box (mobile layout uses it); posters and video both report it */\n private setAspect(w: number, h: number): void {\n if (!w || !h) return;\n const ar = `${w} / ${h}`;\n if (this.stage.style.getPropertyValue('--stage-ar') === ar) return;\n this.stage.style.setProperty('--stage-ar', ar);\n try { localStorage.setItem(this.arPrefix + this.camId, ar); } catch { /* ignore */ }\n }\n /** clips of the loaded range (several days, sorted), codec string, and the range the timeline spans */\n setClips(clips: Clip[], codecs: string | null, rangeStart: number, rangeEnd: number): void { this.clips = clips; this.codecs = codecs; this.rangeStart = rangeStart; this.rangeEnd = rangeEnd; }\n\n // ---- state ---------------------------------------------------------------------\n private setLabel(l: PlayerLabel): void { this.label = l; this.emit(); }\n private emit(): void {\n if (this.destroyed) return;\n this.opts.onState({ live: this.live, label: this.label, playhead: this.live ? null : this.currentTs(), rate: this.rate, sound: this.soundOn, paused: this.recPaused || (this.v.paused && !this.live && !this.rw?.active), transport: this.transport, muted: this.v.muted });\n }\n clipIndexFor(ts: number): number { for (let i = 0; i < this.clips.length; i++) { const c = this.clips[i]!; if (ts >= c.startTime && ts < c.startTime + (c.duration || 60000)) return i; } return -1; }\n private nearNow(ts: number): boolean { return Date.now() - ts < 8000; }\n private clampRange(ts: number): number { return Math.min(Math.max(ts, this.rangeStart), Math.min(this.rangeEnd - 1, Date.now())); }\n\n /** Wall-clock position of the picture on screen (Scrypted's getRecordingStreamCurrentTime). */\n currentTs(): number | null {\n if (this.rw?.active) {\n if (this.rwPosTs != null) return this.rwPosTs + (Date.now() - this.rwPosAt) * (this.rwRate || 1);\n if (this.rwBase != null && this.v.currentTime > 0) return this.rwStartMs + (this.v.currentTime - this.rwBase) * 1000 * (this.rwRate || 1);\n return this.rwStartMs;\n }\n if (this.recPaused) return this.recPausedTs;\n if (this.live) return null;\n if (this.M.active) return this.M.base + this.v.currentTime * 1000;\n const pc = this.playIndex >= 0 ? this.clips[this.playIndex] : undefined; if (pc) return pc.startTime + this.v.currentTime * 1000;\n return null;\n }\n\n // ---- presented frames / freeze / poster -----------------------------------------\n private fcArm(): void { const v: any = this.v; if (!v.requestVideoFrameCallback) return; const tok = {}; this.fc.tok = tok; const tick = () => { if (this.fc.tok !== tok) return; this.fc.n++; try { v.requestVideoFrameCallback(tick); } catch { /* ignore */ } }; try { v.requestVideoFrameCallback(tick); } catch { /* ignore */ } }\n presentedFrames(): number { if ((this.v as any).requestVideoFrameCallback) return this.fc.n; try { return this.v.getVideoPlaybackQuality().totalVideoFrames; } catch { return -1; } }\n private freezeArm(hold: boolean): void {\n if (this.freezeT) clearTimeout(this.freezeT);\n this.freezeT = window.setTimeout(() => this.freezeHide(), hold ? 90000 : 5000);\n const v: any = this.v;\n if (hold && v.requestVideoFrameCallback) { const tok = {}; this.freezeTok = tok; try { v.requestVideoFrameCallback(() => { if (this.freezeTok === tok && this.v.videoWidth) this.freezeHide(); }); } catch { /* ignore */ } }\n }\n /** copy the current video picture onto the freeze canvas (false = nothing to copy yet) */\n private drawVideo(): boolean {\n const v = this.v, fc = this.fz;\n if (!v.videoWidth || !v.videoHeight || v.readyState < 2) return false;\n if (fc.width !== v.videoWidth) fc.width = v.videoWidth;\n if (fc.height !== v.videoHeight) fc.height = v.videoHeight;\n fc.getContext('2d')!.drawImage(v, 0, 0, fc.width, fc.height);\n fc.classList.remove('hidden'); fc.dataset.src = 'video';\n return true;\n }\n freezeShow(hold = false): void {\n try { if (this.drawVideo()) this.freezeArm(hold); } catch { /* ignore */ }\n }\n /** poster/freeze stays until the seek's picture is visible (swapVisible), 6 s safety net */\n private holdUntilSwap(): void {\n if (this.freezeT) clearTimeout(this.freezeT); this.freezeTok = null;\n this.posterUntilSeek = true; this.freezeT = window.setTimeout(() => this.swapVisible(), 6000);\n }\n /** Event click inside a running relay session: the current picture stands still at once (the old position must not keep\n * playing while the event frame loads); the event frame replaces it, the picture at the target lifts it. */\n freezeCurrent(): void {\n if (!this.rw?.active || !this.rw.id) return; // no session yet: playAt's own freeze/poster path applies\n try { if (this.drawVideo()) this.holdUntilSwap(); } catch { /* ignore */ }\n }\n /** the picture of the last seek is on screen: lift a held poster, report playing */\n private swapVisible(): void {\n if (this.swapT) { clearTimeout(this.swapT); this.swapT = 0; }\n this.swapPending = false;\n if (this.posterUntilSeek) this.freezeHide();\n if (this.label === 'loading' && this.rw?.active) this.setLabel('playing');\n }\n /** seek answered: the new picture is on screen SWAP_MS later (plus proof of a presented frame) */\n private swapArm(): void {\n if (this.swapT) clearTimeout(this.swapT);\n this.swapFrames = this.presentedFrames();\n const check = () => { this.swapT = 0; if (!this.swapPending || !this.rw?.active) return; if (this.presentedFrames() > this.swapFrames) this.swapVisible(); else this.swapT = window.setTimeout(check, 100); };\n this.swapT = window.setTimeout(check, SWAP_MS);\n }\n freezeFromImage(img: HTMLImageElement, hold: boolean, untilSeek = false, kind = 'image'): boolean {\n try {\n if (!img.naturalWidth || !img.naturalHeight) return false;\n const fc = this.fz; fc.width = img.naturalWidth; fc.height = img.naturalHeight; fc.getContext('2d')!.drawImage(img, 0, 0); fc.classList.remove('hidden'); fc.dataset.src = kind;\n this.setAspect(img.naturalWidth, img.naturalHeight);\n if (untilSeek) this.holdUntilSwap(); // stays until the seek's picture is visible (see startRelayPoll)\n else this.freezeArm(hold);\n return true;\n } catch { return false; }\n }\n freezeHide(): void { if (this.freezeT) { clearTimeout(this.freezeT); this.freezeT = 0; } this.posterUntilSeek = false; this.fz.classList.add('hidden'); delete this.fz.dataset.src; }\n private posterUp(): boolean { return !this.fz.classList.contains('hidden'); }\n freezeHold(): void { if (this.freezeT) { clearTimeout(this.freezeT); this.freezeT = window.setTimeout(() => this.freezeHide(), 5000); } }\n /** Event click: the stored frame is the poster until the seek lands. */\n posterEvent(ts: number): void {\n const cam = this.camId; this.posterFor = ts; const img = new Image(); img.crossOrigin = 'anonymous';\n img.onload = () => {\n if (this.camId !== cam || this.posterFor !== ts || this.destroyed) return;\n const inSession = !!this.rw?.active && !!this.rw.id;\n if (inSession && !this.swapPending) return; // arrived after the seek's picture is already on screen — don't cover it\n this.freezeFromImage(img, true, inSession, 'event');\n };\n img.src = this.api.url(`api/evframe?camera=${encodeURIComponent(cam)}&ts=${ts}`);\n }\n /** Camera opened: newest snapshot in front of the black stage until live plays. */\n posterFromSnapshot(): void { const cam = this.camId; const img = new Image(); img.crossOrigin = 'anonymous'; img.onload = () => { if (this.camId !== cam || this.rw?.active || this.recPaused || this.posterUp()) return; if (this.v.readyState >= 2 && this.v.videoWidth && !this.v.paused) return; this.freezeFromImage(img, true, false, 'snapshot'); }; img.src = this.api.url(`api/snapshot?camera=${encodeURIComponent(cam)}`) + `&_=${Date.now()}`; }\n private posterShow(ts: number): void { try { if (this.posterUp()) return; if (this.v.readyState >= 2 && this.v.videoWidth) return; const i = this.clipIndexFor(ts); const c = i >= 0 ? this.clips[i] : undefined; if (!c?.thumbnailId) return; const cam = this.camId; const img = new Image(); img.crossOrigin = 'anonymous'; img.onload = () => { if (this.camId !== cam || this.destroyed) return; if (!this.posterUp()) this.freezeFromImage(img, true, false, 'thumb'); }; img.src = this.api.url(`api/thumb?id=${encodeURIComponent(c.thumbnailId)}`); } catch { /* ignore */ } }\n\n private safePlay(): void {\n let pr: Promise<void>; try { pr = this.v.play(); } catch { return; }\n pr.then(() => this.emit()).catch((e1) => { this.v.muted = true; this.v.play().then(() => this.emit()).catch((e2) => rlog('play-fail', { e1: e1?.name, e2: e2?.name, rs: this.v.readyState, paused: this.v.paused })); });\n }\n\n // ---- LIVE ---------------------------------------------------------------------------\n goLive(): void {\n if (!this.camId || this.destroyed) return;\n this.chaseAbort();\n this.freezeShow(true);\n this.exitLiveState(); this.recWebrtcTeardown(); this.recPaused = false; this.live = true; this.playIndex = -1; this.curClipId = null; this.L.restarts = 0;\n this.setLabel('live');\n if (document.visibilityState === 'hidden') return;\n if (window.RTCPeerConnection && window.WebSocket) this.liveStartWebrtc();\n else if (this.liveMseOk()) this.liveStartMse();\n else { try { this.v.pause(); } catch { /* ignore */ } this.liveFallbackImg(); }\n }\n private exitLiveState(): void { if (this.live) { this.live = false; this.webrtcTeardown(); this.liveTeardown(); try { this.v.srcObject = null; } catch { /* ignore */ } this.setMjpeg(false); } }\n private setMjpeg(on: boolean): void { this.img.classList.toggle('hidden', !on); this.v.classList.toggle('hidden', on); if (!on) this.img.removeAttribute('src'); }\n private webrtcTeardown(): void { this.w?.stop(); this.w = undefined; }\n private liveStartWebrtc(): void {\n if (this.destroyed) return;\n this.v.onloadedmetadata = null;\n this.webrtcTeardown(); this.recWebrtcTeardown(); this.mseTeardown(); this.liveTeardown();\n try { this.v.pause(); } catch { /* ignore */ } try { this.v.srcObject = null; } catch { /* ignore */ } this.v.removeAttribute('src');\n this.setMjpeg(false);\n const s = new WebRtcSession(this.api, { camId: this.camId, mode: 'live' }, {\n onStream: (ms) => { if (!this.live || this.w !== s) return; this.setMjpeg(false); this.v.muted = !this.soundOn; try { this.v.removeAttribute('src'); } catch { /* ignore */ } try { this.v.srcObject = ms; } catch { /* ignore */ } this.fcArm(); this.safePlay(); this.transport = 'webrtc'; this.setLabel('liveWebrtc'); },\n onFail: () => { if (this.w === s) this.liveFallbackMse(); },\n });\n this.w = s; this.transport = 'webrtc'; s.start();\n }\n private liveFallbackMse(): void { this.webrtcTeardown(); if (!this.live) return; try { this.v.srcObject = null; } catch { /* ignore */ } if (this.liveMseOk()) this.liveStartMse(); else this.liveFallbackImg(); }\n private liveCodec(): string | null { return this.codecs ? (this.codecs.split(',')[0] ?? null) : null; }\n private liveMseOk(): boolean { try { const c = this.liveCodec(); return !!(this.api.corsMedia && MSCls && c && MSCls.isTypeSupported(`video/mp4; codecs=\"${c}\"`)); } catch { return false; } }\n private liveTeardown(): void { const L = this.L; L.active = false; L.queue = []; if (L.stallT) { clearTimeout(L.stallT); L.stallT = 0; } try { L.abort?.abort(); } catch { /* ignore */ } L.abort = null; if (L.sb && L.ms && L.ms.readyState === 'open') { try { L.sb.abort(); } catch { /* ignore */ } } L.sb = null; L.ms = null; }\n private liveAppend(): void { const L = this.L; if (!L.active || !L.sb || L.sb.updating || !L.queue.length) return; const buf = L.queue.shift()!; try { L.sb.appendBuffer(buf as BufferSource); } catch { this.liveRestart(); } }\n private liveTrim(): void { const L = this.L; if (!L.sb || L.sb.updating) return; try { const b = this.v.buffered; if (b.length && this.v.currentTime - b.start(0) > 30) L.sb.remove(0, this.v.currentTime - 10); } catch { /* ignore */ } }\n private liveEdge(): void { try { const b = this.v.buffered; if (!b.length) return; const end = b.end(b.length - 1); if (end - this.v.currentTime > 2.5) this.v.currentTime = end - 0.7; if (this.v.paused) this.safePlay(); } catch { /* ignore */ } }\n private liveRestart(): void { if (!this.live || !this.L.active) return; this.liveTeardown(); this.L.restarts++; if (this.L.restarts > 5) { this.liveFallbackImg(); return; } if (this.liveRestartT) clearTimeout(this.liveRestartT); this.liveRestartT = window.setTimeout(() => { this.liveRestartT = 0; if (this.live && !this.destroyed) this.liveStartMse(); }, 1000); }\n private liveStartMse(): void {\n if (this.destroyed) return;\n this.v.onloadedmetadata = null;\n this.liveTeardown(); this.mseTeardown();\n const L = this.L; L.active = true; this.transport = 'mse'; this.setLabel('liveMse'); this.setMjpeg(false);\n const ms = new MSCls!(); L.ms = ms; L.lastTrim = Date.now();\n if ((window as any).ManagedMediaSource && ms instanceof (window as any).ManagedMediaSource) { try { (this.v as any).disableRemotePlayback = true; } catch { /* ignore */ } }\n const u = URL.createObjectURL(ms);\n ms.addEventListener('sourceopen', () => {\n URL.revokeObjectURL(u); if (L.ms !== ms) return;\n let sb: SourceBuffer; try { sb = ms.addSourceBuffer(`video/mp4; codecs=\"${this.liveCodec()}\"`); } catch { this.liveFallbackImg(); return; }\n sb.mode = 'segments';\n sb.addEventListener('updateend', () => { if (Date.now() - L.lastTrim > 10000) { L.lastTrim = Date.now(); this.liveTrim(); } this.liveAppend(); });\n sb.addEventListener('error', () => this.liveRestart());\n L.sb = sb; L.abort = new AbortController();\n fetch(this.api.url(`api/livemse?camera=${encodeURIComponent(this.camId)}`), { credentials: 'same-origin', signal: L.abort.signal })\n .then(r => { if (!r.ok || !r.body) throw new Error(String(r.status)); const rd = r.body.getReader(); const loop = () => { rd.read().then(x => { if (!L.active || L.ms !== ms) return; if (x.done) { this.liveRestart(); return; } L.queue.push(x.value); this.liveAppend(); loop(); }).catch(() => { if (L.active && L.ms === ms) this.liveRestart(); }); }; loop(); })\n .catch(() => { if (L.active && L.ms === ms) this.liveFallbackImg(); });\n });\n try { this.v.srcObject = null; } catch { /* ignore */ }\n this.v.src = u; this.v.playbackRate = 1; this.v.muted = true; this.safePlay();\n }\n private liveFallbackImg(): void { this.liveTeardown(); if (!this.live) return; try { this.v.pause(); } catch { /* ignore */ } this.freezeHide(); this.transport = 'mjpeg'; this.setLabel('liveMjpeg'); this.setMjpeg(true); this.img.src = this.api.url(`api/live?camera=${encodeURIComponent(this.camId)}`) + `&_=${Date.now()}`; }\n\n // ---- RECORDED via relay -----------------------------------------------------------------\n private recWebrtcOk(): boolean { return !this.recWebrtcDisabled && !!(window.RTCPeerConnection && window.WebSocket); }\n private recWebrtcTeardown(): void { this.posterUntilSeek = false; this.swapPending = false; if (this.swapT) { clearTimeout(this.swapT); this.swapT = 0; } if (this.scrubOffT) { clearTimeout(this.scrubOffT); this.scrubOffT = 0; } this.stopRelayPoll(); this.rw?.stop(); this.rw = undefined; this.rwBase = null; this.rwPosTs = null; this.rwScrub = false; this.rwSeekBusy = false; this.rwPending = null; this.rwLastSeekTs = null; this.rwSrate = 1; this.rwRate = 1; this.rwRateBusy = false; this.rwPendingRate = null; }\n private recWebrtcStart(ts: number): void {\n if (this.destroyed) return;\n this.v.onloadedmetadata = null;\n this.freezeShow(true); this.posterShow(ts);\n this.live = false;\n this.recWebrtcTeardown(); this.webrtcTeardown(); this.mseTeardown(); this.liveTeardown();\n try { this.v.pause(); } catch { /* ignore */ } try { this.v.removeAttribute('src'); this.v.srcObject = null; } catch { /* ignore */ }\n this.setMjpeg(false); this.transport = 'relay';\n this.setLabel('loading');\n this.rwStartMs = ts; this.rwBase = null; this.rwRate = this.rate; this.rwSrate = 1; this.seekTarget = ts; // event poster clears when relay-pos reaches here\n const compat = mobileClient();\n if (compat) rlog('rec-compat-start', { ts: Math.round(ts) });\n const s = new WebRtcSession(this.api, { camId: this.camId, mode: 'recorded', startMs: ts, compat }, {\n onStream: (ms) => {\n if (this.rw !== s || this.live) return;\n try { s.pc?.getReceivers().forEach(r => { try { (r as any).jitterBufferTarget = 500; } catch { /* ignore */ } try { (r as any).playoutDelayHint = 0.5; } catch { /* ignore */ } }); } catch { /* ignore */ }\n this.setMjpeg(false); this.v.muted = !this.soundOn || this.rate !== 1;\n try { this.v.removeAttribute('src'); } catch { /* ignore */ } try { this.v.srcObject = ms; } catch { /* ignore */ }\n this.fcArm(); this.rwBase = null; this.safePlay(); this.setLabel('playing');\n },\n onFail: () => { if (this.rw === s) this.recFallbackMse(ts); },\n onSessionId: () => { if (this.rw === s && this.rwPending) { const p = this.rwPending; this.rwPending = null; if (Math.abs(p.ts - this.rwStartMs) > 1500) this.recRelaySeek(p.ts, p.rate, p.srate); } },\n });\n this.rw = s; s.start(); this.startRelayPoll(); this.emit();\n }\n /** Relay failed: retry the relay up to twice (transient WS/ICE hiccups), only then fall back to MSE for the rest of this camera. */\n private recFallbackMse(ts: number): void {\n this.recWebrtcTeardown();\n if (this.live || this.destroyed) return;\n this.recoveries++;\n if (this.recoveries <= 2) { rlog('relay-retry', { n: this.recoveries }); this.recWebrtcStart(ts); return; }\n rlog('rec-fallback-mse', { mseOk: this.mseSupported(), after: this.recoveries }); this.recWebrtcDisabled = true; this.playAt(ts, {});\n }\n /** Hard server-side seek, coalesced: one in flight, latest wins, 150 ms floor. */\n private recRelaySeek(ts: number, rate = 1, srate = 1): void {\n const s = this.rw; if (!s?.id) return;\n if (this.rwSeekBusy) { this.rwPending = { ts, rate, srate }; return; }\n if (this.rwLastSeekTs === ts && this.rwRate === rate && this.rwSrate === srate && Date.now() - this.rwLastSeekAt < 1000) return;\n const wait = 150 - (Date.now() - this.rwLastSeekAt);\n if (wait > 0) { this.rwSeekBusy = true; this.rwPending = { ts, rate, srate }; window.setTimeout(() => { this.rwSeekBusy = false; const p = this.rwPending; this.rwPending = null; if (p && this.rw?.id) this.recRelaySeek(p.ts, p.rate, p.srate); }, wait); return; }\n this.rwStartMs = ts; this.rwSrate = srate; this.rwRate = this.rwScrub ? srate : rate; this.rwPendingRate = null; this.rwLastSeekTs = ts; this.rwLastSeekAt = Date.now();\n this.cad.lastNew = Date.now(); this.wdLastCt = -1; this.wdLastAt = Date.now(); this.wdGrace = Date.now() + 5000;\n this.rwPosTs = ts; this.rwPosAt = Date.now();\n this.setLabel(this.rwScrub ? 'scrub' : 'loading'); // scrubbing seeks constantly — no \"loading\" flicker there\n this.rwSeekBusy = true;\n this.seekTarget = ts; this.seekAt = Date.now(); this.cmdSeq++;\n this.swapPending = true; if (this.swapT) { clearTimeout(this.swapT); this.swapT = 0; }\n const done = (ok: boolean) => { this.rwSeekBusy = false; if (!ok) { this.relayRecover(); return; } if (this.swapPending) this.swapArm(); const p = this.rwPending; this.rwPending = null; if (p && this.rw?.id) this.recRelaySeek(p.ts, p.rate, p.srate); };\n this.api.control(`api/relay-seek?session=${encodeURIComponent(s.id)}&start=${Math.round(ts)}&rate=${rate}&srate=${srate}`).then(ok => done(ok));\n }\n /** Scrub time-lapse rate, coalesced (120 ms floor, 15 % hysteresis). */\n private recRelayRate(r: number): void {\n const s = this.rw; if (!s?.active || !s.id || !this.rwScrub) return;\n if (this.rwRateBusy) { this.rwPendingRate = r; return; }\n if (this.rwSrate === r) return;\n if (this.rwSrate !== 1 && (r > 0) === (this.rwSrate > 0) && Math.abs(r - this.rwSrate) < 0.15 * Math.abs(this.rwSrate)) return;\n const wait = 120 - (Date.now() - this.rwLastRateAt);\n if (wait > 0) { this.rwRateBusy = true; this.rwPendingRate = r; window.setTimeout(() => { this.rwRateBusy = false; const p = this.rwPendingRate; this.rwPendingRate = null; if (p != null && this.rw?.id) this.recRelayRate(p); }, wait); return; }\n const c = this.currentTs(); this.rwSrate = r; this.rwRate = r; this.rwLastRateAt = Date.now(); this.cmdSeq++; if (c != null) { this.rwPosTs = c; this.rwPosAt = Date.now(); }\n this.wdGrace = Date.now() + 8000; this.cad.lastNew = Date.now();\n this.rwRateBusy = true;\n this.api.control(`api/relay-rate?session=${encodeURIComponent(s.id)}&rate=${r}`).then(ok => { if (!ok) this.relayRecover(); }).then(() => { this.rwRateBusy = false; const p = this.rwPendingRate; this.rwPendingRate = null; if (p != null && this.rw?.id && p !== this.rwSrate) this.recRelayRate(p); });\n }\n private recRelayScrub(on: boolean): void {\n const s = this.rw; if (!s?.active || !s.id || this.rwScrub === on) return;\n this.rwScrub = on;\n this.cmdSeq++;\n if (!on) { const c = this.currentTs(); this.rwSrate = 1; this.rwRate = this.rate; this.rwPendingRate = null; if (c != null) { this.rwPosTs = c; this.rwPosAt = Date.now(); } if (this.label === 'scrub') this.setLabel('playing'); }\n this.wdLastCt = -1; this.wdLastAt = Date.now(); this.wdGrace = Date.now() + 5000; this.cad.lastNew = Date.now();\n this.api.control(`api/relay-scrub?session=${encodeURIComponent(s.id)}&on=${on ? 1 : 0}`).then(ok => { if (!ok) this.relayRecover(); });\n }\n private relayRecover(): void {\n if (!this.rw?.active) return;\n const t = this.rwPosTs ?? this.rwStartMs;\n this.recoveries++; rlog('relay-recover', { n: this.recoveries });\n if (this.recoveries > 2) { this.recoveries--; this.recFallbackMse(t); return; } // hand-over: recFallbackMse counts once more\n this.recWebrtcStart(t);\n }\n private startRelayPoll(): void {\n if (this.relayPoll) return;\n this.cadStart(); this.wdLastCt = -1; this.wdLastAt = Date.now(); this.wdDead = 0; this.wdGrace = Date.now() + 8000;\n this.relayPoll = window.setInterval(() => {\n const s = this.rw; const v = this.v; if (!s?.active || !s.id) return;\n const q = this.presentedFrames();\n if (v.paused && !this.recPaused && !document.hidden) { if (!this.wdResumeLogged) { this.wdResumeLogged = true; rlog('auto-resume', { rs: v.readyState }); } this.safePlay(); } else if (!v.paused) this.wdResumeLogged = false;\n if (!v.paused && !document.hidden && this.rwBase != null) {\n if (q !== this.wdLastCt) { this.wdLastCt = q; this.wdLastAt = Date.now(); this.recoveries = 0; if (!this.posterUntilSeek) this.freezeHide(); if (this.label === 'loading' && !this.swapPending) this.setLabel('playing'); }\n else if (this.rwScrub) this.wdLastAt = Date.now();\n else if (Date.now() - this.wdLastAt > 4000 && Date.now() > this.wdGrace) {\n this.wdLastAt = Date.now();\n const o: any = { ct: Math.round(v.currentTime * 10) / 10, paused: v.paused, muted: v.muted, rs: v.readyState, pf: q, w: v.videoWidth };\n try { s.pc?.getStats().then(st => { st.forEach((r: any) => { if (r.type === 'inbound-rtp' && (r.kind || r.mediaType) === 'video') { o.recv = r.framesReceived; o.dec = r.framesDecoded; o.drop = r.framesDropped; o.pli = r.pliCount; } }); rlog('stall-snap', o); }).catch(() => { /* ignore */ }); } catch { /* ignore */ }\n this.relayRecover(); return;\n }\n } else { this.wdLastCt = q; this.wdLastAt = Date.now(); }\n const seq = this.cmdSeq;\n fetch(this.api.url(`api/relay-pos?session=${encodeURIComponent(s.id)}`), { cache: 'no-store' }).then(r => r.json()).then((d: any) => {\n if (seq !== this.cmdSeq) return; // answered across a seek/rate change → stale\n if (d && d.t > 0 && Date.now() - this.seekAt < 2500 && Math.abs(d.t - this.seekTarget) > 5000) return; // pre-swap position\n if (d && d.t > 0) { this.wdDead = 0; this.rwPosTs = d.t; this.rwPosAt = Date.now(); this.emit(); }\n else if (d && d.t <= 0) { if (++this.wdDead >= 3) { this.wdDead = 0; this.relayRecover(); } }\n }).catch(() => { /* ignore */ });\n }, 600);\n }\n private stopRelayPoll(): void { this.cadStop(); if (this.relayPoll) { clearInterval(this.relayPoll); this.relayPoll = undefined; } }\n private cadStart(): void {\n this.cadStop(); const C = this.cad; C.last = -1; C.frames0 = -1; C.stalls = 0; C.maxStall = 0; C.gapMax = 0; C.t0 = Date.now();\n C.t = window.setInterval(() => {\n if (!this.rw?.active || document.hidden) return;\n const q = this.presentedFrames(), now = Date.now();\n if (this.rwScrub) { C.last = q; C.lastNew = now; return; }\n if (C.frames0 < 0) { C.frames0 = q; C.last = q; C.lastNew = now; return; }\n if (q === C.frames0 && C.last === C.frames0) { C.lastNew = now; return; } // connect phase: no frame yet, not a stall\n if (q > C.last) { const gap = now - C.lastNew; if (gap > C.gapMax) C.gapMax = gap; if (gap >= 400) { C.stalls++; if (gap > C.maxStall) C.maxStall = gap; } C.last = q; C.lastNew = now; }\n if (now - C.t0 >= 30000) {\n const rep: any = { sec: Math.round((now - C.t0) / 1000), frames: C.last - C.frames0, stalls: C.stalls, maxStall: C.maxStall, gapMax: C.gapMax, w: this.v.videoWidth };\n C.t0 = now; C.frames0 = C.last; C.stalls = 0; C.maxStall = 0; C.gapMax = 0;\n const pc = this.rw?.pc;\n if (pc) pc.getStats().then(st => { st.forEach((r: any) => { if (r.type === 'inbound-rtp' && (r.kind || r.mediaType) === 'video') { rep.lost = r.packetsLost; rep.jit = Math.round((r.jitter || 0) * 1000); rep.recv = r.framesReceived; rep.dec = r.framesDecoded; rep.drop = r.framesDropped; } }); rlog('cadence', rep); }).catch(() => rlog('cadence', rep));\n else rlog('cadence', rep);\n }\n }, 100);\n }\n private cadStop(): void { if (this.cad.t) { clearInterval(this.cad.t); this.cad.t = 0; } }\n\n // ---- playAt: relay first, MSE/native fallback ------------------------------------------------\n playAt(ts: number, opts: { scrub?: boolean; srate?: number; noChase?: boolean } = {}): void {\n if (this.destroyed) return;\n const idx0 = this.clipIndexFor(ts);\n if (this.recWebrtcOk()) {\n this.chaseAbort();\n if (idx0 < 0) { this.setLabel('noRecording'); return; }\n this.recPaused = false;\n const t0 = Math.max(ts, this.clips[idx0]!.startTime);\n if (this.rw?.active && this.rw.id) this.recRelaySeek(t0, this.rate || 1, opts.srate || 1);\n else if (this.rw?.active && !this.live) this.rwPending = { ts: t0, rate: this.rate || 1, srate: opts.srate || 1 };\n else { if (this.live) { this.freezeShow(true); this.exitLiveState(); } this.recWebrtcStart(t0); }\n return;\n }\n // ---- MSE fallback / native\n const canChase = !opts.noChase && !this.live && this.M.active && !this.recPaused && this.currentTs() != null && idx0 >= 0;\n this.chaseAbort();\n if (canChase && !opts.scrub) { this.startChase(ts); return; }\n if (idx0 < 0) { this.setLabel('noRecording'); return; }\n if (this.live) { this.freezeShow(true); this.exitLiveState(); }\n this.recPaused = false;\n const clip = this.clips[idx0]!; if (ts < clip.startTime) ts = clip.startTime;\n this.playIndex = idx0;\n this.v.muted = opts.scrub ? true : !this.soundOn;\n if (this.mseSupported()) {\n const t = (ts - this.M.base) / 1000;\n if (this.M.active && t >= 0 && (this.bufferedContains(t) || (t <= this.M.end + 0.5 && this.M.end - t < 95))) { try { this.v.currentTime = t; } catch { /* ignore */ } if (this.v.paused) this.safePlay(); this.feed(); }\n else { if (opts.scrub && Date.now() - this.lastLoad < 200) { this.pendingTs = ts; return; } this.lastLoad = Date.now(); this.mseStart(idx0, (ts - clip.startTime) / 1000); }\n } else {\n const off = Math.min(Math.max((ts - clip.startTime) / 1000, 0), (clip.duration || 0) / 1000);\n if (clip.id === this.curClipId && this.v.src) { try { this.v.currentTime = off; } catch { /* ignore */ } if (this.v.paused) this.safePlay(); }\n else { if (opts.scrub && Date.now() - this.lastLoad < 120) { this.pendingTs = ts; return; } this.freezeShow(); this.lastLoad = Date.now(); this.curClipId = clip.id; this.transport = 'native'; rlog('native-fallback', { clip: clip.id }); this.v.src = this.api.url(`api/segment?id=${encodeURIComponent(clip.videoId || clip.id)}`); this.v.load(); this.v.onloadedmetadata = () => { this.v.playbackRate = this.rate; try { this.v.currentTime = off; } catch { /* ignore */ } this.safePlay(); }; }\n }\n this.setLabel(opts.scrub ? 'scrub' : 'playing');\n }\n\n // ---- MSE recorded ------------------------------------------------------------------------\n private mseSupported(): boolean { try { return !!(this.api.corsMedia && MSCls && this.codecs && MSCls.isTypeSupported(`video/mp4; codecs=\"${this.codecs}\"`)); } catch { return false; } }\n private mseTeardown(): void { const M = this.M; M.active = false; M.nextIdx = -1; M.feeding = false; M.end = 0; M.pendingSeek = null; M.q = []; M.segFirst = false; try { M.abort?.abort(); } catch { /* ignore */ } M.abort = null; if (M.sb && M.ms && M.ms.readyState === 'open') { try { M.sb.abort(); } catch { /* ignore */ } } M.sb = null; M.ms = null; }\n private bufferedContains(t: number): boolean { try { const b = this.v.buffered; for (let i = 0; i < b.length; i++) if (t >= b.start(i) - 0.3 && t <= b.end(i) + 0.3) return true; } catch { /* ignore */ } return false; }\n private mseStart(idx: number, offSec: number): void {\n if (this.destroyed) return;\n this.v.onloadedmetadata = null;\n this.freezeShow(); this.mseTeardown();\n const M = this.M; const ms = new MSCls!(); M.ms = ms; M.active = true; M.base = this.clips[idx]!.startTime; M.nextIdx = idx; M.end = 0; M.mmsGo = true; this.transport = 'mse';\n if ((window as any).ManagedMediaSource && ms instanceof (window as any).ManagedMediaSource) { try { (this.v as any).disableRemotePlayback = true; } catch { /* ignore */ } ms.addEventListener('startstreaming', () => { M.mmsGo = true; this.feed(); }); ms.addEventListener('endstreaming', () => { M.mmsGo = false; }); }\n M.pendingSeek = offSec;\n const u = URL.createObjectURL(ms);\n ms.addEventListener('sourceopen', () => {\n URL.revokeObjectURL(u); if (M.ms !== ms) return;\n let sb: SourceBuffer; try { sb = ms.addSourceBuffer(`video/mp4; codecs=\"${this.codecs}\"`); } catch { this.codecs = null; M.active = false; return; }\n sb.mode = 'segments';\n sb.addEventListener('updateend', () => { if (M.pendingSeek != null && this.v.readyState >= 1) { const t0 = M.pendingSeek; M.pendingSeek = null; try { this.v.currentTime = t0; } catch { /* ignore */ } } this.drain(); if (!M.feeding && !M.q.length) this.feed(); });\n sb.addEventListener('error', () => { M.active = false; });\n M.sb = sb; try { this.v.currentTime = offSec; } catch { /* ignore */ } this.feed();\n });\n try { this.v.srcObject = null; } catch { /* ignore */ }\n this.v.src = u; this.v.playbackRate = this.rate; this.safePlay();\n }\n private drain(): void {\n const M = this.M; if (!M.active || !M.sb || M.sb.updating || !M.q.length) return;\n if (M.segFirst) { M.segFirst = false; try { M.sb.timestampOffset = M.segOff; } catch { try { M.sb.abort(); M.sb.timestampOffset = M.segOff; } catch { M.active = false; return; } } }\n const buf = M.q.shift()!;\n try { M.sb.appendBuffer(buf as BufferSource); } catch { try { M.sb.abort(); M.sb.appendBuffer(buf as BufferSource); } catch { M.active = false; } }\n }\n private feed(): void {\n const M = this.M; if (!M.active || M.feeding) return; if (M.mmsGo === false) return; if (M.nextIdx < 0 || M.nextIdx >= this.clips.length) return;\n if (M.end - this.v.currentTime > 90) return;\n try { const b = this.v.buffered; if (b.length && this.v.currentTime - b.start(0) > 240 && M.sb && !M.sb.updating && !M.q.length) { M.sb.remove(0, this.v.currentTime - 120); return; } } catch { /* ignore */ }\n const clip = this.clips[M.nextIdx]!, ms = M.ms;\n M.feeding = true; M.segFirst = true; M.segOff = (clip.startTime - M.base) / 1000; M.abort = new AbortController();\n fetch(this.api.url(`api/segment?id=${encodeURIComponent(clip.videoId || clip.id)}`), { credentials: 'same-origin', signal: M.abort.signal })\n .then(r => { if (!r.ok || !r.body) throw new Error(String(r.status)); const rd = r.body.getReader(); const loop = () => { rd.read().then(x => { if (M.ms !== ms || !M.active) return; if (x.done) { M.feeding = false; M.nextIdx++; M.end = M.segOff + (clip.duration || 60000) / 1000; if (!M.q.length) this.feed(); return; } M.q.push(x.value); this.drain(); loop(); }).catch(() => { if (M.ms === ms) M.feeding = false; }); }; loop(); })\n .catch(() => { if (M.ms !== ms) return; M.feeding = false; M.nextIdx++; this.feed(); });\n }\n private handleStall(): void { if (this.live || !this.M.active || this.v.paused) return; const t = this.v.currentTime; try { const b = this.v.buffered; for (let i = 0; i < b.length; i++) if (b.start(i) > t && b.start(i) - t < 60) { this.v.currentTime = b.start(i) + 0.05; return; } } catch { /* ignore */ } if (this.M.nextIdx >= this.clips.length) this.opts.onClipsRefresh().then(c => { const cur = this.clips[this.M.nextIdx - 1]; this.clips = c; if (cur) { const i = c.findIndex(x => x.id === cur.id); if (i >= 0) this.M.nextIdx = i + 1; } this.feed(); }).catch(() => { /* ignore */ }); else this.feed(); }\n // trick-play chase inside the MSE buffer\n private chaseAbort(): void { if (!this.CH.active) return; this.CH.active = false; if (this.CH.timer) { clearInterval(this.CH.timer); this.CH.timer = 0; } this.v.playbackRate = this.rate; this.v.muted = !this.soundOn; }\n private endChase(): void { const tgt = this.CH.target; this.chaseAbort(); try { this.v.currentTime = (tgt - this.M.base) / 1000; } catch { /* ignore */ } this.setLabel('playing'); if (this.v.paused) this.safePlay(); }\n private startChase(target: number): void {\n this.chaseAbort(); this.freezeHide(); this.CH.active = true; this.CH.target = target; try { this.v.pause(); } catch { /* ignore */ } this.v.muted = true; this.setLabel('scrub');\n this.CH.timer = window.setInterval(() => {\n if (!this.CH.active) return; const c = this.currentTs(); if (c == null) { this.endChase(); return; }\n const rem = this.CH.target - c; if (Math.abs(rem) <= 250) { this.endChase(); return; }\n let step = rem * 0.2; if (Math.abs(step) < 180) step = rem > 0 ? 180 : -180;\n const nt = c + step, tt = (nt - this.M.base) / 1000;\n if (this.M.active && this.bufferedContains(tt)) { try { this.v.currentTime = tt; } catch { /* ignore */ } this.feed(); } else { this.endChase(); this.playAt(this.CH.target, { noChase: true }); }\n }, 50);\n }\n\n // ---- controls -----------------------------------------------------------------------------\n togglePlayPause(): void {\n if (this.live) return;\n if (this.CH.active) { this.chaseAbort(); try { this.v.pause(); } catch { /* ignore */ } this.emit(); return; }\n if (this.recPaused) { this.recPaused = false; const t = this.recPausedTs ?? (this.currentTs() ?? Date.now() - 1000); this.playAt(t, {}); return; }\n if (this.rw?.active) { this.recPausedTs = this.currentTs(); this.freezeShow(); if (this.freezeT) { clearTimeout(this.freezeT); this.freezeT = 0; } this.recWebrtcTeardown(); try { this.v.pause(); } catch { /* ignore */ } this.recPaused = true; this.transport = 'none'; this.setLabel('paused'); return; }\n if (this.v.paused) this.safePlay(); else this.v.pause();\n }\n skip(ms: number): void { const ts = this.live ? Date.now() + ms : ((this.currentTs() ?? Date.now()) + ms); if (this.live && ms > 0) return; this.playAt(ts, {}); }\n cycleSpeed(): number {\n if (this.live) return this.rate;\n const rates = [1, 2, 4, 8]; this.rate = rates[(rates.indexOf(this.rate) + 1) % rates.length] ?? 1;\n if (this.rw?.active && this.rw.id) { const c = this.currentTs(); this.recRelaySeek(c ?? this.rwStartMs, this.rate); this.v.muted = !this.soundOn || this.rate !== 1; }\n else this.v.playbackRate = this.rate;\n this.emit(); return this.rate;\n }\n setSound(on: boolean): void { this.soundOn = on; this.v.muted = !on || (!!this.rw?.active && this.rate !== 1); if (on && this.v.paused && !this.recPaused) this.safePlay(); this.emit(); }\n snapshot(): void {\n try {\n const src: any = this.live && !this.img.classList.contains('hidden') ? this.img : this.v;\n const w = src.videoWidth || src.naturalWidth || 1280, h = src.videoHeight || src.naturalHeight || 720;\n const cv = document.createElement('canvas'); cv.width = w; cv.height = h; cv.getContext('2d')!.drawImage(src, 0, 0, w, h);\n cv.toBlob(b => { if (!b) return; const a = document.createElement('a'); a.href = URL.createObjectURL(b); const ts = this.currentTs() ?? Date.now(); const d = new Date(ts); a.download = `${(this.camName || 'snapshot').replace(/[^\\w.-]+/g, '_')}_${String(d.getHours()).padStart(2, '0')}${String(d.getMinutes()).padStart(2, '0')}${String(d.getSeconds()).padStart(2, '0')}.jpg`; document.body.appendChild(a); a.click(); a.remove(); setTimeout(() => URL.revokeObjectURL(a.href), 4000); }, 'image/jpeg', 0.92);\n } catch { /* ignore */ }\n }\n private capLog(tag: string, extra?: object): void { try { const v: any = this.v, st: any = this.stage; rlog(tag, { fsReq: !!st.requestFullscreen, wkFs: !!st.webkitRequestFullscreen, vEnter: !!v.webkitEnterFullscreen, pipReq: !!v.requestPictureInPicture, wkPip: !!(v.webkitSupportsPresentationMode && v.webkitSupportsPresentationMode('picture-in-picture')), rs: v.readyState, vw: v.videoWidth, ...(extra || {}) }); } catch { /* ignore */ } }\n pip(): void {\n const v: any = this.v; this.capLog('pip-btn');\n try {\n if (document.pictureInPictureElement || v.webkitPresentationMode === 'picture-in-picture') { if (document.pictureInPictureElement) document.exitPictureInPicture().catch(() => { /* ignore */ }); else v.webkitSetPresentationMode('inline'); return; }\n if (this.v.classList.contains('hidden')) return;\n const wk = () => { try { if (v.webkitSupportsPresentationMode && v.webkitSupportsPresentationMode('picture-in-picture')) v.webkitSetPresentationMode('picture-in-picture'); else this.capLog('pip-unsupported'); } catch (e: any) { this.capLog('pip-fail', { e: String(e?.name || e) }); } };\n if (v.requestPictureInPicture) v.requestPictureInPicture().catch((e: any) => { this.capLog('pip-fail', { e: String(e?.name || e) }); wk(); }); else wk();\n } catch (e: any) { this.capLog('pip-fail', { e: String(e?.name || e) }); }\n }\n fullscreen(): void {\n const st: any = this.stage, v: any = this.v, d: any = document; this.capLog('fs-btn');\n try {\n if (d.fullscreenElement || d.webkitFullscreenElement) { (d.exitFullscreen || d.webkitExitFullscreen).call(d); return; }\n if (st.requestFullscreen) st.requestFullscreen().catch((e: any) => this.capLog('fs-fail', { e: String(e?.name || e) }));\n else if (st.webkitRequestFullscreen) st.webkitRequestFullscreen();\n else if (v.webkitEnterFullscreen && !this.v.classList.contains('hidden')) v.webkitEnterFullscreen();\n else this.capLog('fs-unsupported');\n } catch (e: any) { this.capLog('fs-fail', { e: String(e?.name || e) }); }\n }\n\n // ---- scrub (timeline gesture) ------------------------------------------------------------\n /** first gesture: scrub profile on (relay); MSE: freeze + pause */\n scrubBegin(): void {\n this.chaseAbort();\n if (this.scrubOffT) { clearTimeout(this.scrubOffT); this.scrubOffT = 0; } // gesture continues → stay in the scrub profile\n if (!this.rw?.active) { this.freezeShow(); if (!this.live) { try { this.v.pause(); } catch { /* ignore */ } } }\n // the scrub profile is entered by scrubMove on the first real movement (a single wheel notch = one in-place seek, no restarts)\n }\n /** scroll position + velocity (timeline-ms per wall-s) while the gesture runs */\n scrubMove(_centerTs: number, vel: number, smoothTs: number): void {\n if (!this.rw?.active) { this.freezeHold(); return; }\n if (!this.rw.id) return;\n let r = vel / 1000;\n if (Math.abs(r) < 0.1) return;\n r = Math.min(3000, Math.max(-3000, r));\n r = Math.abs(r) >= 10 ? Math.round(r) : Math.round(r * 10) / 10;\n this.recRelayScrub(true);\n const tgt = this.clampRange(smoothTs), cur = this.currentTs();\n const drift = cur == null ? null : tgt - cur;\n if (drift == null || Math.abs(drift) > Math.max(4500, 1200 * Math.abs(r))) this.scrubSeek(tgt, r);\n else this.recRelayRate(r);\n }\n /** hold / release: land exactly on the centre at 1× (or go live near now) */\n scrubSeek(ts: number, srate = 1): void { if (this.nearNow(ts)) { this.goLive(); return; } this.playAt(this.clampRange(ts), { scrub: true, srate }); }\n /** true between the end of a gesture and its landing/profile switch (SCRUB_OFF_DELAY_MS): the timeline must not auto-follow\n * the playhead in that window — the time-lapse overshot the centre, following would drag the view away and the landing\n * seek would drag it back (visible back-and-forth of the timeline itself) */\n scrubSettling(): boolean { return this.scrubOffT !== 0; }\n /** drift between the timeline centre and the playhead (null without a position) */\n private scrubDrift(ts: number): number | null { const c = this.currentTs(); return c == null ? null : this.clampRange(ts) - c; }\n /** brief hold mid-gesture (relay): time-lapse → 1× in place; a seek only when the picture is far off (each seek = ~2.4 s\n * of stale stream before the new picture — a seek per wheel step made the picture run back and forth). MSE: preview seek. */\n scrubHold(ts: number): void {\n if (!this.rw?.active) { this.scrubSeek(ts); return; }\n if (!this.rw.id) return;\n // the time-lapse overshoots the centre by (reaction time × rate) before the hold is detected — that is inherent and\n // small next to the 2.4 s × rate the picture lags anyway; a seek here would add a visible reversal, so the drift\n // tolerance scales with the rate like scrubMove's\n const d = this.scrubDrift(ts);\n if (d == null || Math.abs(d) > Math.max(SCRUB_HOLD_SEEK_MS, 1200 * Math.abs(this.rwRate))) { this.scrubSeek(ts, 1); return; }\n if (this.rwScrub && this.rwSrate !== 1) this.recRelayRate(1);\n }\n /** gesture settled → after SCRUB_OFF_DELAY_MS of quiet (a new gesture cancels it): land exactly on the centre if the\n * time-lapse drifted, then back to the normal profile. Landing per pause would be a seek per wheel step again. */\n scrubIdle(ts?: number): void {\n if (this.scrubOffT) clearTimeout(this.scrubOffT);\n this.scrubOffT = window.setTimeout(() => {\n this.scrubOffT = 0;\n if (ts != null && this.rw?.active && this.rw.id) { const d = this.scrubDrift(ts); if (d != null && Math.abs(d) > SCRUB_LAND_MS) this.scrubSeek(ts, 1); }\n this.recRelayScrub(false);\n }, SCRUB_OFF_DELAY_MS);\n }\n\n // ---- visibility ---------------------------------------------------------------------------\n private hiddenTs: number | null = null;\n private onVisibility(): void {\n if (document.visibilityState === 'hidden') {\n // don't pin a camera stream in the background; live is simply restarted on return\n if (this.live) { this.hiddenTs = null; this.webrtcTeardown(); this.liveTeardown(); if (this.transport === 'mjpeg') this.img.removeAttribute('src'); }\n else if (this.rw?.active) { this.hiddenTs = this.currentTs(); this.freezeShow(true); this.recWebrtcTeardown(); }\n } else {\n if (this.live) this.goLive(); // also covers goLive() issued while hidden (background tab)\n else if (this.hiddenTs != null && !this.recPaused) { const t = this.hiddenTs; this.hiddenTs = null; this.playAt(t, {}); }\n }\n }\n}\n\n"],"mappings":";AAQA,IAAI,QAAQ;AAEZ,IAAI,SAAgC;AAE7B,SAAS,cAAc,GAA0B,GAAkB;AACxE,WAAS;AACT,MAAI,EAAG,SAAQ;AACjB;AAEO,SAAS,KAAK,KAAa,MAAsC;AACtE,MAAI,CAAC,OAAQ;AACb,MAAI;AACJ,MAAI;AACF,WAAO,KAAK,UAAU,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,MAAM,IAAI,UAAU,UAAU,MAAM,GAAG,EAAE,EAAE,CAAC;AAAA,EAChG,QAAQ;AACN,WAAO,KAAK,UAAU,EAAE,KAAK,GAAG,MAAM,CAAC;AAAA,EACzC;AACA,SAAO,SAAS,iBAAiB,IAAI;AACvC;;;ACRA,IAAI,mBAAmB;AAEhB,SAAS,eAAwB;AACtC,SAAO,8BAA8B,KAAK,UAAU,SAAS,KAAM,UAAU,iBAAiB,KAAK,KAAK,IAAI,OAAO,SAAS,MAAM,OAAO,UAAU,IAAI,IAAI;AAC7J;AACA,SAAS,aAAa;AACpB,MAAI;AACJ,MAAI;AAAE,mBAAe,eAAe,kBAAkB,EAAE,OAAO,eAAe,gBAAgB,OAAO,GAAG,OAAO,eAAe,gBAAgB,OAAO,EAAE,IAAI;AAAA,EAAW,QAAQ;AAAA,EAAa;AAC3L,SAAO,EAAE,WAAW,UAAU,WAAW,cAAc,QAAQ,EAAE,kBAAkB,OAAO,oBAAoB,GAAG,OAAO,OAAO,SAAS,MAAM,QAAQ,OAAO,UAAU,KAAK,EAAE;AAChL;AAEO,IAAM,gBAAN,MAAoB;AAAA,EACzB;AAAA,EAA2B;AAAA,EAAmC;AAAA,EAAwB,SAAS;AAAA,EAC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AAK,GAAG,IAAI;AAAE,cAAM,IAAI,KAAK,WAAW,EAAE;AAAG,YAAI,KAAK,QAAQ,KAAK,IAAI,CAAC,IAAI,cAAe,MAAK,UAAU,IAAI,CAAC;AAAA,MAAG;AACvJ,WAAK,cAAc,KAAK;AAAA,IAC1B,GAAG,kBAAkB;AAAA,EACvB;AAAA;AAAA,EAGQ,WAA0B;AAAA,EAC1B,eAAqB;AAC3B,QAAI,SAAS,oBAAoB,UAAU;AAEzC,UAAI,KAAK,MAAM;AAAE,aAAK,WAAW;AAAM,aAAK,eAAe;AAAG,aAAK,aAAa;AAAG,YAAI,KAAK,cAAc,QAAS,MAAK,IAAI,gBAAgB,KAAK;AAAA,MAAG,WAC3I,KAAK,IAAI,QAAQ;AAAE,aAAK,WAAW,KAAK,UAAU;AAAG,aAAK,WAAW,IAAI;AAAG,aAAK,kBAAkB;AAAA,MAAG;AAAA,IACjH,OAAO;AACL,UAAI,KAAK,KAAM,MAAK,OAAO;AAAA,eAClB,KAAK,YAAY,QAAQ,CAAC,KAAK,WAAW;AAAE,cAAM,IAAI,KAAK;AAAU,aAAK,WAAW;AAAM,aAAK,OAAO,GAAG,CAAC,CAAC;AAAA,MAAG;AAAA,IAC1H;AAAA,EACF;AACF;","names":[]}
@@ -88,6 +88,11 @@ declare class PlayerController {
88
88
  private recoveries;
89
89
  private posterUntilSeek;
90
90
  private seekTarget;
91
+ private swapPending;
92
+ private swapFrames;
93
+ private swapT;
94
+ private posterFor;
95
+ private scrubOffT;
91
96
  private cmdSeq;
92
97
  private seekAt;
93
98
  private w;
@@ -126,7 +131,18 @@ declare class PlayerController {
126
131
  private fcArm;
127
132
  presentedFrames(): number;
128
133
  private freezeArm;
134
+ /** copy the current video picture onto the freeze canvas (false = nothing to copy yet) */
135
+ private drawVideo;
129
136
  freezeShow(hold?: boolean): void;
137
+ /** poster/freeze stays until the seek's picture is visible (swapVisible), 6 s safety net */
138
+ private holdUntilSwap;
139
+ /** Event click inside a running relay session: the current picture stands still at once (the old position must not keep
140
+ * playing while the event frame loads); the event frame replaces it, the picture at the target lifts it. */
141
+ freezeCurrent(): void;
142
+ /** the picture of the last seek is on screen: lift a held poster, report playing */
143
+ private swapVisible;
144
+ /** seek answered: the new picture is on screen SWAP_MS later (plus proof of a presented frame) */
145
+ private swapArm;
130
146
  freezeFromImage(img: HTMLImageElement, hold: boolean, untilSeek?: boolean, kind?: string): boolean;
131
147
  freezeHide(): void;
132
148
  private posterUp;
@@ -196,8 +212,18 @@ declare class PlayerController {
196
212
  scrubMove(_centerTs: number, vel: number, smoothTs: number): void;
197
213
  /** hold / release: land exactly on the centre at 1× (or go live near now) */
198
214
  scrubSeek(ts: number, srate?: number): void;
199
- /** gesture settled → normal profile, base rate */
200
- scrubIdle(): void;
215
+ /** true between the end of a gesture and its landing/profile switch (SCRUB_OFF_DELAY_MS): the timeline must not auto-follow
216
+ * the playhead in that window — the time-lapse overshot the centre, following would drag the view away and the landing
217
+ * seek would drag it back (visible back-and-forth of the timeline itself) */
218
+ scrubSettling(): boolean;
219
+ /** drift between the timeline centre and the playhead (null without a position) */
220
+ private scrubDrift;
221
+ /** brief hold mid-gesture (relay): time-lapse → 1× in place; a seek only when the picture is far off (each seek = ~2.4 s
222
+ * of stale stream before the new picture — a seek per wheel step made the picture run back and forth). MSE: preview seek. */
223
+ scrubHold(ts: number): void;
224
+ /** gesture settled → after SCRUB_OFF_DELAY_MS of quiet (a new gesture cancels it): land exactly on the centre if the
225
+ * time-lapse drifted, then back to the normal profile. Landing per pause would be a seek per wheel step again. */
226
+ scrubIdle(ts?: number): void;
201
227
  private hiddenTs;
202
228
  private onVisibility;
203
229
  }
@@ -1,4 +1,4 @@
1
- export { P as PlayerController, a as PlayerLabel, b as PlayerOptions, c as PlayerRefs, d as PlayerState } from '../controller-DIyehC-x.js';
1
+ export { P as PlayerController, a as PlayerLabel, b as PlayerOptions, c as PlayerRefs, d as PlayerState } from '../controller-D_79fqRP.js';
2
2
  import { e as SentinelClient } from '../client-Dtfs8TX2.js';
3
3
 
4
4
  /**
@@ -4,7 +4,7 @@ import {
4
4
  mobileClient,
5
5
  rlog,
6
6
  setRlogClient
7
- } from "../chunk-VHZTAIPQ.js";
7
+ } from "../chunk-2AXKPVPR.js";
8
8
  export {
9
9
  PlayerController,
10
10
  WebRtcSession,
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { e as SentinelClient, j as SentinelEventClass, l as SentinelRecentEvent, d as SentinelCamera, h as SentinelEvent, o as SentinelStats, f as SentinelClip } from '../client-Dtfs8TX2.js';
4
- import { d as PlayerState } from '../controller-DIyehC-x.js';
4
+ import { d as PlayerState } from '../controller-D_79fqRP.js';
5
5
 
6
6
  /**
7
7
  * Minimal translation core with the same dictionary semantics as HAPulse:
@@ -228,10 +228,14 @@ interface ScrubHandlers {
228
228
  begin: () => void;
229
229
  /** every scroll frame: centre, smoothed velocity (timeline-ms per wall-s), smoothed centre */
230
230
  move: (centerTs: number, vel: number, smoothTs: number) => void;
231
- /** brief hold or release: land on ts at 1× */
231
+ /** release (pointer/touch up after a move): land on ts at 1× */
232
232
  seek: (ts: number) => void;
233
- /** gesture settled → back to auto-follow */
234
- idle: () => void;
233
+ /** brief hold (250 ms without movement) mid-gesture: slow the time-lapse to 1× at the current position; only a large
234
+ * drift becomes a seek — every seek shows ~2.4 s of stale stream before the new picture, so step-wise wheel scrolling
235
+ * with a seek per step made the picture run back and forth (user 23.09.) */
236
+ hold: (centerTs: number) => void;
237
+ /** gesture settled → back to auto-follow; the player lands exactly on centerTs if it drifted */
238
+ idle: (centerTs: number) => void;
235
239
  }
236
240
  interface TimelineProps {
237
241
  camId: string;