@mega-yfue/eufy-sdk 0.6.0-beta.12 → 0.6.0-beta.14

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/dist/index.js CHANGED
@@ -22067,6 +22067,7 @@ var P2P_STATION_WAITS = {
22067
22067
  };
22068
22068
  var RTSP_URL_READ_TIMEOUT_MS = 12e3;
22069
22069
  var TALKBACK_CODEC_WAIT_MS = 3e3;
22070
+ var OWN_LIVE_SESSION_MODELS = /* @__PURE__ */ new Set(["T8030"]);
22070
22071
  var ELD_TALKBACK_MODELS = /* @__PURE__ */ new Set(["T8410C"]);
22071
22072
  function speakerCodec(consumer, talk, timeoutMs) {
22072
22073
  return new Promise((resolve) => {
@@ -22809,8 +22810,9 @@ var P2PCommandRouter = class _P2PCommandRouter {
22809
22810
  * {@link releaseLingeringSiblings}. A pull with consumers is never touched. The release runs before the
22810
22811
  * reuse branch, so a reuse frees the station as a cold start does.
22811
22812
  *
22812
- * `mayOpenOwnSession` decides whether a camera that finds the station's own session claimed may open a
22813
- * connection of its own for it. Only the continuous-pull egresses pass it. A still must not: it wants one
22813
+ * `continuous` decides whether a camera that finds the station's own session claimed may open a
22814
+ * connection of its own for it; on an {@link OWN_LIVE_SESSION_MODELS} station it always gets one, and an
22815
+ * unwatched source left on the station's session is rebuilt there. Only the continuous-pull egresses pass it. A still must not: it wants one
22814
22816
  * frame, and a socket plus a level-2 negotiation per thumbnail is a cost a tile refresh cannot justify —
22815
22817
  * so a still asked for while a sibling is being watched contends as it always did, and the caller's
22816
22818
  * retained image answers it. A live view still outranks a tile; what changed is that two live views no
@@ -22819,22 +22821,23 @@ var P2PCommandRouter = class _P2PCommandRouter {
22819
22821
  * The session goes into a {@link HeldSession} cell, so it can be replaced under a source that stays in
22820
22822
  * place.
22821
22823
  */
22822
- async sharedLiveSourceFor(sn, opts = {}, mayOpenOwnSession = false) {
22824
+ async sharedLiveSourceFor(sn, opts = {}, continuous = false) {
22823
22825
  const { session, parentSn, channel, accountId, homeBaseAttached } = await this.resolveSession(sn, {
22824
22826
  waitLevel2: "soft",
22825
22827
  requireLevel2ForAttached: true,
22826
22828
  signal: opts.signal
22827
22829
  });
22828
22830
  const key = `${parentSn}:${channel}`;
22831
+ const ownSession = continuous && homeBaseAttached && this.ownsLiveSession(parentSn);
22829
22832
  let source = this.liveSources.get(key);
22830
- if (source && source.state === "stopped") {
22833
+ if (source && (source.state === "stopped" || ownSession && source.state !== "idle" && source.consumerCount === 0 && this.liveSessionKeys.get(key) === parentSn)) {
22831
22834
  this.dropLiveSource(key);
22832
22835
  source = void 0;
22833
22836
  }
22834
22837
  this.releaseLingeringSiblings(parentSn, channel);
22835
22838
  if (!source) {
22836
22839
  const logger = this.deps.logger ?? noopLogger;
22837
- const sessionKey = mayOpenOwnSession && homeBaseAttached && this.stationSessionInUse(parentSn, key) ? _P2PCommandRouter.mediaSessionKey(parentSn, channel) : parentSn;
22840
+ const sessionKey = ownSession || continuous && homeBaseAttached && this.stationSessionInUse(parentSn, key) ? _P2PCommandRouter.mediaSessionKey(parentSn, channel) : parentSn;
22838
22841
  this.liveSessionKeys.set(key, sessionKey);
22839
22842
  let held;
22840
22843
  try {
@@ -23128,11 +23131,18 @@ var P2PCommandRouter = class _P2PCommandRouter {
23128
23131
  * yield CMAF fragments (init segment first, then a `moof`+`mdat` per keyframe boundary) muxed by the
23129
23132
  * dependency-free internal fMP4 muxer. The returned recording handle exposes battery-budget notices
23130
23133
  * and detaches its consumer on `stop`, iterator return, or iterator throw. No ffmpeg.
23134
+ *
23135
+ * It is a continuous pull only on an {@link OWN_LIVE_SESSION_MODELS} station; elsewhere it never opens a
23136
+ * connection of its own.
23131
23137
  */
23132
23138
  recordFragments(sn, opts = {}) {
23133
- const source = this.sharedLiveSourceFor(sn, opts);
23139
+ const source = this.sharedLiveSourceFor(sn, opts, this.ownsLiveSession(this.stationKeyOf(sn)));
23134
23140
  return new FragmentRecording(source, opts);
23135
23141
  }
23142
+ /** Whether `stationSn` is an {@link OWN_LIVE_SESSION_MODELS} station. */
23143
+ ownsLiveSession(stationSn) {
23144
+ return OWN_LIVE_SESSION_MODELS.has(this.recordFor(stationSn)?.model ?? "");
23145
+ }
23136
23146
  /**
23137
23147
  * **Generic P2P request/reply query.** Sends a `SET_PAYLOAD` (1350) wrapper carrying `subCmd` on the
23138
23148
  * device channel, then resolves with the reply frame's `payload` — the `NOTIFY_PAYLOAD` (1351)