@camera.ui/browser 0.0.74 → 0.0.76

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.
Files changed (49) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/types/packages/client/browser/src/types.d.ts +1 -1
  3. package/dist/types/server/src/api/controllers/cameras.controller.d.ts +5 -5
  4. package/dist/types/server/src/api/controllers/frameWorkers.controller.d.ts +16 -0
  5. package/dist/types/server/src/api/database/types.d.ts +23 -5
  6. package/dist/types/server/src/api/routes/frameWorkers.routes.d.ts +2 -0
  7. package/dist/types/server/src/api/schemas/cameras.schema.d.ts +231 -158
  8. package/dist/types/server/src/api/schemas/go2rtc.schema.d.ts +105 -6
  9. package/dist/types/server/src/api/schemas/users.schema.d.ts +2 -2
  10. package/dist/types/server/src/api/services/auth.service.d.ts +0 -1
  11. package/dist/types/server/src/api/services/cameras.service.d.ts +4 -3
  12. package/dist/types/server/src/api/services/plugins.service.d.ts +0 -1
  13. package/dist/types/server/src/api/services/users.service.d.ts +0 -1
  14. package/dist/types/server/src/api/types/index.d.ts +14 -6
  15. package/dist/types/server/src/api/websocket/nsp/frameWorker.d.ts +13 -0
  16. package/dist/types/server/src/api/websocket/nsp/metrics.d.ts +6 -1
  17. package/dist/types/server/src/api/websocket/nsp/status.d.ts +6 -0
  18. package/dist/types/server/src/api/websocket/types.d.ts +6 -2
  19. package/dist/types/server/src/api.d.ts +1 -1
  20. package/dist/types/server/src/camera/{controller/index.d.ts → controller.d.ts} +10 -7
  21. package/dist/types/server/src/camera/{cameraDevice.d.ts → device.d.ts} +11 -3
  22. package/dist/types/server/src/camera/index.d.ts +21 -15
  23. package/dist/types/server/src/camera/polygon.d.ts +3 -0
  24. package/dist/types/server/src/camera/streaming/peer-connection.d.ts +2 -2
  25. package/dist/types/server/src/camera/streaming/streaming-session.d.ts +2 -2
  26. package/dist/types/server/src/camera/streaming/webrtc-connection.d.ts +2 -2
  27. package/dist/types/server/src/camera/{controller/types.d.ts → types.d.ts} +22 -13
  28. package/dist/types/server/src/camera/videoFrame.d.ts +25 -0
  29. package/dist/types/server/src/decoder/index.d.ts +1 -12
  30. package/dist/types/server/src/decoder/types.d.ts +40 -11
  31. package/dist/types/server/src/decoder/worker.d.ts +16 -16
  32. package/dist/types/server/src/nats/constants.d.ts +0 -1
  33. package/dist/types/server/src/nats/index.d.ts +2 -2
  34. package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +2 -7
  35. package/dist/types/server/src/nats/proxy/deviceManager.d.ts +1 -1
  36. package/dist/types/server/src/nats/server.d.ts +4 -2
  37. package/dist/types/server/src/nats/types.d.ts +6 -10
  38. package/dist/types/server/src/nats/websocket.d.ts +1 -1
  39. package/dist/types/server/src/plugins/base.d.ts +1 -1
  40. package/dist/types/server/src/plugins/types.d.ts +2 -0
  41. package/dist/types/server/src/polyglot/node/plugins/api.d.ts +1 -1
  42. package/dist/types/server/src/polyglot/node/plugins/proxy/cameraDevice.d.ts +34 -19
  43. package/dist/types/server/src/polyglot/node/plugins/proxy/deviceManager.d.ts +11 -9
  44. package/dist/types/server/src/polyglot/node/plugins/proxy/pluginsManager.d.ts +8 -7
  45. package/dist/types/server/src/polyglot/node/plugins/proxy/queue.d.ts +3 -1
  46. package/dist/types/server/src/polyglot/node/plugins/proxy/systemManager.d.ts +8 -7
  47. package/dist/types/server/src/services/config/types.d.ts +8 -0
  48. package/dist/types/shared/types/index.d.ts +3 -1
  49. package/package.json +5 -5
@@ -1,12 +1,13 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  import type { Observable } from 'rxjs';
3
- import type { CameraInformation, CameraInput, CameraInputSettings } from '../../api/database/types.js';
3
+ import type { CameraInformation, CameraInput, CameraInputSettings, Point, ZoneFilter, ZoneType } from '../api/database/types.js';
4
4
  export interface BaseLogger {
5
5
  log: (...args: any[]) => void;
6
6
  error: (...args: any[]) => void;
7
7
  warn: (...args: any[]) => void;
8
8
  debug: (...args: any[]) => void;
9
9
  trace: (...args: any[]) => void;
10
+ attention: (...args: any[]) => void;
10
11
  }
