@camera.ui/browser 0.0.71 → 0.0.73
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/bundle.js +1 -1
- package/dist/types/packages/client/browser/src/proxy/cameraDevice.d.ts +10 -2
- package/dist/types/packages/client/browser/src/proxy/deviceManager.d.ts +9 -6
- package/dist/types/packages/client/browser/src/proxy/pluginsManager.d.ts +4 -1
- package/dist/types/packages/client/browser/src/proxy/systemManager.d.ts +4 -1
- package/dist/types/packages/client/browser/src/socket.d.ts +6 -1
- package/dist/types/{server/src/camera/streaming/browser/browser-peer-connection.d.ts → packages/client/browser/src/streaming/peer-connection.d.ts} +4 -5
- package/dist/types/{server/src/camera/streaming/browser/browser-streaming-session.d.ts → packages/client/browser/src/streaming/streaming-session.d.ts} +8 -7
- package/dist/types/{server/src/camera/streaming/browser/webrtc-browser-connection.d.ts → packages/client/browser/src/streaming/webrtc-connection.d.ts} +6 -7
- package/dist/types/packages/client/browser/src/types.d.ts +26 -2
- package/dist/types/server/src/api/controllers/api.controller.d.ts +6 -0
- package/dist/types/server/src/api/controllers/auth.controller.d.ts +20 -0
- package/dist/types/server/src/api/controllers/backup.controller.d.ts +10 -0
- package/dist/types/server/src/api/controllers/cameras.controller.d.ts +33 -0
- package/dist/types/server/src/api/controllers/config.controller.d.ts +14 -0
- package/dist/types/server/src/api/controllers/files.controller.d.ts +8 -0
- package/dist/types/server/src/api/controllers/plugins.controller.d.ts +54 -0
- package/dist/types/server/src/api/controllers/streams.controller.d.ts +12 -0
- package/dist/types/server/src/api/controllers/system.controller.d.ts +14 -0
- package/dist/types/server/src/api/controllers/users.controller.d.ts +15 -0
- package/dist/types/server/src/api/database/index.d.ts +1 -1
- package/dist/types/server/src/api/go2rtc/api/application.d.ts +1 -1
- package/dist/types/server/src/api/go2rtc/api/config.d.ts +1 -1
- package/dist/types/server/src/api/go2rtc/api/snapshot.d.ts +1 -1
- package/dist/types/server/src/api/go2rtc/api/streams.d.ts +1 -1
- package/dist/types/server/src/api/index.d.ts +18 -0
- package/dist/types/server/src/api/middlewares/authPermission.middleware.d.ts +5 -0
- package/dist/types/server/src/api/middlewares/authValidation.middleware.d.ts +4 -0
- package/dist/types/server/src/api/middlewares/pagination.middleware.d.ts +3 -0
- package/dist/types/server/src/api/plugins/cameraui.plugin.d.ts +11 -0
- package/dist/types/server/src/api/plugins/database.plugin.d.ts +11 -0
- package/dist/types/server/src/api/plugins/go2rtc.plugin.d.ts +11 -0
- package/dist/types/server/src/api/plugins/logger.plugin.d.ts +7 -0
- package/dist/types/server/src/api/plugins/socket.plugin.d.ts +11 -0
- package/dist/types/server/src/api/plugins/system.plugin.d.ts +21 -0
- package/dist/types/server/src/api/plugins/useragent.plugin.d.ts +8 -0
- package/dist/types/server/src/api/routes/api.routes.d.ts +2 -0
- package/dist/types/server/src/api/routes/auth.routes.d.ts +2 -0
- package/dist/types/server/src/api/routes/backup.routes.d.ts +2 -0
- package/dist/types/server/src/api/routes/cameras.routes.d.ts +2 -0
- package/dist/types/server/src/api/routes/config.routes.d.ts +2 -0
- package/dist/types/server/src/api/routes/files.routes.d.ts +2 -0
- package/dist/types/server/src/api/routes/index.d.ts +7 -0
- package/dist/types/server/src/api/routes/plugins.routes.d.ts +2 -0
- package/dist/types/server/src/api/routes/streams.routes.d.ts +2 -0
- package/dist/types/server/src/api/routes/system.routes.d.ts +2 -0
- package/dist/types/server/src/api/routes/users.routes.d.ts +2 -0
- package/dist/types/server/src/api/schemas/plugins.schema.d.ts +25 -0
- package/dist/types/server/src/api/services/backup.service.d.ts +10 -0
- package/dist/types/server/src/api/utils/axios.d.ts +2 -0
- package/dist/types/server/src/api/utils/cert.d.ts +11 -0
- package/dist/types/server/src/api/utils/moveFiles.d.ts +1 -0
- package/dist/types/server/src/api/websocket/nsp/status.d.ts +1 -1
- package/dist/types/server/src/api/websocket/types.d.ts +1 -1
- package/dist/types/server/src/api.d.ts +5 -5
- package/dist/types/server/src/decoder/ffmpeg.d.ts +1 -0
- package/dist/types/server/src/decoder/index.d.ts +17 -6
- package/dist/types/server/src/decoder/types.d.ts +62 -15
- package/dist/types/server/src/decoder/worker/index.d.ts +42 -3
- package/dist/types/server/src/{camera/base → devices/camera}/cameraDevice.d.ts +5 -5
- package/dist/types/server/src/{camera/controller.d.ts → devices/camera/controller/index.d.ts} +6 -6
- package/dist/types/server/src/{camera → devices/camera/controller}/types.d.ts +11 -21
- package/dist/types/server/src/{camera/base → devices/camera}/index.d.ts +18 -16
- package/dist/types/server/src/{camera → devices/camera}/streaming/peer-connection.d.ts +10 -9
- package/dist/types/server/src/{camera → devices/camera}/streaming/streaming-session.d.ts +3 -3
- package/dist/types/server/src/{camera → devices/camera}/streaming/webrtc-connection.d.ts +4 -4
- package/dist/types/server/src/main.d.ts +21 -0
- package/dist/types/server/src/nats/constants.d.ts +1 -0
- package/dist/types/server/src/nats/index.d.ts +1 -1
- package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +2 -6
- package/dist/types/server/src/nats/proxy/deviceManager.d.ts +1 -1
- package/dist/types/server/src/nats/server.d.ts +3 -2
- package/dist/types/server/src/nats/types.d.ts +14 -28
- package/dist/types/server/src/nats/websocket.d.ts +3 -2
- package/dist/types/server/src/plugins/base.d.ts +2 -2
- package/dist/types/server/src/plugins/node/logger.d.ts +2 -0
- package/dist/types/server/src/plugins/node/proxy/cameraDevice.d.ts +10 -6
- package/dist/types/server/src/plugins/node/proxy/deviceManager.d.ts +2 -2
- package/dist/types/server/src/plugins/node/proxy/queue.d.ts +2 -2
- package/dist/types/server/src/plugins/worker-ipc.d.ts +5 -2
- package/dist/types/server/src/services/logger/index.d.ts +3 -3
- package/dist/types/server/src/utils/pythonInstaller.d.ts +2 -1
- package/dist/types/server/src/{camera/utils → utils}/subscribed.d.ts +1 -1
- package/dist/types/shared/types/index.d.ts +2 -4
- package/package.json +4 -4
- package/dist/types/server/src/api/websocket/nsp/frame.d.ts +0 -10
- package/dist/types/server/src/camera/base/cameraDeviceBrowser.d.ts +0 -6
- package/dist/types/server/src/decoder/worker/runtime/base/index.d.ts +0 -36
- package/dist/types/server/src/decoder/worker/runtime/child-process/index.d.ts +0 -17
- package/dist/types/server/src/decoder/worker/runtime/worker-thread/index.d.ts +0 -22
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import zod from 'zod';
|
|
2
|
+
export declare const installPluginSchema: zod.ZodObject<{
|
|
3
|
+
pluginname: zod.ZodEffects<zod.ZodString, string, string>;
|
|
4
|
+
pluginversion: zod.ZodDefault<zod.ZodOptional<zod.ZodString>>;
|
|
5
|
+
}, "strict", zod.ZodTypeAny, {
|
|
6
|
+
pluginname: string;
|
|
7
|
+
pluginversion: string;
|
|
8
|
+
}, {
|
|
9
|
+
pluginname: string;
|
|
10
|
+
pluginversion?: string | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const actionPluginSchema: zod.ZodObject<{
|
|
13
|
+
actionId: zod.ZodString;
|
|
14
|
+
payload: zod.ZodAny;
|
|
15
|
+
}, "strict", zod.ZodTypeAny, {
|
|
16
|
+
actionId: string;
|
|
17
|
+
payload?: any;
|
|
18
|
+
}, {
|
|
19
|
+
actionId: string;
|
|
20
|
+
payload?: any;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const patchPluginConfigJsonSchema: zod.ZodRecord<zod.ZodAny, zod.ZodAny>;
|
|
23
|
+
export type InstallPluginInput = zod.TypeOf<typeof installPluginSchema>;
|
|
24
|
+
export type ActionPluginInput = zod.TypeOf<typeof actionPluginSchema>;
|
|
25
|
+
export type PatchPluginConfigJsonInput = zod.TypeOf<typeof patchPluginConfigJsonSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BackupInfo, MultipartFile, UiLocalStorage } from '../types/index.js';
|
|
2
|
+
export declare class BackupService {
|
|
3
|
+
private logger;
|
|
4
|
+
private configService;
|
|
5
|
+
private socketService;
|
|
6
|
+
constructor();
|
|
7
|
+
createBackup(localStorage?: Partial<UiLocalStorage>): Promise<BackupInfo>;
|
|
8
|
+
restoreBackup(file: MultipartFile): Promise<any>;
|
|
9
|
+
removeBackup(backup: BackupInfo): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import forge from 'node-forge';
|
|
2
|
+
export interface CertKey {
|
|
3
|
+
cert: string;
|
|
4
|
+
certPath: string;
|
|
5
|
+
key: string;
|
|
6
|
+
keyPath: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const getCert: () => CertKey;
|
|
9
|
+
export declare const createRootCA: (customAddresses?: string[]) => CertKey;
|
|
10
|
+
export declare const createCSR: (addresses: string[], keys: forge.pki.rsa.KeyPair) => Partial<CertKey>;
|
|
11
|
+
export declare const createCert: (customAddresses?: string[]) => CertKey;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const moveFiles: (sourceDir: string, targetDir: string) => Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Namespace, Server, Socket } from 'socket.io';
|
|
2
|
-
import { PLUGIN_STATUS } from '../../../plugins/types.js';
|
|
2
|
+
import type { PLUGIN_STATUS } from '../../../plugins/types.js';
|
|
3
3
|
import { RUNTIME_STATUS } from '../../../services/config/types.js';
|
|
4
4
|
import type { SocketNsp } from '../types.js';
|
|
5
5
|
export declare class StatusNamespace {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PLUGIN_STATUS } from '../../plugins/types.js';
|
|
2
1
|
import type { Namespace } from 'socket.io';
|
|
3
2
|
import type { WebSocket } from 'ws';
|
|
3
|
+
import type { PLUGIN_STATUS } from '../../plugins/types.js';
|
|
4
4
|
import type { VideoStreamingMode } from '../database/types.js';
|
|
5
5
|
export type SocketNsp = '/camera.ui' | '/metrics' | '/logs' | '/status' | '/notifications' | '/streams' | '/plugins' | '/proxy' | '/frame';
|
|
6
6
|
export interface SocketNspMap {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import 'reflect-metadata';
|
|
3
3
|
import { EventEmitter } from 'node:events';
|
|
4
|
-
import { CameraController } from './camera/controller.js';
|
|
4
|
+
import { CameraController } from './devices/camera/controller/index.js';
|
|
5
5
|
import type { Camera, CameraExtensions } from './api/database/types.js';
|
|
6
|
-
import type {
|
|
6
|
+
import type { FrameWorker } from './decoder/worker/index.js';
|
|
7
7
|
import type { BasePlugin } from './plugins/base.js';
|
|
8
8
|
import type { API } from './plugins/node/api.js';
|
|
9
9
|
import type { PluginLogger } from './plugins/node/logger.js';
|
|
@@ -27,15 +27,15 @@ export declare class CameraUiAPI extends EventEmitter {
|
|
|
27
27
|
configureCameras(): Promise<void>;
|
|
28
28
|
addCamera(camera: Camera): Promise<{
|
|
29
29
|
controller: CameraController;
|
|
30
|
-
|
|
30
|
+
worker: FrameWorker;
|
|
31
31
|
}>;
|
|
32
32
|
getCamera(cameraId: string): {
|
|
33
33
|
controller: CameraController;
|
|
34
|
-
|
|
34
|
+
worker: FrameWorker;
|
|
35
35
|
} | undefined;
|
|
36
36
|
getCameras(pluginId?: string): {
|
|
37
37
|
controller: CameraController;
|
|
38
|
-
|
|
38
|
+
worker: FrameWorker;
|
|
39
39
|
}[];
|
|
40
40
|
updateCamera(camera: Camera, extensions: CameraExtensions): void;
|
|
41
41
|
removeCamera(camera: Camera, extensions: CameraExtensions): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function buildFfmpegArguments(ffmpegPath: string, streamUrl: string, port: number): Promise<string[]>;
|
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
export declare class
|
|
4
|
-
|
|
1
|
+
import { FrameWorker } from './worker/index.js';
|
|
2
|
+
import type { CameraController } from '../devices/camera/controller/index.js';
|
|
3
|
+
export declare class FrameManager {
|
|
4
|
+
frameWorkers: Map<string, FrameWorker>;
|
|
5
|
+
private initialized;
|
|
5
6
|
private api;
|
|
6
7
|
private proxyServer;
|
|
7
|
-
private
|
|
8
|
+
private logger;
|
|
9
|
+
private publisher?;
|
|
10
|
+
private subscriber?;
|
|
11
|
+
private subject;
|
|
8
12
|
constructor();
|
|
9
|
-
|
|
13
|
+
init(): Promise<void>;
|
|
14
|
+
addCamera(camera: CameraController): Promise<FrameWorker>;
|
|
10
15
|
removeCamera(camera: CameraController): Promise<void>;
|
|
16
|
+
private handleConnectMessage;
|
|
17
|
+
private handleDisconnectMessage;
|
|
18
|
+
private disconnectClient;
|
|
19
|
+
private disconnectAllClients;
|
|
20
|
+
private startPingPongForClient;
|
|
21
|
+
private listenToMessages;
|
|
11
22
|
}
|
|
@@ -1,53 +1,100 @@
|
|
|
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
5
|
export interface FrameMetadata {
|
|
5
6
|
format: string;
|
|
6
7
|
frameSize: number;
|
|
7
8
|
width: number;
|
|
9
|
+
origWidth: number;
|
|
8
10
|
height: number;
|
|
11
|
+
origHeight: number;
|
|
9
12
|
}
|
|
10
|
-
export interface
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
export interface ImageCrop {
|
|
14
|
+
top: number;
|
|
15
|
+
left: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
13
18
|
}
|
|
14
|
-
export interface
|
|
15
|
-
|
|
19
|
+
export interface ImageResize {
|
|
20
|
+
width?: number;
|
|
21
|
+
height?: number;
|
|
22
|
+
options?: ResizeOptions;
|
|
23
|
+
}
|
|
24
|
+
export interface ImageRotate {
|
|
25
|
+
angle: number;
|
|
26
|
+
options?: RotateOptions;
|
|
27
|
+
}
|
|
28
|
+
export interface ImageFormat {
|
|
29
|
+
format: 'rgba' | 'gray';
|
|
30
|
+
}
|
|
31
|
+
export interface ImageOptions {
|
|
32
|
+
format?: ImageFormat;
|
|
33
|
+
crop?: ImageCrop;
|
|
34
|
+
resize?: ImageResize;
|
|
35
|
+
rotate?: ImageRotate;
|
|
36
|
+
}
|
|
37
|
+
export interface ProcessImageRequest {
|
|
38
|
+
options: ImageOptions;
|
|
16
39
|
data: Buffer;
|
|
17
40
|
}
|
|
41
|
+
export interface VideoFrame {
|
|
42
|
+
metadata: FrameMetadata;
|
|
43
|
+
inputWidth: number;
|
|
44
|
+
inputHeight: number;
|
|
45
|
+
inputFormat: string;
|
|
46
|
+
toBuffer: (options?: ImageOptions) => Promise<Buffer>;
|
|
47
|
+
toImage: (options?: ImageOptions) => Promise<Sharp>;
|
|
48
|
+
}
|
|
18
49
|
export interface VideoSession {
|
|
19
50
|
isActive(): boolean;
|
|
20
51
|
kill: (reason?: string) => void;
|
|
21
52
|
cp: ChildProcess;
|
|
22
53
|
}
|
|
23
54
|
export interface BaseFrameWorkerConfig {
|
|
55
|
+
frameWorkerId: string;
|
|
24
56
|
cameraId: string;
|
|
25
57
|
cameraName: string;
|
|
26
58
|
ffmpegPath: string;
|
|
27
|
-
logLevel
|
|
28
|
-
disableTimestamps
|
|
59
|
+
logLevel: string;
|
|
60
|
+
disableTimestamps: boolean;
|
|
29
61
|
auth: {
|
|
30
62
|
user: string;
|
|
31
63
|
pass: string;
|
|
32
64
|
};
|
|
33
65
|
}
|
|
34
|
-
export type WorkerMessage = '
|
|
35
|
-
export type MainMessage = 'getMetadata' | '
|
|
66
|
+
export type WorkerMessage = 'started' | 'getFFmpegArgs';
|
|
67
|
+
export type MainMessage = 'getMetadata' | 'startVideoSession' | 'stopVideoSession' | 'setCameraName';
|
|
36
68
|
export interface MainToWorkerMessage {
|
|
37
|
-
id: string;
|
|
38
69
|
message: MainMessage;
|
|
39
70
|
data: Record<string, any>;
|
|
40
71
|
}
|
|
41
72
|
export interface WorkerToMainResponse {
|
|
42
|
-
|
|
43
|
-
response: any;
|
|
73
|
+
response?: Record<string, any>;
|
|
44
74
|
}
|
|
45
75
|
export interface WorkerToMainMessage {
|
|
46
|
-
id: string;
|
|
47
76
|
message: WorkerMessage;
|
|
48
77
|
data: Record<string, any>;
|
|
49
78
|
}
|
|
50
79
|
export interface MainToWorkerResponse {
|
|
51
|
-
|
|
52
|
-
|
|
80
|
+
response?: Record<string, any>;
|
|
81
|
+
}
|
|
82
|
+
export interface SignalingRequest {
|
|
83
|
+
type: 'connect' | 'disconnect';
|
|
84
|
+
requestId: string;
|
|
85
|
+
cameraId: string;
|
|
86
|
+
pluginId: string;
|
|
87
|
+
}
|
|
88
|
+
export interface SignalingResponse {
|
|
89
|
+
type: 'connected' | 'disconnected' | 'error';
|
|
90
|
+
requestId: string;
|
|
91
|
+
message?: string;
|
|
92
|
+
}
|
|
93
|
+
export interface PingMessage {
|
|
94
|
+
type: 'ping';
|
|
95
|
+
requestId: string;
|
|
96
|
+
}
|
|
97
|
+
export interface PongMessage {
|
|
98
|
+
type: 'pong';
|
|
99
|
+
requestId: string;
|
|
53
100
|
}
|
|
@@ -1,3 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Subscribed } from '../../utils/subscribed.js';
|
|
2
|
+
import type { CameraController } from '../../devices/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 {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { StreamingSession } from '../streaming/streaming-session.js';
|
|
2
1
|
import { BaseCameraDevice } from './index.js';
|
|
3
|
-
import
|
|
4
|
-
import type {
|
|
5
|
-
import type { CameraDelegate, CameraPrebufferDelegate, FfmpegOptions } from '
|
|
2
|
+
import { StreamingSession } from './streaming/streaming-session.js';
|
|
3
|
+
import type { VideoFrame } from '../../decoder/types.js';
|
|
4
|
+
import type { CameraDelegate, CameraPrebufferDelegate, FfmpegOptions } from './controller/types.js';
|
|
5
|
+
import type { StreamingConnectionOptions } from './streaming/peer-connection.js';
|
|
6
6
|
export declare abstract class CameraDevice extends BaseCameraDevice {
|
|
7
7
|
private _delegate?;
|
|
8
8
|
private _prebufferDelegate?;
|
|
@@ -10,7 +10,7 @@ export declare abstract class CameraDevice extends BaseCameraDevice {
|
|
|
10
10
|
set delegate(delegate: CameraDelegate);
|
|
11
11
|
get prebufferDelegate(): CameraPrebufferDelegate | undefined;
|
|
12
12
|
set prebufferDelegate(delegate: CameraPrebufferDelegate);
|
|
13
|
-
abstract generateFrames(): AsyncIterableIterator<
|
|
13
|
+
abstract generateFrames(): AsyncIterableIterator<VideoFrame>;
|
|
14
14
|
abstract getFfmpegPath(): Promise<string>;
|
|
15
15
|
snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
|
|
16
16
|
createSession(sourceName: string, options?: StreamingConnectionOptions): Promise<StreamingSession>;
|
package/dist/types/server/src/{camera/controller.d.ts → devices/camera/controller/index.d.ts}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CameraDevice } from '
|
|
2
|
-
import type { Camera } from '
|
|
3
|
-
import type {
|
|
4
|
-
import type { ProxyServer } from '
|
|
5
|
-
import type { IceServer } from '
|
|
1
|
+
import { CameraDevice } from '../cameraDevice.js';
|
|
2
|
+
import type { Camera } from '../../../api/database/types.js';
|
|
3
|
+
import type { VideoFrame } from '../../../decoder/types.js';
|
|
4
|
+
import type { ProxyServer } from '../../../nats/index.js';
|
|
5
|
+
import type { IceServer } from '../../../services/config/types.js';
|
|
6
6
|
import type { BaseLogger } from './types.js';
|
|
7
7
|
export declare class CameraController extends CameraDevice {
|
|
8
8
|
private proxy;
|
|
@@ -13,7 +13,7 @@ export declare class CameraController extends CameraDevice {
|
|
|
13
13
|
connect(): Promise<void>;
|
|
14
14
|
disconnect(): Promise<void>;
|
|
15
15
|
reboot(): Promise<void>;
|
|
16
|
-
generateFrames(): AsyncIterableIterator<
|
|
16
|
+
generateFrames(): AsyncIterableIterator<VideoFrame>;
|
|
17
17
|
getFfmpegPath(): Promise<string>;
|
|
18
18
|
getIceServers(): Promise<IceServer[]>;
|
|
19
19
|
updateCamera(updatedCamera: Camera): void;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import type {
|
|
3
|
-
import type { CameraInformation, CameraInput, CameraInputSettings } from '../api/database/types.js';
|
|
2
|
+
import type { CameraInformation, CameraInput, CameraInputSettings } from '../../../api/database/types.js';
|
|
4
3
|
export type SpawnInput = string | number;
|
|
5
4
|
export type PrebufferType = 'recording' | 'stream';
|
|
6
5
|
export interface CameraSource extends CameraInput {
|
|
@@ -21,19 +20,6 @@ export interface FfmpegOptions {
|
|
|
21
20
|
audio?: SpawnInput[];
|
|
22
21
|
output: SpawnInput[];
|
|
23
22
|
}
|
|
24
|
-
export interface BasicBrowserPeerConnection {
|
|
25
|
-
enableMicrophone(track: MediaStreamTrack): void;
|
|
26
|
-
disableMicrophone(): void;
|
|
27
|
-
createOffer(): Promise<RTCSessionDescriptionInit>;
|
|
28
|
-
acceptAnswer(answer: {
|
|
29
|
-
type: 'answer';
|
|
30
|
-
sdp: string;
|
|
31
|
-
}): Promise<void>;
|
|
32
|
-
addIceCandidate(candidate: Partial<RTCIceCandidate>): Promise<void>;
|
|
33
|
-
onIceCandidate: Subject<RTCIceCandidate>;
|
|
34
|
-
onConnectionState: Observable<RTCPeerConnectionState>;
|
|
35
|
-
close(): void;
|
|
36
|
-
}
|
|
37
23
|
export interface CameraDelegate {
|
|
38
24
|
snapshotRequest(requestId: string): Promise<Buffer>;
|
|
39
25
|
prepareStream(requestId: string): Promise<void>;
|
|
@@ -102,17 +88,20 @@ export type CameraConfig = (BaseCameraConfig & {
|
|
|
102
88
|
});
|
|
103
89
|
export interface BaseDetection {
|
|
104
90
|
id?: string;
|
|
105
|
-
}
|
|
106
|
-
export interface MotionDetection extends BaseDetection {
|
|
107
91
|
label: string;
|
|
92
|
+
confidence: number;
|
|
108
93
|
boundingBox: [number, number, number, number];
|
|
94
|
+
inputWidth: number;
|
|
95
|
+
inputHeight: number;
|
|
96
|
+
origWidth: number;
|
|
97
|
+
origHeight: number;
|
|
98
|
+
}
|
|
99
|
+
export interface MotionDetection extends BaseDetection {
|
|
109
100
|
}
|
|
110
101
|
export interface ObjectDetection extends BaseDetection {
|
|
111
|
-
lebel: string;
|
|
112
|
-
boundingBox: [number, number, number, number];
|
|
113
102
|
}
|
|
114
103
|
export interface BaseState<T extends LightState | AudioState | MotionState | ObjectState | SirenState | BatteryState | DoorbellState> {
|
|
115
|
-
timestamp:
|
|
104
|
+
timestamp: string;
|
|
116
105
|
lastEvent?: Omit<T, 'lastEvent'>;
|
|
117
106
|
}
|
|
118
107
|
export interface MotionSetEvent {
|
|
@@ -148,7 +137,8 @@ export type DoorbellState = BaseState<DoorbellState> & DoorbellSetEvent;
|
|
|
148
137
|
export type SirenState = BaseState<SirenState> & SirenSetEvent;
|
|
149
138
|
export type ObjectState = BaseState<ObjectState> & ObjectSetEvent;
|
|
150
139
|
export type BatteryState = BaseState<BatteryState> & BatterySetEvent;
|
|
151
|
-
export type
|
|
140
|
+
export type States = LightState | MotionState | AudioState | ObjectState | DoorbellState | SirenState | BatteryState;
|
|
141
|
+
export type Sets = LightSetEvent | MotionSetEvent | AudioSetEvent | ObjectSetEvent | DoorbellSetEvent | SirenSetEvent | BatterySetEvent;
|
|
152
142
|
export interface StateValues {
|
|
153
143
|
light: LightState;
|
|
154
144
|
motion: MotionState;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { LRUCache } from 'lru-cache';
|
|
2
|
-
import { BehaviorSubject
|
|
2
|
+
import { BehaviorSubject } from 'rxjs';
|
|
3
|
+
import type { Observable, Subscription } from 'rxjs';
|
|
3
4
|
import type { Camera, CameraInformation, CameraPublicProperties, CameraType, CameraZone } from '../../api/database/types.js';
|
|
4
5
|
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, SirenSetEvent, SirenState,
|
|
6
|
+
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';
|
|
6
7
|
declare class Subscribed {
|
|
7
8
|
private readonly subscriptions;
|
|
8
9
|
private readonly additionalSubscriptions;
|
|
@@ -75,22 +76,23 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
75
76
|
newData: Camera[T];
|
|
76
77
|
}>;
|
|
77
78
|
removeAllListeners(): void;
|
|
78
|
-
protected getAudioState(event: AudioSetEvent): AudioState
|
|
79
|
-
protected getMotionState(event: MotionSetEvent): MotionState
|
|
80
|
-
protected getObjectState(event: ObjectSetEvent): ObjectState
|
|
81
|
-
protected getDoorbellState(event: DoorbellSetEvent): DoorbellState
|
|
82
|
-
protected getLightState(event: LightSetEvent): LightState
|
|
83
|
-
protected getSirenState(event: SirenSetEvent): SirenState
|
|
84
|
-
protected getBatteryState(event: BatterySetEvent): BatteryState
|
|
79
|
+
protected getAudioState(event: AudioSetEvent): AudioState;
|
|
80
|
+
protected getMotionState(event: MotionSetEvent): MotionState;
|
|
81
|
+
protected getObjectState(event: ObjectSetEvent): ObjectState;
|
|
82
|
+
protected getDoorbellState(event: DoorbellSetEvent): DoorbellState;
|
|
83
|
+
protected getLightState(event: LightSetEvent | LightState): LightState;
|
|
84
|
+
protected getSirenState(event: SirenSetEvent): SirenState;
|
|
85
|
+
protected getBatteryState(event: BatterySetEvent): BatteryState;
|
|
85
86
|
private createStateObservable;
|
|
86
87
|
protected updateCamera(updatedCamera: Camera): void;
|
|
87
88
|
protected updateCameraState(state: boolean): void;
|
|
88
|
-
protected stateChanged<T extends keyof
|
|
89
|
-
protected isAudioState(state:
|
|
90
|
-
protected isMotionState(state:
|
|
91
|
-
protected isObjectState(state:
|
|
92
|
-
protected isSirenState(state:
|
|
93
|
-
protected isBatteryState(state:
|
|
94
|
-
protected isGenericState(state:
|
|
89
|
+
protected stateChanged<T extends keyof SetValues>(oldState?: SetValues[T], newState?: SetValues[T]): boolean;
|
|
90
|
+
protected isAudioState(state: Sets): state is AudioSetEvent;
|
|
91
|
+
protected isMotionState(state: Sets): state is MotionSetEvent;
|
|
92
|
+
protected isObjectState(state: Sets): state is ObjectSetEvent;
|
|
93
|
+
protected isSirenState(state: Sets): state is SirenSetEvent;
|
|
94
|
+
protected isBatteryState(state: Sets): state is BatterySetEvent;
|
|
95
|
+
protected isGenericState(state: Sets): state is DoorbellSetEvent;
|
|
96
|
+
protected isStateEvent(state: States | Sets): state is States;
|
|
95
97
|
}
|
|
96
98
|
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { MediaStreamTrack
|
|
3
|
-
import { Subscribed } from '
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
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';
|
|
7
|
+
import type { CameraDevice } from '../cameraDevice.js';
|
|
8
|
+
import type { BaseLogger } from '../controller/types.js';
|
|
8
9
|
export interface BasicPeerConnection {
|
|
9
10
|
createOffer(): Promise<RTCSessionDescription>;
|
|
10
11
|
acceptAnswer(answer: {
|
|
@@ -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<
|
|
29
|
-
onConnectionState: ReplaySubject<"
|
|
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,8 +1,8 @@
|
|
|
1
1
|
import { ReplaySubject, Subject } from 'rxjs';
|
|
2
2
|
import { RtpPacket } from 'werift';
|
|
3
|
-
import { Subscribed } from '
|
|
4
|
-
import type { CameraDevice } from '../
|
|
5
|
-
import type { BaseLogger, FfmpegOptions, SpawnInput } from '../types.js';
|
|
3
|
+
import { Subscribed } from '../../../utils/subscribed.js';
|
|
4
|
+
import type { CameraDevice } from '../cameraDevice.js';
|
|
5
|
+
import type { BaseLogger, FfmpegOptions, SpawnInput } from '../controller/types.js';
|
|
6
6
|
import type { WebrtcConnection } from './webrtc-connection.js';
|
|
7
7
|
export declare class StreamingSession extends Subscribed {
|
|
8
8
|
readonly onCallEnded: ReplaySubject<void>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReplaySubject, Subject, type Observable } from 'rxjs';
|
|
2
|
-
import { Subscribed } from '
|
|
2
|
+
import { Subscribed } from '../../../utils/subscribed.js';
|
|
3
3
|
import type { RtpPacket } from 'werift';
|
|
4
|
-
import type { IceServer } from '
|
|
5
|
-
import type { CameraDevice } from '../
|
|
6
|
-
import type { BaseLogger } from '../types.js';
|
|
4
|
+
import type { IceServer } from '../../../services/config/types.js';
|
|
5
|
+
import type { CameraDevice } from '../cameraDevice.js';
|
|
6
|
+
import type { BaseLogger } from '../controller/types.js';
|
|
7
7
|
import type { StreamingConnectionOptions } from './peer-connection.js';
|
|
8
8
|
export declare class WebrtcConnection extends Subscribed {
|
|
9
9
|
readonly onCameraConnected: ReplaySubject<void>;
|
|
@@ -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
|
+
}
|
|
@@ -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/types.js';
|
|
5
|
+
import type { StateValues } from '../devices/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 {
|
|
4
|
-
import type {
|
|
3
|
+
import type { FrameMetadata } from '../../decoder/types.js';
|
|
4
|
+
import type { CameraDelegate, CameraPrebufferDelegate, FfmpegOptions, PrebufferType, SetValues, StateValues, StreamInfo } from '../../devices/camera/controller/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';
|
|
@@ -46,10 +46,6 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
|
|
|
46
46
|
cameraId: string;
|
|
47
47
|
pluginId: string;
|
|
48
48
|
}): Promise<FrameMetadata>;
|
|
49
|
-
getFrameSession(data: {
|
|
50
|
-
cameraId: string;
|
|
51
|
-
pluginId: string;
|
|
52
|
-
}): Promise<FrameSession>;
|
|
53
49
|
getFfmpegPath(): string;
|
|
54
50
|
getIceServers(): IceServer[];
|
|
55
51
|
snapshot(data: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Camera } from '../../api/database/types.js';
|
|
2
|
-
import type { CameraConfig } from '../../camera/types.js';
|
|
2
|
+
import type { CameraConfig } from '../../devices/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 {
|
|
@@ -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;
|