@camera.ui/browser 0.0.72 → 0.0.74

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 (91) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/types/packages/client/browser/src/proxy/cameraDevice.d.ts +1 -1
  3. package/dist/types/packages/client/browser/src/streaming/streaming-session.d.ts +2 -1
  4. package/dist/types/packages/client/browser/src/types.d.ts +2 -2
  5. package/dist/types/server/src/api/controllers/api.controller.d.ts +6 -0
  6. package/dist/types/server/src/api/controllers/auth.controller.d.ts +20 -0
  7. package/dist/types/server/src/api/controllers/backup.controller.d.ts +10 -0
  8. package/dist/types/server/src/api/controllers/cameras.controller.d.ts +33 -0
  9. package/dist/types/server/src/api/controllers/config.controller.d.ts +14 -0
  10. package/dist/types/server/src/api/controllers/files.controller.d.ts +8 -0
  11. package/dist/types/server/src/api/controllers/plugins.controller.d.ts +54 -0
  12. package/dist/types/server/src/api/controllers/streams.controller.d.ts +12 -0
  13. package/dist/types/server/src/api/controllers/system.controller.d.ts +14 -0
  14. package/dist/types/server/src/api/controllers/users.controller.d.ts +15 -0
  15. package/dist/types/server/src/api/database/index.d.ts +1 -1
  16. package/dist/types/server/src/api/go2rtc/api/application.d.ts +1 -1
  17. package/dist/types/server/src/api/go2rtc/api/config.d.ts +1 -1
  18. package/dist/types/server/src/api/go2rtc/api/snapshot.d.ts +1 -1
  19. package/dist/types/server/src/api/go2rtc/api/streams.d.ts +1 -1
  20. package/dist/types/server/src/api/index.d.ts +24 -0
  21. package/dist/types/server/src/api/middlewares/authPermission.middleware.d.ts +5 -0
  22. package/dist/types/server/src/api/middlewares/authValidation.middleware.d.ts +4 -0
  23. package/dist/types/server/src/api/middlewares/pagination.middleware.d.ts +3 -0
  24. package/dist/types/server/src/api/plugins/cameraui.plugin.d.ts +11 -0
  25. package/dist/types/server/src/api/plugins/database.plugin.d.ts +11 -0
  26. package/dist/types/server/src/api/plugins/go2rtc.plugin.d.ts +11 -0
  27. package/dist/types/server/src/api/plugins/socket.plugin.d.ts +11 -0
  28. package/dist/types/server/src/api/plugins/system.plugin.d.ts +21 -0
  29. package/dist/types/server/src/api/plugins/useragent.plugin.d.ts +8 -0
  30. package/dist/types/server/src/api/routes/api.routes.d.ts +2 -0
  31. package/dist/types/server/src/api/routes/auth.routes.d.ts +2 -0
  32. package/dist/types/server/src/api/routes/backup.routes.d.ts +2 -0
  33. package/dist/types/server/src/api/routes/cameras.routes.d.ts +2 -0
  34. package/dist/types/server/src/api/routes/config.routes.d.ts +2 -0
  35. package/dist/types/server/src/api/routes/files.routes.d.ts +2 -0
  36. package/dist/types/server/src/api/routes/index.d.ts +7 -0
  37. package/dist/types/server/src/api/routes/plugins.routes.d.ts +2 -0
  38. package/dist/types/server/src/api/routes/streams.routes.d.ts +2 -0
  39. package/dist/types/server/src/api/routes/system.routes.d.ts +2 -0
  40. package/dist/types/server/src/api/routes/users.routes.d.ts +2 -0
  41. package/dist/types/server/src/api/schemas/plugins.schema.d.ts +25 -0
  42. package/dist/types/server/src/api/services/backup.service.d.ts +10 -0
  43. package/dist/types/server/src/api/utils/axios.d.ts +2 -0
  44. package/dist/types/server/src/api/utils/cert.d.ts +11 -0
  45. package/dist/types/server/src/api/utils/moveFiles.d.ts +1 -0
  46. package/dist/types/server/src/api/websocket/nsp/status.d.ts +1 -1
  47. package/dist/types/server/src/api/websocket/types.d.ts +1 -1
  48. package/dist/types/server/src/api.d.ts +4 -4
  49. package/dist/types/server/src/{devices/camera → camera}/cameraDevice.d.ts +1 -1
  50. package/dist/types/server/src/{devices/camera → camera}/controller/index.d.ts +7 -4
  51. package/dist/types/server/src/{devices/camera → camera}/controller/types.d.ts +29 -18
  52. package/dist/types/server/src/{devices/camera → camera}/index.d.ts +24 -14
  53. package/dist/types/server/src/{devices/camera → camera}/streaming/peer-connection.d.ts +8 -7
  54. package/dist/types/server/src/{devices/camera → camera}/streaming/streaming-session.d.ts +1 -1
  55. package/dist/types/server/src/{devices/camera → camera}/streaming/webrtc-connection.d.ts +2 -2
  56. package/dist/types/server/src/decoder/ffmpeg.d.ts +2 -0
  57. package/dist/types/server/src/decoder/index.d.ts +15 -3
  58. package/dist/types/server/src/decoder/types.d.ts +43 -24
  59. package/dist/types/server/src/decoder/worker.d.ts +42 -0
  60. package/dist/types/server/src/main.d.ts +21 -0
  61. package/dist/types/server/src/nats/constants.d.ts +1 -0
  62. package/dist/types/server/src/nats/index.d.ts +1 -1
  63. package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +9 -20
  64. package/dist/types/server/src/nats/proxy/deviceManager.d.ts +1 -1
  65. package/dist/types/server/src/nats/proxy/pluginsManager.d.ts +1 -1
  66. package/dist/types/server/src/nats/server.d.ts +3 -2
  67. package/dist/types/server/src/nats/types.d.ts +13 -22
  68. package/dist/types/server/src/nats/websocket.d.ts +1 -1
  69. package/dist/types/server/src/plugins/base.d.ts +1 -1
  70. package/dist/types/server/src/plugins/plugin.d.ts +1 -1
  71. package/dist/types/server/src/plugins/worker.d.ts +5 -1
  72. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/api.d.ts +2 -2
  73. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/cameraStorage.d.ts +1 -1
  74. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/config.d.ts +1 -1
  75. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/logger.d.ts +2 -0
  76. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/proxy/cameraDevice.d.ts +11 -7
  77. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/proxy/deviceManager.d.ts +3 -3
  78. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/proxy/pluginsManager.d.ts +1 -1
  79. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/proxy/queue.d.ts +3 -3
  80. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/proxy/systemManager.d.ts +1 -1
  81. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/schema.d.ts +2 -2
  82. package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/storageController.d.ts +1 -1
  83. package/dist/types/server/src/services/logger/index.d.ts +3 -3
  84. package/dist/types/server/src/utils/pythonInstaller.d.ts +2 -1
  85. package/dist/types/server/src/utils/subscribed.d.ts +1 -1
  86. package/dist/types/shared/types/index.d.ts +1 -1
  87. package/package.json +4 -4
  88. package/dist/types/server/src/api/websocket/nsp/frame.d.ts +0 -10
  89. package/dist/types/server/src/decoder/worker/index.d.ts +0 -27
  90. package/dist/types/server/src/plugins/worker-ipc.d.ts +0 -22
  91. /package/dist/types/server/src/{plugins/node → polyglot/node/plugins}/proxy/index.d.ts +0 -0
