@camera.ui/browser 0.0.68 → 0.0.70
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/client.d.ts +2 -2
- package/dist/types/packages/client/browser/src/index.d.ts +2 -2
- package/dist/types/packages/client/browser/src/proxy/cameraDevice.d.ts +4 -5
- package/dist/types/packages/client/browser/src/proxy/deviceManager.d.ts +3 -3
- package/dist/types/packages/client/browser/src/proxy/index.d.ts +4 -4
- package/dist/types/packages/client/browser/src/proxy/pluginsManager.d.ts +2 -2
- package/dist/types/packages/client/browser/src/proxy/systemManager.d.ts +2 -2
- package/dist/types/packages/client/browser/src/socket.d.ts +1 -1
- package/dist/types/packages/client/browser/src/types.d.ts +3 -3
- package/dist/types/server/bin/python.d.ts +43 -0
- package/dist/types/server/src/api/database/index.d.ts +24 -0
- package/dist/types/server/src/api/database/types.d.ts +13 -35
- package/dist/types/server/src/api/go2rtc/api/application.d.ts +9 -0
- package/dist/types/server/src/api/go2rtc/api/config.d.ts +9 -0
- package/dist/types/server/src/api/go2rtc/api/index.d.ts +2 -0
- package/dist/types/server/src/api/go2rtc/api/snapshot.d.ts +8 -0
- package/dist/types/server/src/api/go2rtc/api/streams.d.ts +11 -0
- package/dist/types/server/src/api/go2rtc/index.d.ts +13 -0
- package/dist/types/server/src/api/go2rtc/queue.d.ts +10 -0
- package/dist/types/server/src/api/middlewares/socketAuth.middleware.d.ts +41 -0
- package/dist/types/server/src/api/schemas/backup.schema.d.ts +2 -2
- package/dist/types/server/src/api/schemas/cameras.schema.d.ts +1 -1
- package/dist/types/server/src/api/schemas/config.schema.d.ts +1 -1
- package/dist/types/server/src/api/schemas/go2rtc.schema.d.ts +1 -1
- package/dist/types/server/src/api/schemas/users.schema.d.ts +2 -2
- package/dist/types/server/src/api/services/auth.service.d.ts +20 -0
- package/dist/types/server/src/api/services/cameras.service.d.ts +54 -0
- package/dist/types/server/src/api/services/plugins.service.d.ts +25 -0
- package/dist/types/server/src/api/services/users.service.d.ts +13 -0
- package/dist/types/server/src/api/types/index.d.ts +12 -12
- package/dist/types/server/src/api/utils/constants.d.ts +15 -0
- package/dist/types/server/src/api/websocket/index.d.ts +15 -0
- package/dist/types/server/src/api/websocket/nsp/frame.d.ts +10 -0
- package/dist/types/server/src/api/websocket/nsp/logs.d.ts +11 -0
- package/dist/types/server/src/api/websocket/nsp/metrics.d.ts +33 -0
- package/dist/types/server/src/api/websocket/nsp/notifications.d.ts +11 -0
- package/dist/types/server/src/api/websocket/nsp/plugins.d.ts +13 -0
- package/dist/types/server/src/api/websocket/nsp/server.d.ts +9 -0
- package/dist/types/server/src/api/websocket/nsp/status.d.ts +20 -0
- package/dist/types/server/src/api/websocket/nsp/streams.d.ts +15 -0
- package/dist/types/server/src/api/{ws → websocket}/types.d.ts +3 -3
- package/dist/types/server/src/api.d.ts +44 -0
- package/dist/types/server/src/camera/base/cameraDevice.d.ts +6 -5
- package/dist/types/server/src/camera/base/cameraDeviceBrowser.d.ts +3 -2
- package/dist/types/server/src/camera/base/index.d.ts +18 -3
- package/dist/types/server/src/camera/controller.d.ts +27 -0
- package/dist/types/server/src/camera/streaming/browser/browser-peer-connection.d.ts +4 -4
- package/dist/types/server/src/camera/streaming/browser/browser-streaming-session.d.ts +4 -4
- package/dist/types/server/src/camera/streaming/browser/webrtc-browser-connection.d.ts +5 -5
- package/dist/types/server/src/camera/streaming/peer-connection.d.ts +4 -4
- package/dist/types/server/src/camera/streaming/streaming-session.d.ts +4 -4
- package/dist/types/server/src/camera/streaming/webrtc-connection.d.ts +5 -5
- package/dist/types/server/src/camera/types.d.ts +29 -22
- package/dist/types/server/src/decoder/index.d.ts +11 -0
- package/dist/types/server/src/decoder/types.d.ts +7 -3
- package/dist/types/server/src/decoder/worker/index.d.ts +3 -0
- package/dist/types/server/src/decoder/worker/runtime/base/index.d.ts +36 -0
- package/dist/types/server/src/decoder/worker/runtime/child-process/index.d.ts +17 -0
- package/dist/types/server/src/decoder/worker/runtime/worker-thread/index.d.ts +22 -0
- package/dist/types/server/src/go2rtc/index.d.ts +25 -0
- package/dist/types/server/src/nats/constants.d.ts +1 -0
- package/dist/types/server/src/nats/index.d.ts +34 -0
- package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +96 -0
- package/dist/types/server/src/nats/proxy/deviceManager.d.ts +31 -0
- package/dist/types/server/src/nats/proxy/index.d.ts +4 -0
- package/dist/types/server/src/nats/proxy/pluginsManager.d.ts +12 -0
- package/dist/types/server/src/nats/proxy/systemManager.d.ts +8 -0
- package/dist/types/server/src/nats/queue.d.ts +17 -0
- package/dist/types/server/src/nats/server.d.ts +33 -0
- package/dist/types/server/src/nats/types.d.ts +21 -13
- package/dist/types/server/src/nats/utils.d.ts +4 -0
- package/dist/types/server/src/nats/websocket.d.ts +22 -0
- package/dist/types/server/src/plugins/base.d.ts +7 -0
- package/dist/types/server/src/plugins/index.d.ts +29 -0
- package/dist/types/server/src/plugins/node/api.d.ts +42 -0
- package/dist/types/server/src/plugins/node/cameraStorage.d.ts +108 -0
- package/dist/types/server/src/plugins/node/config.d.ts +104 -0
- package/dist/types/server/src/plugins/node/logger.d.ts +14 -0
- package/dist/types/server/src/plugins/node/proxy/cameraDevice.d.ts +44 -0
- package/dist/types/server/src/plugins/node/proxy/deviceManager.d.ts +47 -0
- package/dist/types/server/src/plugins/node/proxy/index.d.ts +4 -0
- package/dist/types/server/src/plugins/node/proxy/pluginsManager.d.ts +38 -0
- package/dist/types/server/src/plugins/node/proxy/queue.d.ts +18 -0
- package/dist/types/server/src/plugins/node/proxy/systemManager.d.ts +36 -0
- package/dist/types/server/src/plugins/node/schema.d.ts +268 -0
- package/dist/types/server/src/plugins/node/storageController.d.ts +28 -0
- package/dist/types/server/src/plugins/plugin.d.ts +42 -0
- package/dist/types/server/src/plugins/types.d.ts +3 -3
- package/dist/types/server/src/plugins/worker-ipc.d.ts +22 -0
- package/dist/types/server/src/plugins/worker.d.ts +30 -0
- package/dist/types/server/src/services/config/constants.d.ts +6 -0
- package/dist/types/server/src/services/config/index.d.ts +60 -0
- package/dist/types/server/src/services/logger/index.d.ts +28 -0
- package/dist/types/server/src/utils/index.d.ts +6 -0
- package/dist/types/shared/types/index.d.ts +12 -12
- package/package.json +6 -5
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Namespace, Server, Socket } from 'socket.io';
|
|
2
|
+
import type { SocketNsp } from '../types.js';
|
|
3
|
+
export declare class NotificationsNamespace {
|
|
4
|
+
nsp: Namespace;
|
|
5
|
+
nspName: SocketNsp;
|
|
6
|
+
private logger;
|
|
7
|
+
constructor(io: Server);
|
|
8
|
+
clearNotifications(): Promise<void>;
|
|
9
|
+
getNotifications(socket: Socket): Promise<void>;
|
|
10
|
+
removeNotification(id?: string): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Namespace, Server } from 'socket.io';
|
|
2
|
+
import type { PLUGIN_STATUS } from '../../../plugins/types.js';
|
|
3
|
+
import type { SocketNsp } from '../types.js';
|
|
4
|
+
export declare class PluginsNamespace {
|
|
5
|
+
nsp: Namespace;
|
|
6
|
+
nspName: SocketNsp;
|
|
7
|
+
private pluginManager;
|
|
8
|
+
constructor(io: Server);
|
|
9
|
+
pluginStatus(pluginName: string, callback?: Function): Promise<void | {
|
|
10
|
+
pluginName: string;
|
|
11
|
+
status: PLUGIN_STATUS;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Namespace, Server, Socket } from 'socket.io';
|
|
2
|
+
import type { SocketNsp } from '../types.js';
|
|
3
|
+
export declare class ServerNamespace {
|
|
4
|
+
nsp: Namespace;
|
|
5
|
+
nspName: SocketNsp;
|
|
6
|
+
private logger;
|
|
7
|
+
constructor(io: Server);
|
|
8
|
+
checkUpdate(socket?: Socket): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Namespace, Server, Socket } from 'socket.io';
|
|
2
|
+
import { PLUGIN_STATUS } from '../../../plugins/types.js';
|
|
3
|
+
import { RUNTIME_STATUS } from '../../../services/config/types.js';
|
|
4
|
+
import type { SocketNsp } from '../types.js';
|
|
5
|
+
export declare class StatusNamespace {
|
|
6
|
+
nsp: Namespace;
|
|
7
|
+
nspName: SocketNsp;
|
|
8
|
+
private configService;
|
|
9
|
+
private pluginManager;
|
|
10
|
+
private go2rtc;
|
|
11
|
+
constructor(io: Server);
|
|
12
|
+
watchStats(socket: Socket, payload: any, callback?: Function): {
|
|
13
|
+
name: string;
|
|
14
|
+
status: RUNTIME_STATUS;
|
|
15
|
+
}[];
|
|
16
|
+
watchPluginStats(socket: Socket, payload: any, callback?: Function): {
|
|
17
|
+
name: string;
|
|
18
|
+
status: PLUGIN_STATUS;
|
|
19
|
+
}[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Namespace, Server } from 'socket.io';
|
|
2
|
+
import type { SocketNsp } from '../types.js';
|
|
3
|
+
export declare class StreamsNamespace {
|
|
4
|
+
nsp: Namespace;
|
|
5
|
+
nspName: SocketNsp;
|
|
6
|
+
private bridges;
|
|
7
|
+
private logger;
|
|
8
|
+
private configService;
|
|
9
|
+
constructor(io: Server);
|
|
10
|
+
private connectBridge;
|
|
11
|
+
private sendMessage;
|
|
12
|
+
private closeBridge;
|
|
13
|
+
private onEnd;
|
|
14
|
+
private onDestroy;
|
|
15
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { PLUGIN_STATUS } from '../../plugins/types';
|
|
1
|
+
import { PLUGIN_STATUS } from '../../plugins/types.js';
|
|
2
2
|
import type { Namespace } from 'socket.io';
|
|
3
3
|
import type { WebSocket } from 'ws';
|
|
4
|
-
import type { VideoStreamingMode } from '../database/types';
|
|
5
|
-
export type SocketNsp = '/camera.ui' | '/metrics' | '/logs' | '/status' | '/notifications' | '/streams' | '/plugins' | '/proxy';
|
|
4
|
+
import type { VideoStreamingMode } from '../database/types.js';
|
|
5
|
+
export type SocketNsp = '/camera.ui' | '/metrics' | '/logs' | '/status' | '/notifications' | '/streams' | '/plugins' | '/proxy' | '/frame';
|
|
6
6
|
export interface SocketNspMap {
|
|
7
7
|
nsp: Namespace;
|
|
8
8
|
[key: string]: any;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import 'reflect-metadata';
|
|
3
|
+
import { EventEmitter } from 'node:events';
|
|
4
|
+
import { CameraController } from './camera/controller.js';
|
|
5
|
+
import type { Camera, CameraExtensions } from './api/database/types.js';
|
|
6
|
+
import type { StreamManager } from './decoder/worker/index.js';
|
|
7
|
+
import type { BasePlugin } from './plugins/base.js';
|
|
8
|
+
import type { API } from './plugins/node/api.js';
|
|
9
|
+
import type { PluginLogger } from './plugins/node/logger.js';
|
|
10
|
+
import type { CameraExtension } from './plugins/types.js';
|
|
11
|
+
export interface PluginConstructor {
|
|
12
|
+
new (logger: PluginLogger, api: API): BasePlugin;
|
|
13
|
+
}
|
|
14
|
+
export declare const enum API_EVENT {
|
|
15
|
+
FINISH_LAUNCHING = "finishLaunching",
|
|
16
|
+
SHUTDOWN = "shutdown"
|
|
17
|
+
}
|
|
18
|
+
export declare interface CameraUiAPI {
|
|
19
|
+
on(event: 'finishLaunching', listener: () => void): this;
|
|
20
|
+
on(event: 'shutdown', listener: () => void): this;
|
|
21
|
+
emit(event: 'finishLaunching'): boolean;
|
|
22
|
+
emit(event: 'shutdown'): boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare class CameraUiAPI extends EventEmitter {
|
|
25
|
+
private camerasMap;
|
|
26
|
+
constructor();
|
|
27
|
+
configureCameras(): Promise<void>;
|
|
28
|
+
addCamera(camera: Camera): Promise<{
|
|
29
|
+
controller: CameraController;
|
|
30
|
+
manager: StreamManager;
|
|
31
|
+
}>;
|
|
32
|
+
getCamera(cameraId: string): {
|
|
33
|
+
controller: CameraController;
|
|
34
|
+
manager: StreamManager;
|
|
35
|
+
} | undefined;
|
|
36
|
+
getCameras(pluginId?: string): {
|
|
37
|
+
controller: CameraController;
|
|
38
|
+
manager: StreamManager;
|
|
39
|
+
}[];
|
|
40
|
+
updateCamera(camera: Camera, extensions: CameraExtensions): void;
|
|
41
|
+
removeCamera(camera: Camera, extensions: CameraExtensions): Promise<void>;
|
|
42
|
+
selectCamera(pluginId: string, camera: Camera, extension: CameraExtension): void;
|
|
43
|
+
deselectCamera(pluginId: string, camera: Camera, extension: CameraExtension): void;
|
|
44
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import type { Frame } from '../../decoder/types';
|
|
5
|
-
import type { CameraDelegate, CameraPrebufferDelegate, FfmpegOptions } from '../types';
|
|
1
|
+
import { StreamingConnectionOptions } from '../streaming/peer-connection.js';
|
|
2
|
+
import { StreamingSession } from '../streaming/streaming-session.js';
|
|
3
|
+
import { BaseCameraDevice } from './index.js';
|
|
4
|
+
import type { Frame } from '../../decoder/types.js';
|
|
5
|
+
import type { CameraDelegate, CameraPrebufferDelegate, FfmpegOptions } from '../types.js';
|
|
6
6
|
export declare abstract class CameraDevice extends BaseCameraDevice {
|
|
7
7
|
private _delegate?;
|
|
8
8
|
private _prebufferDelegate?;
|
|
@@ -12,6 +12,7 @@ export declare abstract class CameraDevice extends BaseCameraDevice {
|
|
|
12
12
|
set prebufferDelegate(delegate: CameraPrebufferDelegate);
|
|
13
13
|
abstract generateFrames(): AsyncIterableIterator<Frame>;
|
|
14
14
|
abstract getFfmpegPath(): Promise<string>;
|
|
15
|
+
snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
|
|
15
16
|
createSession(sourceName: string, options?: StreamingConnectionOptions): Promise<StreamingSession>;
|
|
16
17
|
streamVideo(sourceName: string, options: FfmpegOptions): Promise<StreamingSession>;
|
|
17
18
|
recordToFile(sourceName: string, outputPath: string, duration?: number): Promise<void>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BrowserStreamingSession } from '../streaming/browser/browser-streaming-session.js';
|
|
2
|
+
import { BaseCameraDevice } from './index.js';
|
|
3
3
|
export declare abstract class BrowserCameraDevice extends BaseCameraDevice {
|
|
4
|
+
snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
|
|
4
5
|
createSession(sourceName: string, videoElement: HTMLVideoElement): Promise<BrowserStreamingSession>;
|
|
5
6
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { LRUCache } from 'lru-cache';
|
|
1
2
|
import { BehaviorSubject, Observable, Subscription } from 'rxjs';
|
|
2
|
-
import type { Camera, CameraInformation, CameraPublicProperties, CameraType, CameraZone } from '../../api/database/types';
|
|
3
|
-
import type { IceServer } from '../../services/config/types';
|
|
4
|
-
import type { AudioState, BaseLogger, BatteryState, CameraSource, DoorbellState, LightState, MotionState, ObjectState, OnSetEvent, SirenState, StateValues } from '../types';
|
|
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, OnSetEvent, SirenSetEvent, SirenState, State, StateValues } from '../types.js';
|
|
5
6
|
declare class Subscribed {
|
|
6
7
|
private readonly subscriptions;
|
|
7
8
|
private readonly additionalSubscriptions;
|
|
@@ -12,6 +13,7 @@ declare class Subscribed {
|
|
|
12
13
|
}
|
|
13
14
|
export declare abstract class BaseCameraDevice extends Subscribed {
|
|
14
15
|
protected logger: BaseLogger;
|
|
16
|
+
protected snapshotCache: LRUCache<string, ArrayBuffer, unknown>;
|
|
15
17
|
protected cameraSubject: BehaviorSubject<Camera>;
|
|
16
18
|
protected cameraState: BehaviorSubject<boolean>;
|
|
17
19
|
protected lightState: BehaviorSubject<LightState>;
|
|
@@ -73,8 +75,21 @@ export declare abstract class BaseCameraDevice extends Subscribed {
|
|
|
73
75
|
newData: Camera[T];
|
|
74
76
|
}>;
|
|
75
77
|
removeAllListeners(): void;
|
|
78
|
+
protected getAudioState(event: AudioSetEvent): AudioState | undefined;
|
|
79
|
+
protected getMotionState(event: MotionSetEvent): MotionState | undefined;
|
|
80
|
+
protected getObjectState(event: ObjectSetEvent): ObjectState | undefined;
|
|
81
|
+
protected getDoorbellState(event: DoorbellSetEvent): DoorbellState | undefined;
|
|
82
|
+
protected getLightState(event: LightSetEvent): LightState | undefined;
|
|
83
|
+
protected getSirenState(event: SirenSetEvent): SirenState | undefined;
|
|
84
|
+
protected getBatteryState(event: BatterySetEvent): BatteryState | undefined;
|
|
76
85
|
private createStateObservable;
|
|
77
86
|
protected updateCamera(updatedCamera: Camera): void;
|
|
78
87
|
protected updateCameraState(state: boolean): void;
|
|
88
|
+
protected stateChanged<T extends keyof StateValues>(oldState?: StateValues[T], newState?: StateValues[T]): boolean;
|
|
89
|
+
protected isAudioState(state: State): state is AudioState;
|
|
90
|
+
protected isMotionState(state: State): state is MotionState;
|
|
91
|
+
protected isObjectState(state: State): state is ObjectState;
|
|
92
|
+
protected isSirenState(state: State): state is SirenState;
|
|
93
|
+
protected isGenericState(state: State): state is DoorbellState;
|
|
79
94
|
}
|
|
80
95
|
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CameraDevice } from './base/cameraDevice.js';
|
|
2
|
+
import type { Camera } from '../api/database/types.js';
|
|
3
|
+
import type { Frame } from '../decoder/types.js';
|
|
4
|
+
import type { ProxyServer } from '../nats/index.js';
|
|
5
|
+
import type { IceServer } from '../services/config/types.js';
|
|
6
|
+
import type { BaseLogger } from './types.js';
|
|
7
|
+
export declare class CameraController extends CameraDevice {
|
|
8
|
+
private proxy;
|
|
9
|
+
private motionTimeout?;
|
|
10
|
+
private doorbellTimeout?;
|
|
11
|
+
private doorbellTimeoutDuration;
|
|
12
|
+
constructor(camera: Camera, logger: BaseLogger, proxy: ProxyServer);
|
|
13
|
+
connect(): Promise<void>;
|
|
14
|
+
disconnect(): Promise<void>;
|
|
15
|
+
reboot(): Promise<void>;
|
|
16
|
+
generateFrames(): AsyncIterableIterator<Frame>;
|
|
17
|
+
getFfmpegPath(): Promise<string>;
|
|
18
|
+
getIceServers(): Promise<IceServer[]>;
|
|
19
|
+
updateCamera(updatedCamera: Camera): void;
|
|
20
|
+
cleanup(): void;
|
|
21
|
+
private subscribeToCameraState;
|
|
22
|
+
private subscribeToMotionState;
|
|
23
|
+
private subscribeToDoorbellState;
|
|
24
|
+
private subscribeToCameraChanges;
|
|
25
|
+
private subscribeToStateChanges;
|
|
26
|
+
private triggerProxyEvent;
|
|
27
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReplaySubject, Subject } from 'rxjs';
|
|
2
|
-
import { Subscribed } from '../../utils/subscribed';
|
|
3
|
-
import type { IceServer } from '../../../services/config/types';
|
|
4
|
-
import type { BrowserCameraDevice as CameraDevice } from '../../base/cameraDeviceBrowser';
|
|
5
|
-
import type { BaseLogger, BasicBrowserPeerConnection } from '../../types';
|
|
2
|
+
import { Subscribed } from '../../utils/subscribed.js';
|
|
3
|
+
import type { IceServer } from '../../../services/config/types.js';
|
|
4
|
+
import type { BrowserCameraDevice as CameraDevice } from '../../base/cameraDeviceBrowser.js';
|
|
5
|
+
import type { BaseLogger, BasicBrowserPeerConnection } from '../../types.js';
|
|
6
6
|
export declare class BrowserPeerConnection extends Subscribed implements BasicBrowserPeerConnection {
|
|
7
7
|
onIceCandidate: Subject<RTCIceCandidate>;
|
|
8
8
|
onConnectionState: ReplaySubject<RTCPeerConnectionState>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Observable, ReplaySubject } from 'rxjs';
|
|
2
|
-
import { Subscribed } from '../../utils/subscribed';
|
|
3
|
-
import type { BrowserCameraDevice as CameraDevice } from '../../base/cameraDeviceBrowser';
|
|
4
|
-
import type { BaseLogger } from '../../types';
|
|
5
|
-
import type { WebrtcBrowserConnection } from './webrtc-browser-connection';
|
|
2
|
+
import { Subscribed } from '../../utils/subscribed.js';
|
|
3
|
+
import type { BrowserCameraDevice as CameraDevice } from '../../base/cameraDeviceBrowser.js';
|
|
4
|
+
import type { BaseLogger } from '../../types.js';
|
|
5
|
+
import type { WebrtcBrowserConnection } from './webrtc-browser-connection.js';
|
|
6
6
|
export declare class BrowserStreamingSession extends Subscribed {
|
|
7
7
|
readonly onCallAnswered: ReplaySubject<void>;
|
|
8
8
|
readonly onCallEnded: ReplaySubject<void>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReplaySubject, type Observable } from 'rxjs';
|
|
2
|
-
import { Subscribed } from '../../utils/subscribed';
|
|
3
|
-
import { BrowserPeerConnection } from './browser-peer-connection';
|
|
4
|
-
import type { IceServer } from '../../../services/config/types';
|
|
5
|
-
import type { BrowserCameraDevice as CameraDevice } from '../../base/cameraDeviceBrowser';
|
|
6
|
-
import type { BaseLogger } from '../../types';
|
|
2
|
+
import { Subscribed } from '../../utils/subscribed.js';
|
|
3
|
+
import { BrowserPeerConnection } from './browser-peer-connection.js';
|
|
4
|
+
import type { IceServer } from '../../../services/config/types.js';
|
|
5
|
+
import type { BrowserCameraDevice as CameraDevice } from '../../base/cameraDeviceBrowser.js';
|
|
6
|
+
import type { BaseLogger } from '../../types.js';
|
|
7
7
|
export declare class WebrtcBrowserConnection extends Subscribed {
|
|
8
8
|
readonly onCallAnswered: ReplaySubject<string>;
|
|
9
9
|
readonly onCallEnded: ReplaySubject<void>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Observable, ReplaySubject, Subject } from 'rxjs';
|
|
2
2
|
import { MediaStreamTrack, RTCSessionDescription, RTCIceCandidate as WeriftRTCICECandidate } from 'werift';
|
|
3
|
-
import { Subscribed } from '../utils/subscribed';
|
|
3
|
+
import { Subscribed } from '../utils/subscribed.js';
|
|
4
4
|
import type { ConnectionState, RTCIceCandidate, RtcpPacket, RtpPacket } from 'werift';
|
|
5
|
-
import type { IceServer } from '../../services/config/types';
|
|
6
|
-
import type { CameraDevice } from '../base/cameraDevice';
|
|
7
|
-
import type { BaseLogger } from '../types';
|
|
5
|
+
import type { IceServer } from '../../services/config/types.js';
|
|
6
|
+
import type { CameraDevice } from '../base/cameraDevice.js';
|
|
7
|
+
import type { BaseLogger } from '../types.js';
|
|
8
8
|
export interface BasicPeerConnection {
|
|
9
9
|
createOffer(): Promise<RTCSessionDescription>;
|
|
10
10
|
acceptAnswer(answer: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReplaySubject, Subject } from 'rxjs';
|
|
2
2
|
import { RtpPacket } from 'werift';
|
|
3
|
-
import { Subscribed } from '../utils/subscribed';
|
|
4
|
-
import type { CameraDevice } from '../base/cameraDevice';
|
|
5
|
-
import type { BaseLogger, FfmpegOptions, SpawnInput } from '../types';
|
|
6
|
-
import type { WebrtcConnection } from './webrtc-connection';
|
|
3
|
+
import { Subscribed } from '../utils/subscribed.js';
|
|
4
|
+
import type { CameraDevice } from '../base/cameraDevice.js';
|
|
5
|
+
import type { BaseLogger, FfmpegOptions, SpawnInput } from '../types.js';
|
|
6
|
+
import type { WebrtcConnection } from './webrtc-connection.js';
|
|
7
7
|
export declare class StreamingSession extends Subscribed {
|
|
8
8
|
readonly onCallEnded: ReplaySubject<void>;
|
|
9
9
|
readonly onVideoRtp: Subject<RtpPacket>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ReplaySubject, Subject, type Observable } from 'rxjs';
|
|
2
|
-
import { Subscribed } from '../utils/subscribed';
|
|
2
|
+
import { Subscribed } from '../utils/subscribed.js';
|
|
3
3
|
import type { RtpPacket } from 'werift';
|
|
4
|
-
import type { IceServer } from '../../services/config/types';
|
|
5
|
-
import type { CameraDevice } from '../base/cameraDevice';
|
|
6
|
-
import type { BaseLogger } from '../types';
|
|
7
|
-
import type { StreamingConnectionOptions } from './peer-connection';
|
|
4
|
+
import type { IceServer } from '../../services/config/types.js';
|
|
5
|
+
import type { CameraDevice } from '../base/cameraDevice.js';
|
|
6
|
+
import type { BaseLogger } from '../types.js';
|
|
7
|
+
import type { StreamingConnectionOptions } from './peer-connection.js';
|
|
8
8
|
export declare class WebrtcConnection extends Subscribed {
|
|
9
9
|
readonly onCameraConnected: ReplaySubject<void>;
|
|
10
10
|
readonly onCallAnswered: ReplaySubject<string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import type { Observable, Subject } from 'rxjs';
|
|
3
|
-
import type { CameraInformation, CameraInput, CameraInputSettings } from '../api/database/types';
|
|
3
|
+
import type { CameraInformation, CameraInput, CameraInputSettings } from '../api/database/types.js';
|
|
4
4
|
export type SpawnInput = string | number;
|
|
5
5
|
export type PrebufferType = 'recording' | 'stream';
|
|
6
6
|
export interface CameraSource extends CameraInput {
|
|
@@ -100,25 +100,31 @@ export type CameraConfig = (BaseCameraConfig & {
|
|
|
100
100
|
}) | (BaseCameraConfig & {
|
|
101
101
|
delegate?: CameraDelegate;
|
|
102
102
|
});
|
|
103
|
-
export interface
|
|
104
|
-
timestamp: number;
|
|
105
|
-
lastTriggered: number;
|
|
106
|
-
}
|
|
107
|
-
export interface Detections {
|
|
103
|
+
export interface BaseDetection {
|
|
108
104
|
id?: string;
|
|
109
|
-
|
|
105
|
+
}
|
|
106
|
+
export interface MotionDetection extends BaseDetection {
|
|
107
|
+
label: string;
|
|
108
|
+
boundingBox: [number, number, number, number];
|
|
109
|
+
}
|
|
110
|
+
export interface ObjectDetection extends BaseDetection {
|
|
111
|
+
lebel: string;
|
|
110
112
|
boundingBox: [number, number, number, number];
|
|
111
113
|
}
|
|
114
|
+
export interface BaseState<T> {
|
|
115
|
+
timestamp: number;
|
|
116
|
+
lastEvent?: T;
|
|
117
|
+
}
|
|
112
118
|
export interface MotionSetEvent {
|
|
113
119
|
state: boolean;
|
|
114
|
-
detections:
|
|
120
|
+
detections: MotionDetection[];
|
|
115
121
|
}
|
|
116
122
|
export interface AudioSetEvent {
|
|
117
123
|
state: boolean;
|
|
124
|
+
db?: number;
|
|
118
125
|
}
|
|
119
126
|
export interface ObjectSetEvent {
|
|
120
|
-
|
|
121
|
-
detections: Detections[];
|
|
127
|
+
detections: ObjectDetection[];
|
|
122
128
|
}
|
|
123
129
|
export interface LightSetEvent {
|
|
124
130
|
state: boolean;
|
|
@@ -128,19 +134,20 @@ export interface DoorbellSetEvent {
|
|
|
128
134
|
}
|
|
129
135
|
export interface SirenSetEvent {
|
|
130
136
|
state: boolean;
|
|
137
|
+
level?: number;
|
|
131
138
|
}
|
|
132
139
|
export interface BatterySetEvent {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
export type LightState = BaseState & LightSetEvent;
|
|
138
|
-
export type MotionState = BaseState & MotionSetEvent;
|
|
139
|
-
export type AudioState = BaseState & AudioSetEvent;
|
|
140
|
-
export type DoorbellState = BaseState & DoorbellSetEvent;
|
|
141
|
-
export type SirenState = BaseState & SirenSetEvent;
|
|
142
|
-
export type ObjectState = BaseState & ObjectSetEvent;
|
|
143
|
-
export type BatteryState = BaseState & BatterySetEvent;
|
|
140
|
+
level: number;
|
|
141
|
+
lowBattery?: boolean;
|
|
142
|
+
charging?: boolean;
|
|
143
|
+
}
|
|
144
|
+
export type LightState = BaseState<LightState> & LightSetEvent;
|
|
145
|
+
export type MotionState = BaseState<MotionState> & MotionSetEvent;
|
|
146
|
+
export type AudioState = BaseState<AudioState> & AudioSetEvent;
|
|
147
|
+
export type DoorbellState = BaseState<DoorbellState> & DoorbellSetEvent;
|
|
148
|
+
export type SirenState = BaseState<SirenState> & SirenSetEvent;
|
|
149
|
+
export type ObjectState = BaseState<ObjectState> & ObjectSetEvent;
|
|
150
|
+
export type BatteryState = BaseState<BatteryState> & BatterySetEvent;
|
|
144
151
|
export type State = LightState | MotionState | AudioState | ObjectState | DoorbellState | SirenState | BatteryState;
|
|
145
152
|
export interface StateValues {
|
|
146
153
|
light: LightState;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CameraController } from '../camera/controller.js';
|
|
2
|
+
import type { StreamManager } from './worker/index.js';
|
|
3
|
+
export declare class Decoder {
|
|
4
|
+
streamManagers: Map<string, StreamManager<any>>;
|
|
5
|
+
private api;
|
|
6
|
+
private proxyServer;
|
|
7
|
+
private startAsWorker;
|
|
8
|
+
constructor();
|
|
9
|
+
addCamera(camera: CameraController): Promise<StreamManager>;
|
|
10
|
+
removeCamera(camera: CameraController): Promise<void>;
|
|
11
|
+
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import type { ChildProcess } from 'child_process';
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
import type { ChildProcess } from 'node:child_process';
|
|
4
4
|
export interface FrameMetadata {
|
|
5
5
|
format: string;
|
|
6
6
|
frameSize: number;
|
|
7
7
|
width: number;
|
|
8
8
|
height: number;
|
|
9
9
|
}
|
|
10
|
+
export interface FrameSession {
|
|
11
|
+
token: string;
|
|
12
|
+
wsPort: number;
|
|
13
|
+
}
|
|
10
14
|
export interface Frame {
|
|
11
15
|
metadata: FrameMetadata;
|
|
12
16
|
data: Buffer;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
import { Subscribed } from '../../../../camera/utils/subscribed.js';
|
|
4
|
+
import type { ChildProcess } from 'node:child_process';
|
|
5
|
+
import type { Worker } from 'node:worker_threads';
|
|
6
|
+
import type { CameraController } from '../../../../camera/controller.js';
|
|
7
|
+
import type { ConfigService } from '../../../../services/config/index.js';
|
|
8
|
+
import type { Logger } from '../../../../services/logger/index.js';
|
|
9
|
+
import type { FrameMetadata, MainMessage, MainToWorkerMessage, MainToWorkerResponse, WorkerToMainMessage } from '../../../types.js';
|
|
10
|
+
export declare abstract class StreamManager<T extends Worker | ChildProcess = any> extends Subscribed {
|
|
11
|
+
token: string;
|
|
12
|
+
protected readonly logger: Logger;
|
|
13
|
+
protected readonly configService: ConfigService;
|
|
14
|
+
protected readonly camera: CameraController;
|
|
15
|
+
protected frameWorker?: T;
|
|
16
|
+
protected stopped: boolean;
|
|
17
|
+
protected auth: {
|
|
18
|
+
user: string;
|
|
19
|
+
pass: string;
|
|
20
|
+
};
|
|
21
|
+
constructor(camera: CameraController, auth: {
|
|
22
|
+
user: string;
|
|
23
|
+
pass: string;
|
|
24
|
+
});
|
|
25
|
+
abstract listen(): Promise<void>;
|
|
26
|
+
abstract close(): Promise<void>;
|
|
27
|
+
abstract workerPID(): number;
|
|
28
|
+
getMetadata(): Promise<FrameMetadata>;
|
|
29
|
+
startVideoSession(): Promise<void>;
|
|
30
|
+
stopVideoSession(): Promise<void>;
|
|
31
|
+
protected onMessage(workerMessage: WorkerToMainMessage): Promise<void>;
|
|
32
|
+
protected abstract sendMessage(message: MainMessage, skipResponse?: boolean, data?: Record<string, any>): Promise<any>;
|
|
33
|
+
protected abstract sendReponse(response: MainToWorkerResponse): void;
|
|
34
|
+
protected abstract send(message: MainToWorkerMessage | MainToWorkerResponse): void;
|
|
35
|
+
protected getLogPrefix(): string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { ChildProcess } from 'node:child_process';
|
|
3
|
+
import { StreamManager } from '../base/index.js';
|
|
4
|
+
import type { CameraController } from '../../../../camera/controller.js';
|
|
5
|
+
import type { MainMessage, MainToWorkerMessage, MainToWorkerResponse } from '../../../types.js';
|
|
6
|
+
export declare class StreamProcess extends StreamManager<ChildProcess> {
|
|
7
|
+
constructor(camera: CameraController, auth: {
|
|
8
|
+
user: string;
|
|
9
|
+
pass: string;
|
|
10
|
+
});
|
|
11
|
+
listen(): Promise<void>;
|
|
12
|
+
close(): Promise<void>;
|
|
13
|
+
workerPID(): number;
|
|
14
|
+
protected sendMessage(message: MainMessage, skipResponse?: boolean, data?: Record<string, any>): Promise<any>;
|
|
15
|
+
protected sendReponse(response: MainToWorkerResponse): void;
|
|
16
|
+
protected send(message: MainToWorkerMessage | MainToWorkerResponse): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { Worker } from 'node:worker_threads';
|
|
3
|
+
import { StreamManager } from '../base/index.js';
|
|
4
|
+
import type { CameraController } from '../../../../camera/controller.js';
|
|
5
|
+
import type { MainMessage, MainToWorkerMessage, MainToWorkerResponse } from '../../../types.js';
|
|
6
|
+
export declare class StreamWorker extends StreamManager<Worker> {
|
|
7
|
+
private channel1;
|
|
8
|
+
private channel2;
|
|
9
|
+
private messageFromMain;
|
|
10
|
+
private messageToMain;
|
|
11
|
+
private responseToMain;
|
|
12
|
+
constructor(camera: CameraController, auth: {
|
|
13
|
+
user: string;
|
|
14
|
+
pass: string;
|
|
15
|
+
});
|
|
16
|
+
listen(): Promise<void>;
|
|
17
|
+
close(): Promise<void>;
|
|
18
|
+
workerPID(): number;
|
|
19
|
+
protected sendMessage(message: MainMessage, skipResponse?: boolean, data?: Record<string, any>): Promise<any>;
|
|
20
|
+
protected sendReponse(response: MainToWorkerResponse): void;
|
|
21
|
+
protected send(message: MainToWorkerMessage | MainToWorkerResponse): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RUNTIME_STATUS } from '../services/config/types.js';
|
|
2
|
+
export declare class Go2Rtc {
|
|
3
|
+
private go2rtcProcess?;
|
|
4
|
+
private api;
|
|
5
|
+
private logger;
|
|
6
|
+
private configService;
|
|
7
|
+
version?: string;
|
|
8
|
+
os?: string;
|
|
9
|
+
private started;
|
|
10
|
+
private restarting;
|
|
11
|
+
private manuallyKilled;
|
|
12
|
+
private shuttingDown;
|
|
13
|
+
private _status;
|
|
14
|
+
get status(): RUNTIME_STATUS;
|
|
15
|
+
constructor();
|
|
16
|
+
start(): Promise<void>;
|
|
17
|
+
stop(): Promise<void>;
|
|
18
|
+
restart(): Promise<void>;
|
|
19
|
+
getPID(): number;
|
|
20
|
+
private kill;
|
|
21
|
+
private handleClose;
|
|
22
|
+
private setStatus;
|
|
23
|
+
private processLogger;
|
|
24
|
+
private isIgnorableString;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const NATS_SERVER_SUBJECT = "camera.ui-server";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { NatsConnection, Subscription } from 'nats';
|
|
2
|
+
import { CameraDeviceProxy } from './proxy/cameraDevice.js';
|
|
3
|
+
import { DeviceManagerProxy, PluginsManagerProxy, SystemManagerProxy } from './proxy/index.js';
|
|
4
|
+
import { NatsServer } from './server.js';
|
|
5
|
+
import type { StateValues } from '../camera/types.js';
|
|
6
|
+
import type { CameraDeviceListenerMessagePayload, DeviceManagerProxyEvents, PluginsManagerProxyEvents, ProxyAuth, SystemManagerProxyEvents } from './types.js';
|
|
7
|
+
import type { WebsocketProxy } from './websocket.js';
|
|
8
|
+
export declare class ProxyServer {
|
|
9
|
+
private api;
|
|
10
|
+
private logger;
|
|
11
|
+
deviceManagerProxy?: DeviceManagerProxy;
|
|
12
|
+
pluginsManagerProxy?: PluginsManagerProxy;
|
|
13
|
+
systemManagerProxy?: SystemManagerProxy;
|
|
14
|
+
cameraDeviceProxy?: CameraDeviceProxy;
|
|
15
|
+
websocketProxy?: WebsocketProxy;
|
|
16
|
+
server: NatsServer;
|
|
17
|
+
publisher?: NatsConnection;
|
|
18
|
+
subscriber?: Subscription;
|
|
19
|
+
private messageQueue;
|
|
20
|
+
private initialized;
|
|
21
|
+
auth: ProxyAuth;
|
|
22
|
+
constructor();
|
|
23
|
+
initialize(): Promise<void>;
|
|
24
|
+
close(): Promise<void>;
|
|
25
|
+
publishDeviceManagerEvent<K extends keyof DeviceManagerProxyEvents>(targetId: string, type: K, data: DeviceManagerProxyEvents[K]): void;
|
|
26
|
+
publishSystemManagerEvent<K extends keyof SystemManagerProxyEvents>(targetId: string, type: K, data: SystemManagerProxyEvents[K]): void;
|
|
27
|
+
publishPluginsManagerEvent<K extends keyof PluginsManagerProxyEvents>(targetId: string, type: K, data: PluginsManagerProxyEvents[K]): void;
|
|
28
|
+
publishCameraEvent<K extends keyof StateValues>(cameraId: string, stateName: K, data: {
|
|
29
|
+
newEvent: StateValues[K];
|
|
30
|
+
oldEvent: StateValues[K];
|
|
31
|
+
}, targetId?: string): void;
|
|
32
|
+
publishCameraEvent(cameraId: string, type: CameraDeviceListenerMessagePayload['type'], data?: any, targetId?: string): void;
|
|
33
|
+
private isCameraState;
|
|
34
|
+
}
|