11
12
  export type SpawnInput = string | number;
12
13
  export interface FfmpegOptions {
@@ -15,7 +16,7 @@ export interface FfmpegOptions {
15
16
  audio?: SpawnInput[];
16
17
  output: SpawnInput[];
17
18
  }
18
- export type PrebufferContainer = 'mp4' | 'mpegts';
19
+ export type Container = 'mp4' | 'mpegts';
19
20
  export interface BasePrebufferState {
20
21
  maxDuration: number;
21
22
  availableDuration: number;
@@ -29,9 +30,9 @@ export interface PrebufferStateFalse extends BasePrebufferState {
29
30
  }
30
31
  export type PrebufferState = PrebufferStateTrue | PrebufferStateFalse;
31
32
  export interface CameraSource extends CameraInput {
32
- updatePrebufferingState(container: PrebufferContainer, state: PrebufferState): Promise<void>;
33
- getPrebufferingState(container: PrebufferContainer): PrebufferState;
34
- onPrebuffering(container: PrebufferContainer): Observable<PrebufferState>;
33
+ updatePrebufferingState(container: Container, state: PrebufferState): Promise<void>;
34
+ getPrebufferingState(container: Container): PrebufferState;
35
+ onPrebuffering(container: Container): Observable<PrebufferState>;
35
36
  getStreamInfo(): Promise<StreamInfo | undefined>;
36
37
  }
37
38
  export interface CameraPrebufferDelegate {
@@ -98,9 +99,9 @@ export type CameraConfig = (BaseCameraConfig & {
98
99
  }) | (BaseCameraConfig & {
99
100
  delegate?: CameraDelegate;
100
101
  });
101
- export interface BaseDetection {
102
+ export interface Detection {
102
103
  id?: string;
103
- label: string;
104
+ label: ObjectClasses;
104
105
  confidence: number;
105
106
  boundingBox: [number, number, number, number];
106
107
  inputWidth: number;
@@ -108,24 +109,29 @@ export interface BaseDetection {
108
109
  origWidth: number;
109
110
  origHeight: number;
110
111
  }
111
- export interface MotionDetection extends BaseDetection {
112
- }
113
- export interface ObjectDetection extends BaseDetection {
112
+ export interface DetectionZone {
113
+ name: string;
114
+ points: Point[];
115
+ type: ZoneType;
116
+ filter: ZoneFilter;
117
+ classes: ObjectClasses[];
118
+ isPrivacyMask: boolean;
114
119
  }
120
+ export type ObjectClasses = 'person' | 'bicycle' | 'car' | 'motorcycle' | 'airplane' | 'bus' | 'train' | 'truck' | 'boat' | 'traffic light' | 'fire hydrant' | 'stop sign' | 'parking meter' | 'bench' | 'bird' | 'cat' | 'dog' | 'horse' | 'sheep' | 'cow' | 'elephant' | 'bear' | 'zebra' | 'giraffe' | 'backpack' | 'umbrella' | 'handbag' | 'tie' | 'suitcase' | 'frisbee' | 'skis' | 'snowboard' | 'sports ball' | 'kite' | 'baseball bat' | 'baseball glove' | 'skateboard' | 'surfboard' | 'tennis racket' | 'bottle' | 'wine glass' | 'cup' | 'fork' | 'knife' | 'spoon' | 'bowl' | 'banana' | 'apple' | 'sandwich' | 'orange' | 'broccoli' | 'carrot' | 'hot dog' | 'pizza' | 'donut' | 'cake' | 'chair' | 'couch' | 'potted plant' | 'bed' | 'dining table' | 'toilet' | 'tv' | 'laptop' | 'mouse' | 'remote' | 'keyboard' | 'cell phone' | 'microwave' | 'oven' | 'toaster' | 'sink' | 'refrigerator' | 'book' | 'clock' | 'vase' | 'scissors' | 'teddy bear' | 'hair drier' | 'toothbrush' | 'motion';
115
121
  export interface BaseState<T extends LightState | AudioState | MotionState | ObjectState | SirenState | BatteryState | DoorbellState> {
116
122
  timestamp: string;
117
123
  lastEvent?: Omit<T, 'lastEvent'>;
118
124
  }
119
125
  export interface MotionSetEvent {
120
- state: boolean;
121
- detections: MotionDetection[];
126
+ state?: boolean;
127
+ detections: Detection[];
122
128
  }
123
129
  export interface AudioSetEvent {
124
130
  state: boolean;
125
131
  db?: number;
126
132
  }
127
133
  export interface ObjectSetEvent {
128
- detections: ObjectDetection[];
134
+ detections: Detection[];
129
135
  }
130
136
  export interface LightSetEvent {
131
137
  state: boolean;
@@ -149,6 +155,9 @@ export type DoorbellState = BaseState<DoorbellState> & DoorbellSetEvent;
149
155
  export type SirenState = BaseState<SirenState> & SirenSetEvent;
150
156
  export type ObjectState = BaseState<ObjectState> & ObjectSetEvent;
151
157
  export type BatteryState = BaseState<BatteryState> & BatterySetEvent;
158
+ export interface FrameState extends MotionState {
159
+ frame: Buffer;
160
+ }
152
161
  export type States = LightState | MotionState | AudioState | ObjectState | DoorbellState | SirenState | BatteryState;
153
162
  export type Sets = LightSetEvent | MotionSetEvent | AudioSetEvent | ObjectSetEvent | DoorbellSetEvent | SirenSetEvent | BatterySetEvent;
154
163
  export interface StateValues {
@@ -0,0 +1,25 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import type { NatsConnection } from 'nats';
3
+ import type { FrameBuffer, FrameImage, FrameMetadata, ImageOptions, MotionFrame as MotionFrameMethods, VideoFrame as VideoFrameMethods } from '../decoder/types.js';
4
+ import type { MotionState } from './types.js';
5
+ export declare class VideoFrame implements VideoFrameMethods {
6
+ readonly imageBuffer: Buffer;
7
+ private frameGeneratorSubject;
8
+ private publisher;
9
+ private _metadata;
10
+ get metadata(): FrameMetadata;
11
+ get inputWidth(): number;
12
+ get inputHeight(): number;
13
+ get inputFormat(): string;
14
+ constructor(cameraId: string, publisher: NatsConnection, imageBuffer: Buffer, metadata: FrameMetadata);
15
+ toBuffer(options?: ImageOptions): Promise<FrameBuffer>;
16
+ toImage(options?: ImageOptions): Promise<FrameImage>;
17
+ save(path: string, options?: ImageOptions | undefined): Promise<void>;
18
+ private send;
19
+ private getImageInformation;
20
+ private validateOptions;
21
+ }
22
+ export declare class MotionFrame extends VideoFrame implements MotionFrameMethods {
23
+ motion: MotionState;
24
+ constructor(cameraId: string, publisher: NatsConnection, imageBuffer: Buffer, motionState: MotionState, metadata: FrameMetadata);
25
+ }
@@ -1,22 +1,11 @@
1
1
  import { FrameWorker } from './worker.js';
2
- import type { CameraController } from '../camera/controller/index.js';
2
+ import type { CameraController } from '../camera/controller.js';
3
3
  export declare class FrameManager {
4
4
  frameWorkers: Map<string, FrameWorker>;
5
- private initialized;
6
5
  private api;
7
6
  private proxyServer;
8
7
  private logger;
9
- private publisher?;
10
- private subscriber?;
11
- private subject;
12
8
  constructor();
13
- init(): Promise<void>;
14
9
  addCamera(camera: CameraController): Promise<FrameWorker>;
15
10
  removeCamera(camera: CameraController): Promise<void>;
16
- private handleConnectMessage;
17
- private handleDisconnectMessage;
18
- private disconnectClient;
19
- private disconnectAllClients;
20
- private startPingPongForClient;
21
- private listenToMessages;
22
11
  }
@@ -2,6 +2,7 @@
2
2
  /// <reference types="node" resolution-mode="require"/>
3
3
  import type { ChildProcess } from 'node:child_process';
4
4
  import type { Sharp } from 'sharp';
5
+ import type { MotionState } from '../camera/types.js';
5
6
  export interface FrameMetadata {
6
7
  format: string;
7
8
  frameSize: number;
@@ -20,9 +21,6 @@ export interface ImageResize {
20
21
  width?: number;
21
22
  height?: number;
22
23
  }
23
- export interface ImageRotate {
24
- angle: number;
25
- }
26
24
  export interface ImageFormat {
27
25
  to: 'rgba' | 'gray';
28
26
  }
@@ -30,19 +28,36 @@ export interface ImageOptions {
30
28
  format?: ImageFormat;
31
29
  crop?: ImageCrop;
32
30
  resize?: ImageResize;
33
- rotate?: ImageRotate;
34
31
  }
35
32
  export interface ProcessImageRequest {
36
33
  options: ImageOptions;
37
34
  data: Buffer;
38
35
  }
36
+ export interface ImageInformation {
37
+ width: number;
38
+ height: number;
39
+ channels: number;
40
+ }
41
+ export interface FrameBuffer {
42
+ image: Buffer;
43
+ info: ImageInformation;
44
+ }
45
+ export interface FrameImage {
46
+ image: Sharp;
47
+ info: ImageInformation;
48
+ }
39
49
  export interface VideoFrame {
50
+ readonly imageBuffer: Buffer;
40
51
  metadata: FrameMetadata;
41
52
  inputWidth: number;
42
53
  inputHeight: number;
43
54
  inputFormat: string;
44
- toBuffer: (options?: ImageOptions) => Promise<Buffer>;
45
- toImage: (options?: ImageOptions) => Promise<Sharp>;
55
+ toBuffer: (options?: ImageOptions) => Promise<FrameBuffer>;
56
+ toImage: (options?: ImageOptions) => Promise<FrameImage>;
57
+ save: (path: string, options?: ImageOptions) => Promise<void>;
58
+ }
59
+ export interface MotionFrame extends VideoFrame {
60
+ motion: MotionState;
46
61
  }
47
62
  export interface VideoSession {
48
63
  isActive(): boolean;
@@ -60,9 +75,11 @@ export interface BaseFrameWorkerConfig {
60
75
  user: string;
61
76
  pass: string;
62
77
  };
78
+ proxyPort: number;
79
+ useWasm: boolean;
63
80
  }
64
- export type WorkerMessage = 'started' | 'getFFmpegArgs';
65
- export type MainMessage = 'getMetadata' | 'startVideoSession' | 'stopVideoSession' | 'setCameraName';
81
+ export type WorkerMessage = 'started' | 'getFFmpegArgs' | 'updateClient' | 'removeClient' | 'clearClients';
82
+ export type MainMessage = 'setCameraName' | 'recoverClients';
66
83
  export interface MainToWorkerMessage {
67
84
  message: MainMessage;
68
85
  data: Record<string, any>;
@@ -78,15 +95,15 @@ export interface MainToWorkerResponse {
78
95
  response?: Record<string, any>;
79
96
  }
80
97
  export interface SignalingRequest {
81
- type: 'connect' | 'disconnect';
98
+ type: 'connect' | 'disconnect' | 'metadata';
82
99
  requestId: string;
83
100
  cameraId: string;
84
101
  pluginId: string;
85
102
  }
86
103
  export interface SignalingResponse {
87
- type: 'connected' | 'disconnected' | 'error';
104
+ type: 'connected' | 'disconnected' | 'metadata';
88
105
  requestId: string;
89
- message?: string;
106
+ metadata?: FrameMetadata;
90
107
  }
91
108
  export interface PingMessage {
92
109
  type: 'ping';
@@ -109,3 +126,15 @@ export interface FfmpegArgs {
109
126
  hwaccelFilter: string;
110
127
  threads: string;
111
128
  }
129
+ export interface FrameWorkerClient {
130
+ pluginId: string;
131
+ requestIds: string[];
132
+ }
133
+ export interface RecoveredClient {
134
+ pluginId: string;
135
+ requestIds: string[];
136
+ }
137
+ export interface PrebufferContainer {
138
+ time: number;
139
+ frame: Buffer;
140
+ }
@@ -1,13 +1,10 @@
1
1
  import { Subscribed } from '../utils/subscribed.js';
2
- import type { CameraController } from '../camera/controller/index.js';
3
- import type { FrameMetadata } from './types.js';
4
- interface FrameWorkerClient {
5
- pluginId: string;
6
- requestIds: string[];
7
- }
2
+ import type { CameraController } from '../camera/controller.js';
3
+ import { PLUGIN_STATUS } from '../plugins/types.js';
8
4
  export declare class FrameWorker extends Subscribed {
9
5
  token: string;
10
- readonly clients: Map<string, FrameWorkerClient>;
6
+ name: string;
7
+ private readonly clients;
11
8
  private subject;
12
9
  private ipcSubject;
13
10
  private frameWorkerId;
@@ -15,28 +12,31 @@ export declare class FrameWorker extends Subscribed {
15
12
  private subscriber?;
16
13
  private logger;
17
14
  private configService;
15
+ private socketService;
18
16
  private camera;
19
17
  private frameWorker?;
20
18
  private initialized;
21
19
  private stopped;
20
+ private restarting;
22
21
  private auth;
22
+ private proxyPort;
23
23
  private ffmpegArgs;
24
24
  private py;
25
- constructor(camera: CameraController, auth: {
25
+ private _status;
26
+ get status(): PLUGIN_STATUS;
27
+ constructor(camera: CameraController, proxyPort: number, auth: {
26
28
  user: string;
27
29
  pass: string;
28
30
  });
29
- init(): Promise<void>;
31
+ start(): Promise<void>;
30
32
  close(): Promise<void>;
31
- workerPID(): number;
32
- getMetadata(): Promise<FrameMetadata>;
33
- addClient(pluginId: string, requestId: string): Promise<void>;
34
- removeClient(pluginId: string, requestId: string): Promise<void>;
35
- private startVideoSession;
36
- private stopVideoSession;
33
+ restart(): Promise<void>;
34
+ getPID(): number;
37
35
  private startWorker;
36
+ private restartWorker;
37
+ private killWorker;
38
38
  private sendMessage;
39
39
  private listenToMessages;
40
+ private setStatus;
40
41
  private getLogPrefix;
41
42
  }
42
- export {};
@@ -1,2 +1 @@
1
1
  export declare const NATS_SERVER_SUBJECT = "camera.ui-server";
2
- export declare const NATS_SIGNALING_SUBJECT = "camera.ui-signaling";
@@ -2,7 +2,7 @@ import { type NatsConnection, type Subscription } from 'nats';
2
2
  import { CameraDeviceProxy } from './proxy/cameraDevice.js';
3
3
  import { DeviceManagerProxy, PluginsManagerProxy, SystemManagerProxy } from './proxy/index.js';
4
4
  import { NatsServer } from './server.js';
5
- import type { StateValues } from '../camera/controller/types.js';
5
+ import type { StateValues } from '../camera/types.js';
6
6
  import type { CameraDeviceListenerMessagePayload, DeviceManagerProxyEvents, PluginsManagerProxyEvents, ProxyAuth, SystemManagerProxyEvents } from './types.js';
7
7
  import type { WebsocketProxy } from './websocket.js';
8
8
  export declare class ProxyServer {
@@ -16,7 +16,7 @@ export declare class ProxyServer {
16
16
  server: NatsServer;
17
17
  publisher?: NatsConnection;
18
18
  subscriber?: Subscription;
19
- private messageQueue;
19
+ private messageQueue?;
20
20
  private initialized;
21
21
  auth: ProxyAuth;
22
22
  constructor();
@@ -1,7 +1,6 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  import type { Camera } from '../../api/database/types.js';
3
- import type { CameraDelegate, CameraPrebufferDelegate, FfmpegOptions, PrebufferContainer, PrebufferState, SetValues, StateValues, StreamInfo } from '../../camera/controller/types.js';
4
- import type { FrameMetadata } from '../../decoder/types.js';
3
+ import type { CameraDelegate, CameraPrebufferDelegate, Container, FfmpegOptions, PrebufferState, SetValues, StateValues, StreamInfo } from '../../camera/types.js';
5
4
  import type { IceServer } from '../../services/config/types.js';
6
5
  import type { MessageQueue } from '../queue.js';
7
6
  import type { CameraDeviceProxyMethods, ProxyMessageStructure } from '../types.js';
@@ -30,10 +29,6 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
30
29
  cameraId: string;
31
30
  pluginId: string;
32
31
  }): Promise<StreamInfo | undefined>;
33
- getFrameMetadata(data: {
34
- cameraId: string;
35
- pluginId: string;
36
- }): Promise<FrameMetadata>;
37
32
  getFfmpegPath(): string;
38
33
  getIceServers(): IceServer[];
39
34
  snapshot(data: {
@@ -62,7 +57,7 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
62
57
  }): Promise<void>;
63
58
  updatePrebufferState(data: {
64
59
  sourceId: string;
65
- container: PrebufferContainer;
60
+ container: Container;
66
61
  state: PrebufferState;
67
62
  cameraId: string;
68
63
  pluginId: string;
@@ -1,5 +1,5 @@
1
1
  import type { Camera } from '../../api/database/types.js';
2
- import type { CameraConfig } from '../../camera/controller/types.js';
2
+ import type { CameraConfig } from '../../camera/types.js';
3
3
  import type { MessageQueue } from '../queue.js';
4
4
  import type { DeviceManagerServerProxyMethods, ProxyMessageStructure } from '../types.js';
5
5
  export declare class DeviceManagerProxy implements DeviceManagerServerProxyMethods {
@@ -1,10 +1,10 @@
1
1
  import { RUNTIME_STATUS } from '../services/config/types.js';
2
2
  import type { ProxyAuth } from './types.js';
3
3
  export declare class NatsServer {
4
- readonly serverPort = 4222;
5
4
  private readonly clusterAmount;
6
5
  private readonly auth;
7
- private clusterPort?;
6
+ private _serverPort;
7
+ private _clusterPort;
8
8
  private serverProcess?;
9
9
  private clusterProcesses;
10
10
  private logger;
@@ -15,6 +15,8 @@ export declare class NatsServer {
15
15
  private shuttingDown;
16
16
  private _status;
17
17
  get status(): RUNTIME_STATUS;
18
+ get serverPort(): number;
19
+ get clusterPort(): number;
18
20
  constructor(auth: ProxyAuth);
19
21
  start(): Promise<void>;
20
22
  private startServer;
@@ -1,7 +1,6 @@
1
1
  import type { Camera } from '../api/database/types.js';
2
- import type { CameraDevice } from '../camera/cameraDevice.js';
3
- import type { CameraConfig, FfmpegOptions, PrebufferContainer, PrebufferState, SetValues, StateValues, StreamInfo } from '../camera/controller/types.js';
4
- import type { FrameMetadata } from '../decoder/types.js';
2
+ import type { CameraDevice } from '../camera/device.js';
3
+ import type { CameraConfig, Container, FfmpegOptions, PrebufferState, SetValues, StateValues, StreamInfo } from '../camera/types.js';
5
4
  import type { BasePlugin } from '../plugins/base.js';
6
5
  import type { CameraExtension } from '../plugins/types.js';
7
6
  import type { CameraStorage } from '../polyglot/node/plugins/cameraStorage.js';
@@ -97,10 +96,6 @@ export interface CameraDeviceProxyMethods {
97
96
  cameraId: string;
98
97
  pluginId: string;
99
98
  }): Promise<StreamInfo | undefined>;
100
- getFrameMetadata(data: {
101
- cameraId: string;
102
- pluginId: string;
103
- }): Promise<FrameMetadata>;
104
99
  getFfmpegPath(data: {
105
100
  cameraId: string;
106
101
  pluginId: string;
@@ -135,7 +130,7 @@ export interface CameraDeviceProxyMethods {
135
130
  }): void;
136
131
  updatePrebufferState(data: {
137
132
  sourceId: string;
138
- container: PrebufferContainer;
133
+ container: Container;
139
134
  state: PrebufferState;
140
135
  cameraId: string;
141
136
  pluginId: string;
@@ -152,7 +147,7 @@ export interface CameraDeviceProxyMethods {
152
147
  export type CameraDeviceProxyMethodNames = MethodKeys<CameraDeviceProxyMethods>;
153
148
  export interface DeviceManagerListenerMessagePayload {
154
149
  type: keyof DeviceManagerProxyEventCallbacks;
155
- data: any;
150
+ data: DeviceManagerProxyEvents['cameraSelected'] | DeviceManagerProxyEvents['cameraDeselected'] | DeviceManagerProxyEvents['cameraUpdated'];
156
151
  }
157
152
  export interface DeviceManagerProxyMethods {
158
153
  getCameraByName(name: string): Promise<CameraDevice | undefined>;
@@ -173,12 +168,13 @@ export interface DeviceManagerProxyEvents {
173
168
  };
174
169
  cameraUpdated: {
175
170
  camera: Camera;
171
+ extension: CameraExtension;
176
172
  };
177
173
  }
178
174
  export interface DeviceManagerProxyEventCallbacks {
179
175
  cameraSelected: (camera: CameraDevice, extension: CameraExtension) => void;
180
176
  cameraDeselected: (cameraId: string, extension: CameraExtension) => void;
181
- cameraUpdated: (cameraId: string, camera: CameraDevice) => void;
177
+ cameraUpdated: (cameraId: string, extension: CameraExtension) => void;
182
178
  }
183
179
  export interface DeviceManagerProxyGenericEvent<K extends keyof DeviceManagerProxyEvents> {
184
180
  type: K;
@@ -1,6 +1,6 @@
1
1
  import type { Namespace, Server } from 'socket.io';
2
2
  import type { SocketNsp } from '../api/websocket/types.js';
3
- import type { StateValues } from '../camera/controller/types.js';
3
+ import type { StateValues } from '../camera/types.js';
4
4
  import type { CameraDeviceListenerMessagePayload } from './types.js';
5
5
  export declare class WebsocketProxy {
6
6
  nsp: Namespace;
@@ -1,4 +1,4 @@
1
- import type { CameraDevice } from '../camera/cameraDevice.js';
1
+ import type { CameraDevice } from '../camera/device.js';
2
2
  export declare abstract class BasePlugin {
3
3
  abstract onFormSubmit(actionId: string, payload: any): Promise<{
4
4
  toast?: string;
@@ -91,11 +91,13 @@ export interface JsonSchemaNumber extends JsonBaseSchema<number> {
91
91
  type: 'number';
92
92
  minimum?: number;
93
93
  maximum?: number;
94
+ step?: number;
94
95
  }
95
96
  export interface PluginJsonSchemaNumber extends PluginJsonBaseSchema<number> {
96
97
  type: 'number';
97
98
  minimum?: number;
98
99
  maximum?: number;
100
+ step?: number;
99
101
  }
100
102
  export interface JsonSchemaBoolean extends JsonBaseSchema<boolean> {
101
103
  type: 'boolean';
@@ -34,7 +34,7 @@ export declare class PluginAPI extends EventEmitter implements API {
34
34
  readonly storagePath: string;
35
35
  readonly configFile: string;
36
36
  readonly plugin: BasePlugin;
37
- constructor(plugin: Plugin, logger: PluginLogger, auth: {
37
+ constructor(plugin: Plugin, logger: PluginLogger, proxyPort: number, auth: {
38
38
  user: string;
39
39
  pass: string;
40
40
  });
@@ -1,32 +1,41 @@
1
- import { CameraDevice } from '../../../../camera/cameraDevice.js';
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { CameraDevice } from '../../../../camera/device.js';
3
+ import { MotionFrame, VideoFrame } from '../../../../camera/videoFrame.js';
2
4
  import type { Camera } from '../../../../api/database/types.js';
3
- import type { CameraSource, SetValues } from '../../../../camera/controller/types.js';
4
- import type { VideoFrame } from '../../../../decoder/types.js';
5
+ import type { CameraSource, SetValues } from '../../../../camera/types.js';
5
6
  import type { IceServer } from '../../../../services/config/types.js';
6
7
  import type { PluginAPI } from '../api.js';
7
8
  import type { PluginLogger } from '../logger.js';
8
9
  export declare class CameraDeviceProxy extends CameraDevice {
9
10
  private api;
10
11
  private initialized;
11
- private publisher;
12
- private client;
13
- private cameraSubscriber;
14
- private cameraPluginSubscriber;
15
- private signalingSubscriber;
16
- private frameSubscriber?;
17
- private activeRequests;
18
- private messageQueue;
19
- private auth;
20
- private pluginID;
21
- private pluginName;
22
- private clientSubject;
12
+ private subject;
13
+ private subjectMotionFrame;
23
14
  private cameraSubscriberSubject;
24
15
  private cameraPluginSubscriberSubject;
25
16
  private frameSubject;
17
+ private framePrebufferSubject;
18
+ private motionFrameSubject;
26
19
  private signalingSubject;
27
20
  private signalingTargetSubject;
21
+ private publisher?;
22
+ private framePublisher?;
23
+ private subscriber?;
24
+ private cameraSubscriber?;
25
+ private cameraPluginSubscriber?;
26
+ private signalingSubscriber?;
27
+ private frameSubscriber?;
28
+ private prebufferFrameSubsciber?;
29
+ private motionFrameSubscriber?;
30
+ private messageQueue?;
31
+ private activeRequests;
32
+ private activeMotionRequests;
33
+ private auth;
34
+ private proxyPort;
35
+ private pluginID;
36
+ private pluginName;
28
37
  get sources(): CameraSource[];
29
- constructor(api: PluginAPI, logger: PluginLogger, camera: Camera, pluginId: string, pluginName: string, auth: {
38
+ constructor(api: PluginAPI, logger: PluginLogger, camera: Camera, pluginId: string, pluginName: string, proxyPort: number, auth: {
30
39
  user: string;
31
40
  pass: string;
32
41
  });
@@ -34,14 +43,20 @@ export declare class CameraDeviceProxy extends CameraDevice {
34
43
  connect(): Promise<void>;
35
44
  disconnect(): Promise<void>;
36
45
  reboot(): Promise<void>;
37
- generateFrames(): AsyncIterableIterator<VideoFrame>;
46
+ getFrames(): AsyncIterableIterator<VideoFrame>;
47
+ getMotionFrames(): AsyncIterableIterator<MotionFrame>;
48
+ getPrebufferedFrames(): AsyncIterableIterator<VideoFrame>;
38
49
  getFfmpegPath(): Promise<string>;
39
50
  getIceServers(): Promise<IceServer[]>;
40
- updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T]): Promise<void>;
51
+ updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], frame?: Buffer): Promise<void>;
41
52
  refreshStates(): Promise<void>;
42
53
  cleanup(): Promise<void>;
43
- private signalDecoder;
54
+ private onMotionFrame;
55
+ private connectToDecoder;
56
+ private getMetadata;
57
+ private disconnectFromDecoder;
44
58
  private closeFrameSubscriber;
59
+ private closeMotionFrameSubsciber;
45
60
  private requestHandler;
46
61
  private listenToMessages;
47
62
  private listenToSignalingMessages;
@@ -1,8 +1,8 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  import { EventEmitter } from 'node:events';
3
3
  import { CameraDeviceProxy } from './cameraDevice.js';
4
- import type { CameraDevice } from '../../../../camera/cameraDevice.js';
5
- import type { CameraConfig } from '../../../../camera/controller/types.js';
4
+ import type { CameraDevice } from '../../../../camera/device.js';
5
+ import type { CameraConfig } from '../../../../camera/types.js';
6
6
  import type { DeviceManagerProxyEventCallbacks, DeviceManagerProxyMethods } from '../../../../nats/types.js';
7
7
  import type { PluginAPI } from '../api.js';
8
8
  import type { PluginLogger } from '../logger.js';
@@ -17,17 +17,18 @@ export declare class DeviceManager extends EventEmitter implements DeviceManager
17
17
  private api;
18
18
  private logger;
19
19
  private initialized;
20
- private publisher;
21
- private client;
22
- private subscriber;
23
- private messageQueue;
20
+ private subject;
21
+ private dmSubject;
22
+ private publisher?;
23
+ private subscriber?;
24
+ private dmSubscriber?;
25
+ private messageQueue?;
24
26
  private auth;
27
+ private proxyPort;
25
28
  private pluginId;
26
29
  private pluginName;
27
- private clientSubject;
28
- private subscriberSubject;
29
30
  private devices;
30
- constructor(api: PluginAPI, logger: PluginLogger, pluginId: string, pluginName: string, auth: {
31
+ constructor(api: PluginAPI, logger: PluginLogger, pluginId: string, pluginName: string, proxyPort: number, auth: {
31
32
  user: string;
32
33
  pass: string;
33
34
  });
@@ -40,6 +41,7 @@ export declare class DeviceManager extends EventEmitter implements DeviceManager
40
41
  emit(): boolean;
41
42
  configureCameras(cameraDevices: CameraDeviceProxy[]): void;
42
43
  private requestHandler;
44
+ private emitEvent;
43
45
  private listenToMessages;
44
46
  private onRequest;
45
47
  private addOrGetCamera;
@@ -14,16 +14,17 @@ export declare class PluginsManager extends EventEmitter implements PluginsManag
14
14
  private api;
15
15
  private logger;
16
16
  private initialized;
17
- private publisher;
18
- private client;
19
- private subscriber;
20
- private messageQueue;
17
+ private subject;
18
+ private pmSubject;
19
+ private publisher?;
20
+ private subscriber?;
21
+ private pmSubscriber?;
22
+ private messageQueue?;
21
23
  private auth;
24
+ private proxyPort;
22
25
  private pluginId;
23
26
  private pluginName;
24
- private clientSubject;
25
- private subscriberSubject;
26
- constructor(api: PluginAPI, logger: PluginLogger, pluginId: string, pluginName: string, auth: {
27
+ constructor(api: PluginAPI, logger: PluginLogger, pluginId: string, pluginName: string, proxyPort: number, auth: {
27
28
  user: string;
28
29
  pass: string;
29
30
  });
@@ -1,16 +1,18 @@
1
1
  import type { NatsConnection, Subscription } from 'nats';
2
- import type { BaseLogger } from '../../../../camera/controller/types.js';
2
+ import type { BaseLogger } from '../../../../camera/types.js';
3
3
  import type { ProxyMessageStructure } from '../../../../nats/types.js';
4
4
  export declare class ClientMessageQueue {
5
5
  private logger;
6
6
  private publisher;
7
7
  private subscriber;
8
8
  private requestHandler;
9
+ private started;
9
10
  private aborted;
10
11
  private isProcessing;
11
12
  private queue;
12
13
  private pendingResponses;
13
14
  constructor(logger: BaseLogger, publisher: NatsConnection, subscriber: Subscription, requestHandler: (message: ProxyMessageStructure) => void);
15
+ start(): Promise<void>;
14
16
  abortQueue(): void;
15
17
  enqueue(message: ProxyMessageStructure): Promise<any>;
16
18
  private processQueue;