@mega-yfue/eufy-sdk 0.4.0-beta.32 → 0.4.0-beta.33

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
@@ -16246,8 +16246,17 @@ var P2PSession = class _P2PSession extends EventEmitter2 {
16246
16246
  this.send(this.connectAddress, RequestMessageType.DATA, data);
16247
16247
  return true;
16248
16248
  }
16249
- /** Stop the realtime media stream (`CMD_STOP_REALTIME_MEDIA`, 1004) on a camera `channel`. */
16250
- stopLiveMedia(channel = STATION_CHANNEL3, accountId = "") {
16249
+ /**
16250
+ * Stop the realtime media stream (`CMD_STOP_REALTIME_MEDIA`, 1004) on a camera `channel`, in the shape
16251
+ * its runtime topology takes, as {@link startLiveMedia} selects its start:
16252
+ * - `homeBaseAttached`: `CMD_SET_PAYLOAD` (1350) wrapping `{cmd:1004, mChannel:channel}` at level-2.
16253
+ * - own-session at level-2: the direct 1004 frame whose entire plaintext is the camera channel as a
16254
+ * `uint32`, the same 4-byte body as the attached talkback frames. The app sends this frame on closing
16255
+ * an own-session camera's live view; the camera stops streaming on it within a second, and keeps
16256
+ * streaming through the 1350-wrapped form.
16257
+ * - without a level-2 key: the bare 1004 command.
16258
+ */
16259
+ stopLiveMedia(channel = STATION_CHANNEL3, accountId = "", homeBaseAttached = false) {
16251
16260
  this.liveStartedChannels.delete(channel);
16252
16261
  for (const [sequence, pending] of this.unackedLiveStarts) {
16253
16262
  if (pending.channel === channel)
@@ -16257,7 +16266,11 @@ var P2PSession = class _P2PSession extends EventEmitter2 {
16257
16266
  clearInterval(this.liveStartRetransmitTimer);
16258
16267
  this.liveStartRetransmitTimer = void 0;
16259
16268
  }
16260
- if (this.level2Key) {
16269
+ if (this.level2Key && !homeBaseAttached) {
16270
+ const body = Buffer.allocUnsafe(4);
16271
+ body.writeUInt32LE(channel >>> 0, 0);
16272
+ this.sendRawLevel2Bytes(body, channel, CMD_STOP_REALTIME_MEDIA, 8);
16273
+ } else if (this.level2Key) {
16261
16274
  this.sendMediaPayloadLevel2(CMD_STOP_REALTIME_MEDIA, channel, accountId, {});
16262
16275
  } else {
16263
16276
  this.sendCommand(CMD_STOP_REALTIME_MEDIA, channel);
@@ -18023,7 +18036,7 @@ var LiveStream = class extends EventEmitter3 {
18023
18036
  clearTimeout(this.stallTimer);
18024
18037
  this.stallTimer = void 0;
18025
18038
  try {
18026
- this.session.stopLiveMedia(this.opts.channel, this.opts.accountId);
18039
+ this.session.stopLiveMedia(this.opts.channel, this.opts.accountId, this.opts.homeBaseAttached);
18027
18040
  } catch (e) {
18028
18041
  this.logger.debug(`[live] stopLiveMedia ignored: ${e instanceof Error ? e.message : e}`);
18029
18042
  }