@apocaliss92/nodelink-js 0.4.14 → 0.4.16

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.d.cts CHANGED
@@ -5499,9 +5499,7 @@ declare class ReolinkBaichuanApi {
5499
5499
  private simpleEventSubscribed;
5500
5500
  private readonly detectionEventListeners;
5501
5501
  private readonly detectionEventStreamHooks;
5502
- private readonly objectDetectionListeners;
5503
- private objectDetectionStream;
5504
- private objectDetectionStreamStartInFlight;
5502
+ private readonly objectDetectionSubs;
5505
5503
  private objectDetectionInternalListener;
5506
5504
  private simpleEventSubscribeInFlight;
5507
5505
  private simpleEventUnsubscribeInFlight;
@@ -5943,21 +5941,40 @@ declare class ReolinkBaichuanApi {
5943
5941
  * Subscribe to AI object detections (people / vehicle / animal / face boxes
5944
5942
  * with class label and confidence) without managing a video stream yourself.
5945
5943
  *
5946
- * Mirrors {@link onSimpleEvent} end-to-end: the API opens a dedicated
5947
- * substream behind the scenes on the first listener, forwards every box-bearing
5948
- * `additionalHeader` to your callback, and tears the stream down when the last
5949
- * listener unsubscribes. The substream is the lightest profile (typically
5950
- * 640×360) so the additional bandwidth/CPU overhead is minimal.
5944
+ * Mirrors {@link onSimpleEvent} end-to-end: on the first listener for a given
5945
+ * `(channel, profile)` tuple the API ensures the corresponding video stream
5946
+ * is running (the pool socket may already be shared with a regular consumer),
5947
+ * forwards every box-bearing `additionalHeader` to your callback, and tears
5948
+ * the stream down when the last listener for that tuple unsubscribes.
5949
+ *
5950
+ * Defaults — `channel: 0`, `profile: "sub"` — match a single-lens standalone
5951
+ * camera. **For NVR/Hub child cameras you must pass the channel explicitly**,
5952
+ * otherwise the substream opens on channel 0 and never sees the AI boxes for
5953
+ * the other channels. The `sub` profile is recommended (lighter bandwidth)
5954
+ * but `main` / `ext` are accepted if you specifically need detections off a
5955
+ * different feed.
5951
5956
  *
5952
5957
  * Each event carries normalized `[0, 1]` box coordinates, a class label, and
5953
5958
  * a confidence score — render-ready without further conversion.
5954
5959
  */
5955
- onObjectDetections(callback: (event: ReolinkDetectionEvent) => void | Promise<void>): Promise<void>;
5960
+ onObjectDetections(callback: (event: ReolinkDetectionEvent) => void | Promise<void>, options?: {
5961
+ channel?: number;
5962
+ profile?: "main" | "sub" | "ext";
5963
+ }): Promise<void>;
5956
5964
  /**
5957
- * Remove one detection callback, or all of them if `callback` is omitted.
5958
- * When the last listener is removed the auto-managed substream is closed.
5965
+ * Remove a detection callback for a given `(channel, profile)` tuple — or,
5966
+ * if `options` is omitted, remove the callback from every active tuple. When
5967
+ * `callback` is also omitted, every listener on the targeted tuples is
5968
+ * cleared. The auto-managed substream of a tuple is closed when its last
5969
+ * listener is removed.
5959
5970
  */
5960
- offObjectDetections(callback?: (event: ReolinkDetectionEvent) => void | Promise<void>): Promise<void>;
5971
+ offObjectDetections(callback?: (event: ReolinkDetectionEvent) => void | Promise<void>, options?: {
5972
+ channel?: number;
5973
+ profile?: "main" | "sub" | "ext";
5974
+ }): Promise<void>;
5975
+ private objectDetectionKey;
5976
+ private ensureObjectDetectionInternalListener;
5977
+ private maybeDropObjectDetectionInternalListener;
5961
5978
  private ensureObjectDetectionStream;
5962
5979
  private tearDownObjectDetectionStream;
5963
5980
  /**
package/dist/index.d.ts CHANGED
@@ -6414,9 +6414,7 @@ export declare class ReolinkBaichuanApi {
6414
6414
  private simpleEventSubscribed;
6415
6415
  private readonly detectionEventListeners;
6416
6416
  private readonly detectionEventStreamHooks;
6417
- private readonly objectDetectionListeners;
6418
- private objectDetectionStream;
6419
- private objectDetectionStreamStartInFlight;
6417
+ private readonly objectDetectionSubs;
6420
6418
  private objectDetectionInternalListener;
6421
6419
  private simpleEventSubscribeInFlight;
6422
6420
  private simpleEventUnsubscribeInFlight;
@@ -6858,21 +6856,40 @@ export declare class ReolinkBaichuanApi {
6858
6856
  * Subscribe to AI object detections (people / vehicle / animal / face boxes
6859
6857
  * with class label and confidence) without managing a video stream yourself.
6860
6858
  *
6861
- * Mirrors {@link onSimpleEvent} end-to-end: the API opens a dedicated
6862
- * substream behind the scenes on the first listener, forwards every box-bearing
6863
- * `additionalHeader` to your callback, and tears the stream down when the last
6864
- * listener unsubscribes. The substream is the lightest profile (typically
6865
- * 640×360) so the additional bandwidth/CPU overhead is minimal.
6859
+ * Mirrors {@link onSimpleEvent} end-to-end: on the first listener for a given
6860
+ * `(channel, profile)` tuple the API ensures the corresponding video stream
6861
+ * is running (the pool socket may already be shared with a regular consumer),
6862
+ * forwards every box-bearing `additionalHeader` to your callback, and tears
6863
+ * the stream down when the last listener for that tuple unsubscribes.
6864
+ *
6865
+ * Defaults — `channel: 0`, `profile: "sub"` — match a single-lens standalone
6866
+ * camera. **For NVR/Hub child cameras you must pass the channel explicitly**,
6867
+ * otherwise the substream opens on channel 0 and never sees the AI boxes for
6868
+ * the other channels. The `sub` profile is recommended (lighter bandwidth)
6869
+ * but `main` / `ext` are accepted if you specifically need detections off a
6870
+ * different feed.
6866
6871
  *
6867
6872
  * Each event carries normalized `[0, 1]` box coordinates, a class label, and
6868
6873
  * a confidence score — render-ready without further conversion.
6869
6874
  */
6870
- onObjectDetections(callback: (event: ReolinkDetectionEvent) => void | Promise<void>): Promise<void>;
6875
+ onObjectDetections(callback: (event: ReolinkDetectionEvent) => void | Promise<void>, options?: {
6876
+ channel?: number;
6877
+ profile?: "main" | "sub" | "ext";
6878
+ }): Promise<void>;
6871
6879
  /**
6872
- * Remove one detection callback, or all of them if `callback` is omitted.
6873
- * When the last listener is removed the auto-managed substream is closed.
6880
+ * Remove a detection callback for a given `(channel, profile)` tuple — or,
6881
+ * if `options` is omitted, remove the callback from every active tuple. When
6882
+ * `callback` is also omitted, every listener on the targeted tuples is
6883
+ * cleared. The auto-managed substream of a tuple is closed when its last
6884
+ * listener is removed.
6874
6885
  */
6875
- offObjectDetections(callback?: (event: ReolinkDetectionEvent) => void | Promise<void>): Promise<void>;
6886
+ offObjectDetections(callback?: (event: ReolinkDetectionEvent) => void | Promise<void>, options?: {
6887
+ channel?: number;
6888
+ profile?: "main" | "sub" | "ext";
6889
+ }): Promise<void>;
6890
+ private objectDetectionKey;
6891
+ private ensureObjectDetectionInternalListener;
6892
+ private maybeDropObjectDetectionInternalListener;
6876
6893
  private ensureObjectDetectionStream;
6877
6894
  private tearDownObjectDetectionStream;
6878
6895
  /**
package/dist/index.js CHANGED
@@ -45,7 +45,7 @@ import {
45
45
  parseSupportXml,
46
46
  setGlobalLogger,
47
47
  xmlIndicatesFloodlight
48
- } from "./chunk-WKETZFBI.js";
48
+ } from "./chunk-65HTCC62.js";
49
49
  import {
50
50
  ReolinkCgiApi,
51
51
  ReolinkHttpClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apocaliss92/nodelink-js",
3
- "version": "0.4.14",
3
+ "version": "0.4.16",
4
4
  "description": "TypeScript library implementing Reolink Baichuan protocol (control + streaming) with CGI and RTSP helpers. Full TypeScript support with comprehensive type definitions.",
5
5
  "license": "MIT",
6
6
  "author": "",