@@ -1,12 +1,6 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
- import type { CameraInformation, CameraInput, CameraInputSettings } from '../../../api/database/types.js';
3
- export type SpawnInput = string | number;
4
- export type PrebufferType = 'recording' | 'stream';
5
- export interface CameraSource extends CameraInput {
6
- isPrebuffering(type: PrebufferType): Promise<boolean>;
7
- getPrebufferRawUrl(type: PrebufferType): Promise<string | undefined>;
8
- getStreamInfo(): Promise<StreamInfo | undefined>;
9
- }
2
+ import type { Observable } from 'rxjs';
3
+ import type { CameraInformation, CameraInput, CameraInputSettings } from '../../api/database/types.js';
10
4
  export interface BaseLogger {
11
5
  log: (...args: any[]) => void;
12
6
  error: (...args: any[]) => void;
@@ -14,12 +8,35 @@ export interface BaseLogger {
14
8
  debug: (...args: any[]) => void;
15
9
  trace: (...args: any[]) => void;
16
10
  }
11
+ export type SpawnInput = string | number;
17
12
  export interface FfmpegOptions {
18
13
  input?: SpawnInput[];
19
14
  video?: SpawnInput[] | false;
20
15
  audio?: SpawnInput[];
21
16
  output: SpawnInput[];
22
17
  }
18
+ export type PrebufferContainer = 'mp4' | 'mpegts';
19
+ export interface BasePrebufferState {
20
+ maxDuration: number;
21
+ availableDuration: number;
22
+ }
23
+ export interface PrebufferStateTrue extends BasePrebufferState {
24
+ state: true;
25
+ url: string;
26
+ }
27
+ export interface PrebufferStateFalse extends BasePrebufferState {
28
+ state: false;
29
+ }
30
+ export type PrebufferState = PrebufferStateTrue | PrebufferStateFalse;
31
+ export interface CameraSource extends CameraInput {
32
+ updatePrebufferingState(container: PrebufferContainer, state: PrebufferState): Promise<void>;
33
+ getPrebufferingState(container: PrebufferContainer): PrebufferState;
34
+ onPrebuffering(container: PrebufferContainer): Observable<PrebufferState>;
35
+ getStreamInfo(): Promise<StreamInfo | undefined>;
36
+ }
37
+ export interface CameraPrebufferDelegate {
38
+ getStreamInfo(sourceName: string): Promise<StreamInfo | undefined>;
39
+ }
23
40
  export interface CameraDelegate {
24
41
  snapshotRequest(requestId: string): Promise<Buffer>;
25
42
  prepareStream(requestId: string): Promise<void>;
@@ -27,10 +44,9 @@ export interface CameraDelegate {
27
44
  onCandidates(requestId: string, candidates: string): Promise<void>;
28
45
  reboot(): Promise<void>;
29
46
  }
30
- export interface CameraPrebufferDelegate {
31
- isPrebuffering(sourceName: string, type: PrebufferType): Promise<boolean>;
32
- getPrebufferRawUrl(sourceName: string, type: PrebufferType): Promise<string | undefined>;
33
- getStreamInfo(sourceName: string): Promise<StreamInfo | undefined>;
47
+ export interface StreamInfo {
48
+ audio: AudioStreamOptions;
49
+ video: VideoStreamOptions;
34
50
  }
35
51
  export interface AudioStreamOptions {
36
52
  enabled?: boolean;
@@ -46,10 +62,6 @@ export interface VideoStreamOptions {
46
62
  fps?: number;
47
63
  idrInterval?: number;
48
64
  }
49
- export interface StreamInfo {
50
- audio: AudioStreamOptions;
51
- video: VideoStreamOptions;
52
- }
53
65
  export type Sdp = string;
54
66
  export type IceCandiate = string;
55
67
  export interface Go2RtcOfferMessage {
@@ -89,7 +101,6 @@ export type CameraConfig = (BaseCameraConfig & {
89
101
  export interface BaseDetection {
90
102
  id?: string;
91
103
  label: string;
92
- timestamp: number;
93
104
  confidence: number;
94
105
  boundingBox: [number, number, number, number];
95
106
  inputWidth: number;
@@ -102,7 +113,7 @@ export interface MotionDetection extends BaseDetection {
102
113
  export interface ObjectDetection extends BaseDetection {
103
114
  }
104
115
  export interface BaseState<T extends LightState | AudioState | MotionState | ObjectState | SirenState | BatteryState | DoorbellState> {
105
- timestamp: number;
116
+ timestamp: string;
106
117
  lastEvent?: Omit<T, 'lastEvent'>;
107
118
  }
108
119
  export interface MotionSetEvent {
@@ -1,8 +1,9 @@
1
1
  import { LRUCache } from 'lru-cache';
2
- import { BehaviorSubject, Observable, Subscription } from 'rxjs';
3
- import type { Camera, CameraInformation, CameraPublicProperties, CameraType, CameraZone } from '../../api/database/types.js';
4
- import type { IceServer } from '../../services/config/types.js';
5
- import type { AudioSetEvent, AudioState, BaseLogger, BatterySetEvent, BatteryState, CameraSource, DoorbellSetEvent, DoorbellState, LightSetEvent, LightState, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, SetValues, Sets, SirenSetEvent, SirenState, StateValues, States } from './controller/types.js';
2
+ import { BehaviorSubject } from 'rxjs';
3
+ import type { Observable, Subscription } from 'rxjs';
4
+ import type { Camera, CameraInformation, CameraPublicProperties, CameraType, CameraZone } from '../api/database/types.js';
5
+ import type { IceServer } from '../services/config/types.js';
6
+ import type { AudioSetEvent, AudioState, BaseLogger, BatterySetEvent, BatteryState, CameraSource, DoorbellSetEvent, DoorbellState, LightSetEvent, LightState, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, PrebufferContainer, PrebufferState, SetValues, Sets, SirenSetEvent, SirenState, StateValues, States } from './controller/types.js';
6
7
  declare class Subscribed {
7
8
  private readonly subscriptions;
8
9
  private readonly additionalSubscriptions;
@@ -23,18 +24,23 @@ export declare abstract class BaseCameraDevice extends Subscribed {
23
24
  protected doorbellState: BehaviorSubject<DoorbellState>;
24
25
  protected sirenState: BehaviorSubject<SirenState>;
25
26
  protected batteryState: BehaviorSubject<BatteryState>;
26
- onConnected: Observable<boolean>;
27
- onLightSwitched: Observable<LightState>;
28
- onMotionDetected: Observable<MotionState>;
29
- onAudioDetected: Observable<AudioState>;
30
- onObjectDetected: Observable<ObjectState>;
31
- onDoorbellPressed: Observable<DoorbellState>;
32
- onSirenDetected: Observable<SirenState>;
33
- onBatteryChanged: Observable<BatteryState>;
27
+ protected prebufferStateSubjects: {
28
+ [sourceId: string]: {
29
+ [container: string]: BehaviorSubject<PrebufferState>;
30
+ };
31
+ };
32
+ readonly onConnected: Observable<boolean>;
33
+ readonly onLightSwitched: Observable<LightState>;
34
+ readonly onMotionDetected: Observable<MotionState>;
35
+ readonly onAudioDetected: Observable<AudioState>;
36
+ readonly onObjectDetected: Observable<ObjectState>;
37
+ readonly onDoorbellPressed: Observable<DoorbellState>;
38
+ readonly onSirenDetected: Observable<SirenState>;
39
+ readonly onBatteryChanged: Observable<BatteryState>;
34
40
  get id(): string;
35
41
  get nativeId(): string | undefined;
36
42
  get pluginId(): string;
37
- get state(): boolean;
43
+ get connected(): boolean;
38
44
  get disabled(): boolean;
39
45
  get name(): string;
40
46
  get type(): CameraType;
@@ -82,9 +88,13 @@ export declare abstract class BaseCameraDevice extends Subscribed {
82
88
  protected getLightState(event: LightSetEvent | LightState): LightState;
83
89
  protected getSirenState(event: SirenSetEvent): SirenState;
84
90
  protected getBatteryState(event: BatterySetEvent): BatteryState;
85
- private createStateObservable;
86
91
  protected updateCamera(updatedCamera: Camera): void;
92
+ protected updatePrebuffer(sourceId: string, container: PrebufferContainer, state: PrebufferState): Promise<void>;
93
+ protected updateCameraSourcesState(): void;
87
94
  protected updateCameraState(state: boolean): void;
95
+ protected cameraSourcePrebufferState(sourceId: string, container: PrebufferContainer): PrebufferState;
96
+ private createStateObservable;
97
+ protected createPrebufferStateObservable(sourceId: string, container: PrebufferContainer): Observable<PrebufferState>;
88
98
  protected stateChanged<T extends keyof SetValues>(oldState?: SetValues[T], newState?: SetValues[T]): boolean;
89
99
  protected isAudioState(state: Sets): state is AudioSetEvent;
90
100
  protected isMotionState(state: Sets): state is MotionSetEvent;
@@ -1,8 +1,9 @@
1
- import { Observable, ReplaySubject, Subject } from 'rxjs';
2
- import { MediaStreamTrack, RTCSessionDescription, RTCIceCandidate as WeriftRTCICECandidate } from 'werift';
3
- import { Subscribed } from '../../../utils/subscribed.js';
4
- import type { ConnectionState, RTCIceCandidate, RtcpPacket, RtpPacket } from 'werift';
5
- import type { IceServer } from '../../../services/config/types.js';
1
+ import { ReplaySubject, Subject } from 'rxjs';
2
+ import { MediaStreamTrack } from 'werift';
3
+ import { Subscribed } from '../../utils/subscribed.js';
4
+ import type { Observable } from 'rxjs';
5
+ import type { ConnectionState, RTCIceCandidate, RTCSessionDescription, RtcpPacket, RtpPacket, RTCIceCandidate as WeriftRTCICECandidate } from 'werift';
6
+ import type { IceServer } from '../../services/config/types.js';
6
7
  import type { CameraDevice } from '../cameraDevice.js';
7
8
  import type { BaseLogger } from '../controller/types.js';
8
9
  export interface BasicPeerConnection {
@@ -25,8 +26,8 @@ export declare class WeriftPeerConnection extends Subscribed implements BasicPee
25
26
  onAudioRtcp: Subject<RtcpPacket>;
26
27
  onVideoRtp: Subject<RtpPacket>;
27
28
  onVideoRtcp: Subject<RtcpPacket>;
28
- onIceCandidate: Subject<WeriftRTCICECandidate>;
29
- onConnectionState: ReplaySubject<"closed" | "failed" | "disconnected" | "new" | "connecting" | "connected">;
29
+ onIceCandidate: Subject<RTCIceCandidate>;
30
+ onConnectionState: ReplaySubject<"connected" | "disconnected" | "closed" | "failed" | "new" | "connecting">;
30
31
  returnAudioTrack: MediaStreamTrack;
31
32
  private onRequestKeyFrame;
32
33
  private cameraDevice;
@@ -1,6 +1,6 @@
1
1
  import { ReplaySubject, Subject } from 'rxjs';
2
2
  import { RtpPacket } from 'werift';
3
- import { Subscribed } from '../../../utils/subscribed.js';
3
+ import { Subscribed } from '../../utils/subscribed.js';
4
4
  import type { CameraDevice } from '../cameraDevice.js';
5
5
  import type { BaseLogger, FfmpegOptions, SpawnInput } from '../controller/types.js';
6
6
  import type { WebrtcConnection } from './webrtc-connection.js';
@@ -1,7 +1,7 @@
1
1
  import { ReplaySubject, Subject, type Observable } from 'rxjs';
2
- import { Subscribed } from '../../../utils/subscribed.js';
2
+ import { Subscribed } from '../../utils/subscribed.js';
3
3
  import type { RtpPacket } from 'werift';
4
- import type { IceServer } from '../../../services/config/types.js';
4
+ import type { IceServer } from '../../services/config/types.js';
5
5
  import type { CameraDevice } from '../cameraDevice.js';
6
6
  import type { BaseLogger } from '../controller/types.js';
7
7
  import type { StreamingConnectionOptions } from './peer-connection.js';
@@ -0,0 +1,2 @@
1
+ import type { FfmpegArgs } from './types.js';
2
+ export declare const getHwaccelInfo: (port: number) => Promise<FfmpegArgs>;
@@ -1,10 +1,22 @@
1
- import { FrameWorker } from './worker/index.js';
2
- import type { CameraController } from '../devices/camera/controller/index.js';
3
- export declare class Decoder {
1
+ import { FrameWorker } from './worker.js';
2
+ import type { CameraController } from '../camera/controller/index.js';
3
+ export declare class FrameManager {
4
4
  frameWorkers: Map<string, FrameWorker>;
5
+ private initialized;
5
6
  private api;
6
7
  private proxyServer;
8
+ private logger;
9
+ private publisher?;
10
+ private subscriber?;
11
+ private subject;
7
12
  constructor();
13
+ init(): Promise<void>;
8
14
  addCamera(camera: CameraController): Promise<FrameWorker>;
9
15
  removeCamera(camera: CameraController): Promise<void>;
16
+ private handleConnectMessage;
17
+ private handleDisconnectMessage;
18
+ private disconnectClient;
19
+ private disconnectAllClients;
20
+ private startPingPongForClient;
21
+ private listenToMessages;
10
22
  }
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
3
  import type { ChildProcess } from 'node:child_process';
4
- import type { ResizeOptions, RotateOptions, Sharp } from 'sharp';
4
+ import type { Sharp } from 'sharp';
5
5
  export interface FrameMetadata {
6
6
  format: string;
7
7
  frameSize: number;
@@ -10,31 +10,21 @@ export interface FrameMetadata {
10
10
  height: number;
11
11
  origHeight: number;
12
12
  }
13
- export interface FrameSession {
14
- token: string;
15
- wsPort: number;
16
- }
17
- export interface Frame {
18
- metadata: FrameMetadata;
19
- data: Buffer;
20
- }
21
13
  export interface ImageCrop {
22
14
  top: number;
23
15
  left: number;
24
- bottom: number;
25
- right: number;
16
+ width: number;
17
+ height: number;
26
18
  }
27
19
  export interface ImageResize {
28
20
  width?: number;
29
21
  height?: number;
30
- options?: ResizeOptions;
31
22
  }
32
23
  export interface ImageRotate {
33
24
  angle: number;
34
- options?: RotateOptions;
35
25
  }
36
26
  export interface ImageFormat {
37
- format: 'rgba' | 'gray' | 'bgr';
27
+ to: 'rgba' | 'gray';
38
28
  }
39
29
  export interface ImageOptions {
40
30
  format?: ImageFormat;
@@ -60,33 +50,62 @@ export interface VideoSession {
60
50
  cp: ChildProcess;
61
51
  }
62
52
  export interface BaseFrameWorkerConfig {
53
+ frameWorkerId: string;
63
54
  cameraId: string;
64
55
  cameraName: string;
65
56
  ffmpegPath: string;
66
- logLevel?: string;
67
- disableTimestamps?: boolean;
57
+ logLevel: string;
58
+ disableTimestamps: boolean;
68
59
  auth: {
69
60
  user: string;
70
61
  pass: string;
71
62
  };
72
63
  }
73
- export type WorkerMessage = 'ready' | 'getCameraSource';
74
- export type MainMessage = 'getMetadata' | 'startWorker' | 'stopWorker' | 'startVideoSession' | 'stopVideoSession' | 'setCameraName';
64
+ export type WorkerMessage = 'started' | 'getFFmpegArgs';
65
+ export type MainMessage = 'getMetadata' | 'startVideoSession' | 'stopVideoSession' | 'setCameraName';
75
66
  export interface MainToWorkerMessage {
76
- id: string;
77
67
  message: MainMessage;
78
68
  data: Record<string, any>;
79
69
  }
80
70
  export interface WorkerToMainResponse {
81
- id: string;
82
- response: any;
71
+ response?: Record<string, any>;
83
72
  }
84
73
  export interface WorkerToMainMessage {
85
- id: string;
86
74
  message: WorkerMessage;
87
75
  data: Record<string, any>;
88
76
  }
89
77
  export interface MainToWorkerResponse {
90
- id: string;
91
- response: any;
78
+ response?: Record<string, any>;
79
+ }
80
+ export interface SignalingRequest {
81
+ type: 'connect' | 'disconnect';
82
+ requestId: string;
83
+ cameraId: string;
84
+ pluginId: string;
85
+ }
86
+ export interface SignalingResponse {
87
+ type: 'connected' | 'disconnected' | 'error';
88
+ requestId: string;
89
+ message?: string;
90
+ }
91
+ export interface PingMessage {
92
+ type: 'ping';
93
+ requestId: string;
94
+ }
95
+ export interface PongMessage {
96
+ type: 'pong';
97
+ requestId: string;
98
+ }
99
+ export interface HardwareSource {
100
+ name: string;
101
+ url: string;
102
+ }
103
+ export interface HardwareResponse {
104
+ sources: HardwareSource[];
105
+ }
106
+ export interface FfmpegArgs {
107
+ hwaccel: string;
108
+ hwaccelArgs: string[];
109
+ hwaccelFilter: string;
110
+ threads: string;
92
111
  }
@@ -0,0 +1,42 @@
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
+ }
8
+ export declare class FrameWorker extends Subscribed {
9
+ token: string;
10
+ readonly clients: Map<string, FrameWorkerClient>;
11
+ private subject;
12
+ private ipcSubject;
13
+ private frameWorkerId;
14
+ private publisher?;
15
+ private subscriber?;
16
+ private logger;
17
+ private configService;
18
+ private camera;
19
+ private frameWorker?;
20
+ private initialized;
21
+ private stopped;
22
+ private auth;
23
+ private ffmpegArgs;
24
+ private py;
25
+ constructor(camera: CameraController, auth: {
26
+ user: string;
27
+ pass: string;
28
+ });
29
+ init(): Promise<void>;
30
+ 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;
37
+ private startWorker;
38
+ private sendMessage;
39
+ private listenToMessages;
40
+ private getLogPrefix;
41
+ }
42
+ export {};
@@ -0,0 +1,21 @@
1
+ import 'reflect-metadata';
2
+ export declare class CameraUi {
3
+ private started;
4
+ private api;
5
+ private logger;
6
+ private configService;
7
+ private pluginManager;
8
+ private go2rtc;
9
+ private server;
10
+ private proxy;
11
+ private frameManager;
12
+ private _restartAttempts;
13
+ private _maxRestartAttempts;
14
+ get restartAttempts(): number;
15
+ get maxRestartAttempts(): number;
16
+ constructor();
17
+ start(): Promise<void>;
18
+ close(): Promise<void>;
19
+ restart(...args: any[]): Promise<void>;
20
+ private init;
21
+ }
@@ -1 +1,2 @@
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 '../devices/camera/controller/types.js';
5
+ import type { StateValues } from '../camera/controller/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 {
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  import type { Camera } from '../../api/database/types.js';
3
- import type { FrameMetadata, FrameSession } from '../../decoder/types.js';
4
- import type { CameraDelegate, CameraPrebufferDelegate, FfmpegOptions, PrebufferType, SetValues, StateValues, StreamInfo } from '../../devices/camera/controller/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';
5
5
  import type { IceServer } from '../../services/config/types.js';
6
6
  import type { MessageQueue } from '../queue.js';
7
7
  import type { CameraDeviceProxyMethods, ProxyMessageStructure } from '../types.js';
@@ -30,26 +30,10 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
30
30
  cameraId: string;
31
31
  pluginId: string;
32
32
  }): Promise<StreamInfo | undefined>;
33
- isPrebuffering(data: {
34
- sourceName: string;
35
- type: PrebufferType;
36
- cameraId: string;
37
- pluginId: string;
38
- }): Promise<boolean>;
39
- getPrebufferRawUrl(data: {
40
- sourceName: string;
41
- type: PrebufferType;
42
- cameraId: string;
43
- pluginId: string;
44
- }): Promise<string | undefined>;
45
33
  getFrameMetadata(data: {
46
34
  cameraId: string;
47
35
  pluginId: string;
48
36
  }): Promise<FrameMetadata>;
49
- getFrameSession(data: {
50
- cameraId: string;
51
- pluginId: string;
52
- }): Promise<FrameSession>;
53
37
  getFfmpegPath(): string;
54
38
  getIceServers(): IceServer[];
55
39
  snapshot(data: {
@@ -76,6 +60,13 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
76
60
  cameraId: string;
77
61
  pluginId: string;
78
62
  }): Promise<void>;
63
+ updatePrebufferState(data: {
64
+ sourceId: string;
65
+ container: PrebufferContainer;
66
+ state: PrebufferState;
67
+ cameraId: string;
68
+ pluginId: string;
69
+ }): Promise<void>;
79
70
  refreshStates(data: {
80
71
  cameraId: string;
81
72
  pluginId: string;
@@ -86,8 +77,6 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
86
77
  };
87
78
  onRequestReboot(pluginId: string, cameraId: string, ...args: Parameters<CameraDelegate['reboot']>): Promise<Buffer>;
88
79
  onRequestGetStreamInfo(pluginId: string, cameraId: string, ...args: Parameters<CameraPrebufferDelegate['getStreamInfo']>): Promise<StreamInfo | undefined>;
89
- onRequestIsPrebuffering(pluginId: string, cameraId: string, ...args: Parameters<CameraPrebufferDelegate['isPrebuffering']>): Promise<boolean>;
90
- onRequestGetRawUrl(pluginId: string, cameraId: string, ...args: Parameters<CameraPrebufferDelegate['getPrebufferRawUrl']>): Promise<string | undefined>;
91
80
  onRequestSnapshotRequest(pluginId: string, cameraId: string, ...args: Parameters<CameraDelegate['snapshotRequest']>): Promise<Buffer>;
92
81
  onRequestPrepareStream(pluginId: string, cameraId: string, ...args: Parameters<CameraDelegate['prepareStream']>): Promise<void>;
93
82
  onRequestWebRTCOffer(pluginId: string, cameraId: string, ...args: Parameters<CameraDelegate['onOffer']>): Promise<string>;
@@ -1,5 +1,5 @@
1
1
  import type { Camera } from '../../api/database/types.js';
2
- import type { CameraConfig } from '../../devices/camera/controller/types.js';
2
+ import type { CameraConfig } from '../../camera/controller/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,5 +1,5 @@
1
1
  import type { BasePlugin } from '../../plugins/base.js';
2
- import type { CameraStorage } from '../../plugins/node/cameraStorage.js';
2
+ import type { CameraStorage } from '../../polyglot/node/plugins/cameraStorage.js';
3
3
  import type { MessageQueue } from '../queue.js';
4
4
  import type { CallablePluginMethods, CallablePluginStorageMethods, PluginsManagerServerProxyMethods, ProxyMessageStructure } from '../types.js';
5
5
  export declare class PluginsManagerProxy implements PluginsManagerServerProxyMethods {
@@ -2,14 +2,14 @@ import { RUNTIME_STATUS } from '../services/config/types.js';
2
2
  import type { ProxyAuth } from './types.js';
3
3
  export declare class NatsServer {
4
4
  readonly serverPort = 4222;
5
- readonly websocketPort = 8223;
6
5
  private readonly clusterAmount;
7
- private readonly serverClusterPort;
8
6
  private readonly auth;
7
+ private clusterPort?;
9
8
  private serverProcess?;
10
9
  private clusterProcesses;
11
10
  private logger;
12
11
  private configService;
12
+ private process;
13
13
  private tmpDir;
14
14
  private manuallyKilled;
15
15
  private shuttingDown;
@@ -27,6 +27,7 @@ export declare class NatsServer {
27
27
  private stringifyConfig;
28
28
  private kill;
29
29
  private handleClose;
30
+ private handleCloseCluster;
30
31
  private setStatus;
31
32
  private processLogger;
32
33
  private isIgnorableString;
@@ -1,10 +1,10 @@
1
1
  import type { Camera } from '../api/database/types.js';
2
- import type { FrameMetadata, FrameSession } from '../decoder/types.js';
3
- import type { CameraDevice } from '../devices/camera/cameraDevice.js';
4
- import type { CameraConfig, FfmpegOptions, PrebufferType, SetValues, StateValues, StreamInfo } from '../devices/camera/controller/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';
5
5
  import type { BasePlugin } from '../plugins/base.js';
6
- import type { CameraStorage } from '../plugins/node/cameraStorage.js';
7
6
  import type { CameraExtension } from '../plugins/types.js';
7
+ import type { CameraStorage } from '../polyglot/node/plugins/cameraStorage.js';
8
8
  import type { IceServer } from '../services/config/types.js';
9
9
  export type MethodKeys<T> = {
10
10
  [K in keyof T]: T[K] extends Function ? K : never;
@@ -26,7 +26,7 @@ export interface ProxyMessageStructure {
26
26
  fn: string;
27
27
  args: any;
28
28
  timeout: number;
29
- timestamp: number;
29
+ timestamp: string;
30
30
  response?: any;
31
31
  error?: any;
32
32
  }
@@ -92,18 +92,6 @@ export interface CameraDeviceProxyMethods {
92
92
  cameraId: string;
93
93
  pluginId: string;
94
94
  }): Promise<void>;
95
- isPrebuffering(data: {
96
- sourceName: string;
97
- type: PrebufferType;
98
- cameraId: string;
99
- pluginId: string;
100
- }): Promise<boolean>;
101
- getPrebufferRawUrl(data: {
102
- sourceName: string;
103
- type: PrebufferType;
104
- cameraId: string;
105
- pluginId: string;
106
- }): Promise<string | undefined>;
107
95
  getStreamInfo(data: {
108
96
  sourceName: string;
109
97
  cameraId: string;
@@ -113,10 +101,6 @@ export interface CameraDeviceProxyMethods {
113
101
  cameraId: string;
114
102
  pluginId: string;
115
103
  }): Promise<FrameMetadata>;
116
- getFrameSession(data: {
117
- cameraId: string;
118
- pluginId: string;
119
- }): Promise<FrameSession>;
120
104
  getFfmpegPath(data: {
121
105
  cameraId: string;
122
106
  pluginId: string;
@@ -149,6 +133,13 @@ export interface CameraDeviceProxyMethods {
149
133
  cameraId: string;
150
134
  pluginId: string;
151
135
  }): void;
136
+ updatePrebufferState(data: {
137
+ sourceId: string;
138
+ container: PrebufferContainer;
139
+ state: PrebufferState;
140
+ cameraId: string;
141
+ pluginId: string;
142
+ }): Promise<void>;
152
143
  refreshStates(data: {
153
144
  cameraId: string;
154
145
  pluginId: string;
@@ -241,6 +232,6 @@ export interface CameraDeviceListenerStatePayload<K extends keyof StateValues> {
241
232
  };
242
233
  }
243
234
  export interface CameraDeviceListenerMessagePayload {
244
- type: 'removed' | 'updated' | 'cameraState';
235
+ type: 'removed' | 'updated' | 'cameraState' | 'prebufferState';
245
236
  data?: any;
246
237
  }
@@ -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 '../devices/camera/controller/types.js';
3
+ import type { StateValues } from '../camera/controller/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 '../devices/camera/cameraDevice.js';
1
+ import type { CameraDevice } from '../camera/cameraDevice.js';
2
2
  export declare abstract class BasePlugin {
3
3
  abstract onFormSubmit(actionId: string, payload: any): Promise<{
4
4
  toast?: string;
@@ -1,5 +1,5 @@
1
+ import { PluginConfigService } from '../polyglot/node/plugins/config.js';
1
2
  import { PythonInstaller } from '../utils/pythonInstaller.js';
2
- import { PluginConfigService } from './node/config.js';
3
3
  import type { PluginConstructor } from '../api.js';
4
4
  import type { CameraUiPlugin, IPackageJson } from '../api/types/index.js';
5
5
  import type { PluginContract } from './types.js';
@@ -4,11 +4,14 @@ export declare class PluginWorker {
4
4
  plugin: Plugin;
5
5
  private pluginWorker?;
6
6
  private proxyServer;
7
- private ipc;
8
7
  private api;
9
8
  private logger;
10
9
  private configService;
11
10
  private socketService;
11
+ private publisher?;
12
+ private subscriber?;
13
+ private subject;
14
+ private targetSubject;
12
15
  private started;
13
16
  private shuttingDown;
14
17
  private _status;
@@ -26,5 +29,6 @@ export declare class PluginWorker {
26
29
  private handleClose;
27
30
  private reset;
28
31
  private updatePython;
32
+ private listenToMessages;
29
33
  private cleanedProcessEnv;
30
34
  }