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

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