@camera.ui/browser 0.0.35 → 0.0.36
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/client/node/src/proxy/cameraDevice/cameraDevice.browser.d.ts +13 -11
- package/dist/client/node/src/proxy/cameraDevice/cameraDevice.node.d.ts +12 -7
- package/dist/src/api/database/types.d.ts +7 -25
- package/dist/src/api/schemas/cameras.schema.d.ts +112 -6
- package/dist/src/api/schemas/config.schema.d.ts +9 -9
- package/dist/src/api/services/cameras.service.d.ts +1 -2
- package/dist/src/api/ws/nsp/status.d.ts +10 -2
- package/dist/src/api/ws/nsp/streams.d.ts +0 -15
- package/dist/src/api/ws/types.d.ts +14 -0
- package/dist/src/api.d.ts +3 -2
- package/dist/src/camera/index.d.ts +18 -16
- package/dist/src/camera/streaming/peer-connection.d.ts +5 -7
- package/dist/src/camera/streaming/streaming-session.d.ts +3 -3
- package/dist/src/camera/streaming/webrtc-connection.d.ts +4 -4
- package/dist/src/camera/types.d.ts +50 -12
- package/dist/src/go2rtc/index.d.ts +1 -0
- package/dist/src/plugins/cameraStorage.d.ts +1 -0
- package/dist/src/plugins/schema.d.ts +3 -3
- package/dist/src/plugins/types.d.ts +8 -8
- package/dist/src/proxy/client/cameraDevice.d.ts +15 -10
- package/dist/src/proxy/client/deviceManager.d.ts +1 -1
- package/dist/src/proxy/client/pluginsManager.d.ts +1 -1
- package/dist/src/proxy/client/queue.d.ts +2 -0
- package/dist/src/proxy/client/systemManager.d.ts +1 -1
- package/dist/src/proxy/index.d.ts +2 -2
- package/dist/src/proxy/proxies/camera.d.ts +42 -34
- package/dist/src/proxy/queue.d.ts +2 -0
- package/dist/src/proxy/types.d.ts +30 -26
- package/dist/src/services/config/types.d.ts +1 -1
- package/dist/src/services/logger/index.d.ts +5 -4
- package/package.json +4 -4
- /package/dist/src/camera/{subscribed.d.ts → utils/subscribed.d.ts} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RtpPacket } from 'werift';
|
|
2
2
|
import { ReplaySubject, Subject } from 'rxjs';
|
|
3
|
-
import { Subscribed } from '../subscribed';
|
|
3
|
+
import { Subscribed } from '../utils/subscribed';
|
|
4
4
|
import type { WebrtcConnection } from './webrtc-connection';
|
|
5
|
-
import type { FfmpegOptions, SpawnInput, CameraDevice } from '../types';
|
|
5
|
+
import type { FfmpegOptions, SpawnInput, BaseLogger, CameraDevice } from '../types';
|
|
6
6
|
export declare class StreamingSession extends Subscribed {
|
|
7
7
|
readonly onCallEnded: ReplaySubject<void>;
|
|
8
8
|
readonly onVideoRtp: Subject<RtpPacket>;
|
|
@@ -16,7 +16,7 @@ export declare class StreamingSession extends Subscribed {
|
|
|
16
16
|
private connection;
|
|
17
17
|
private logger;
|
|
18
18
|
get isUsingOpus(): Promise<boolean>;
|
|
19
|
-
constructor(cameraDevice: CameraDevice, connection: WebrtcConnection);
|
|
19
|
+
constructor(cameraDevice: CameraDevice, logger: BaseLogger, connection: WebrtcConnection);
|
|
20
20
|
reservePort(bufferPorts?: number): Promise<number>;
|
|
21
21
|
startTranscoding(ffmpegOptions: FfmpegOptions): Promise<void>;
|
|
22
22
|
transcodeReturnAudio(ffmpegOptions: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReplaySubject, Subject, type Observable } from 'rxjs';
|
|
2
|
-
import { Subscribed } from '../subscribed';
|
|
2
|
+
import { Subscribed } from '../utils/subscribed';
|
|
3
3
|
import type { RtpPacket } from 'werift';
|
|
4
|
-
import type { StreamingConnectionOptions, CameraDevice } from '../types';
|
|
4
|
+
import type { StreamingConnectionOptions, BaseLogger, CameraDevice } from '../types';
|
|
5
5
|
import type { IceServer } from '../../services/config/types';
|
|
6
6
|
export declare class WebrtcConnection extends Subscribed {
|
|
7
7
|
readonly onCameraConnected: ReplaySubject<void>;
|
|
@@ -18,9 +18,9 @@ export declare class WebrtcConnection extends Subscribed {
|
|
|
18
18
|
private readonly ws;
|
|
19
19
|
private readonly onOfferSent;
|
|
20
20
|
private hasEnded;
|
|
21
|
-
private logger;
|
|
22
21
|
private cameraDevice;
|
|
23
|
-
|
|
22
|
+
private logger;
|
|
23
|
+
constructor(cameraDevice: CameraDevice, sourceName: string, iceServers: IceServer[], logger: BaseLogger, options: StreamingConnectionOptions);
|
|
24
24
|
sendAudioPacket(rtp: RtpPacket): void;
|
|
25
25
|
stop(): void;
|
|
26
26
|
requestKeyFrame(): void;
|
|
@@ -2,15 +2,21 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import type { Observable, Subject } from 'rxjs';
|
|
4
4
|
import type { ConnectionState, RTCIceCandidate } from 'werift';
|
|
5
|
-
import type { Camera, CameraPublicProperties, CameraInputSettings, CameraZone,
|
|
5
|
+
import type { Camera, CameraPublicProperties, CameraInputSettings, CameraZone, CameraInput, CameraType, CameraInformation } from '../api/database/types';
|
|
6
6
|
import type { StreamingSession } from './streaming/streaming-session';
|
|
7
7
|
export type SpawnInput = string | number;
|
|
8
8
|
export type PrebufferType = 'recording' | 'stream';
|
|
9
|
+
export interface CameraSource extends CameraInput {
|
|
10
|
+
isPrebuffering(type: PrebufferType): Promise<boolean>;
|
|
11
|
+
getPrebufferRawUrl(type: PrebufferType): Promise<string | undefined>;
|
|
12
|
+
getStreamInfo(): Promise<StreamInfo | undefined>;
|
|
13
|
+
}
|
|
9
14
|
export interface BaseLogger {
|
|
10
15
|
log: (...args: any[]) => void;
|
|
11
16
|
error: (...args: any[]) => void;
|
|
12
17
|
warn: (...args: any[]) => void;
|
|
13
18
|
debug: (...args: any[]) => void;
|
|
19
|
+
trace: (...args: any[]) => void;
|
|
14
20
|
}
|
|
15
21
|
export interface FfmpegOptions {
|
|
16
22
|
input?: SpawnInput[];
|
|
@@ -41,36 +47,37 @@ export interface CameraDevice {
|
|
|
41
47
|
nativeId?: string;
|
|
42
48
|
disabled: boolean;
|
|
43
49
|
name: string;
|
|
44
|
-
type:
|
|
45
|
-
|
|
50
|
+
type: CameraType;
|
|
51
|
+
info: CameraInformation;
|
|
46
52
|
sources: CameraSource[];
|
|
47
53
|
motionZones: CameraZone[];
|
|
48
54
|
objectZones: CameraZone[];
|
|
49
|
-
logger: BaseLogger;
|
|
50
55
|
isCloud: boolean;
|
|
51
56
|
hasLight: boolean;
|
|
52
57
|
hasSiren: boolean;
|
|
58
|
+
hasBinarySensor: boolean;
|
|
59
|
+
hasBattery: boolean;
|
|
53
60
|
hasMotionDetector: boolean;
|
|
54
61
|
hasAudioDetector: boolean;
|
|
55
62
|
hasObjectDetector: boolean;
|
|
56
63
|
hasPtz: boolean;
|
|
57
|
-
|
|
64
|
+
onLightSwitched: Observable<LightState>;
|
|
58
65
|
onMotionDetected: Observable<MotionState>;
|
|
59
66
|
onAudioDetected: Observable<AudioState>;
|
|
60
67
|
onObjectDetected: Observable<ObjectState>;
|
|
61
68
|
onDoorbellPressed: Observable<DoorbellState>;
|
|
62
69
|
onSirenDetected: Observable<SirenState>;
|
|
70
|
+
onBatteryChanged: Observable<BatteryState>;
|
|
71
|
+
reboot(): Promise<void>;
|
|
63
72
|
getStreamSource(): CameraSource;
|
|
64
73
|
getSnapshotSource(): CameraSource;
|
|
65
74
|
getRecordingSource(): CameraSource;
|
|
66
75
|
getDetectionSource(): CameraSource;
|
|
67
76
|
configureDelegate(delegate: CameraDelegate): void;
|
|
68
|
-
|
|
69
|
-
setPrebufferSource(sourceName: string, address: string, type: 'recording' | 'stream'): Promise<void>;
|
|
70
|
-
removePrebufferSource(sourceName: string, type: 'recording' | 'stream'): Promise<void>;
|
|
71
|
-
removePrebufferSources(): Promise<void>;
|
|
77
|
+
configurePrebufferDelegate(delegate: CameraPrebufferDelegate): void;
|
|
72
78
|
getFfmpegPath(): Promise<string>;
|
|
73
79
|
getIceServers(): Promise<RTCIceServer[]>;
|
|
80
|
+
snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
|
|
74
81
|
createSession(sourceName: string, options?: StreamingConnectionOptions): Promise<StreamingSession>;
|
|
75
82
|
streamVideo(sourceName: string, options: FfmpegOptions): Promise<StreamingSession>;
|
|
76
83
|
recordToFile(sourceName: string, outputPath: string, duration?: number): Promise<void>;
|
|
@@ -91,6 +98,30 @@ export interface CameraDelegate {
|
|
|
91
98
|
prepareStream(requestId: string): Promise<void>;
|
|
92
99
|
onOffer(requestId: string, sdp: string): Promise<string>;
|
|
93
100
|
onCandidates(requestId: string, candidates: string): Promise<void>;
|
|
101
|
+
reboot(): Promise<void>;
|
|
102
|
+
}
|
|
103
|
+
export interface CameraPrebufferDelegate {
|
|
104
|
+
isPrebuffering(sourceName: string, type: PrebufferType): Promise<boolean>;
|
|
105
|
+
getPrebufferRawUrl(sourceName: string, type: PrebufferType): Promise<string | undefined>;
|
|
106
|
+
getStreamInfo(sourceName: string): Promise<StreamInfo | undefined>;
|
|
107
|
+
}
|
|
108
|
+
export interface AudioStreamOptions {
|
|
109
|
+
enabled?: boolean;
|
|
110
|
+
codec?: string;
|
|
111
|
+
bitrate?: number;
|
|
112
|
+
sampleRate?: number;
|
|
113
|
+
}
|
|
114
|
+
export interface VideoStreamOptions {
|
|
115
|
+
codec?: string;
|
|
116
|
+
width?: number;
|
|
117
|
+
height?: number;
|
|
118
|
+
bitrate?: number;
|
|
119
|
+
fps?: number;
|
|
120
|
+
idrInterval?: number;
|
|
121
|
+
}
|
|
122
|
+
export interface StreamInfo {
|
|
123
|
+
audio: AudioStreamOptions;
|
|
124
|
+
video: VideoStreamOptions;
|
|
94
125
|
}
|
|
95
126
|
export type Sdp = string;
|
|
96
127
|
export type IceCandiate = string;
|
|
@@ -118,8 +149,10 @@ export interface BaseCameraConfig {
|
|
|
118
149
|
isCloud?: boolean;
|
|
119
150
|
hasLight?: boolean;
|
|
120
151
|
hasSiren?: boolean;
|
|
152
|
+
hasBinarySensor?: boolean;
|
|
153
|
+
hasBattery?: boolean;
|
|
121
154
|
disabled?: boolean;
|
|
122
|
-
|
|
155
|
+
info?: Partial<CameraInformation>;
|
|
123
156
|
}
|
|
124
157
|
export type CameraConfig = (BaseCameraConfig & {
|
|
125
158
|
sources?: Omit<CameraInputSettings, '_id'>[];
|
|
@@ -149,6 +182,9 @@ export interface DoorbellSetEvent {
|
|
|
149
182
|
export interface SirenSetEvent {
|
|
150
183
|
state: boolean;
|
|
151
184
|
}
|
|
185
|
+
export interface BatterySetEvent {
|
|
186
|
+
state: number;
|
|
187
|
+
}
|
|
152
188
|
export interface DeviceSetEvent {
|
|
153
189
|
}
|
|
154
190
|
export type LightState = BaseState & LightSetEvent;
|
|
@@ -157,7 +193,8 @@ export type AudioState = BaseState & AudioSetEvent;
|
|
|
157
193
|
export type DoorbellState = BaseState & DoorbellSetEvent;
|
|
158
194
|
export type SirenState = BaseState & SirenSetEvent;
|
|
159
195
|
export type ObjectState = BaseState & ObjectSetEvent;
|
|
160
|
-
export type
|
|
196
|
+
export type BatteryState = BaseState & BatterySetEvent;
|
|
197
|
+
export type State = LightState | MotionState | AudioState | ObjectState | DoorbellState | SirenState | BatteryState;
|
|
161
198
|
export interface StateValues {
|
|
162
199
|
light: LightState;
|
|
163
200
|
motion: MotionState;
|
|
@@ -165,10 +202,11 @@ export interface StateValues {
|
|
|
165
202
|
object: ObjectState;
|
|
166
203
|
doorbell: DoorbellState;
|
|
167
204
|
siren: SirenState;
|
|
205
|
+
battery: BatteryState;
|
|
168
206
|
}
|
|
169
207
|
export type CameraStateCallbacks = {
|
|
170
208
|
[K in keyof StateValues]: (event: StateValues[K]) => void;
|
|
171
209
|
};
|
|
172
210
|
export type StateValue<T extends keyof StateValues> = StateValues[T];
|
|
173
|
-
export type OnSetEvent<T extends keyof StateValues> = T extends 'light' ? LightSetEvent : T extends 'motion' ? MotionSetEvent : T extends 'audio' ? AudioSetEvent : T extends 'doorbell' ? DoorbellSetEvent : T extends 'siren' ? SirenSetEvent : ObjectSetEvent;
|
|
211
|
+
export type OnSetEvent<T extends keyof StateValues> = T extends 'light' ? LightSetEvent : T extends 'motion' ? MotionSetEvent : T extends 'audio' ? AudioSetEvent : T extends 'doorbell' ? DoorbellSetEvent : T extends 'siren' ? SirenSetEvent : T extends 'battery' ? BatterySetEvent : ObjectSetEvent;
|
|
174
212
|
export type OnChangeCallback<T extends keyof StateValues> = (newEvent: StateValues[T], oldEvent: StateValues[T]) => void;
|
|
@@ -7,6 +7,7 @@ export declare class CameraStorage implements CameraStorageMethods {
|
|
|
7
7
|
private db;
|
|
8
8
|
private _schema;
|
|
9
9
|
private _values;
|
|
10
|
+
get values(): Record<string, any>;
|
|
10
11
|
constructor(api: API, instance: any, cameraId: string, schema?: PluginJsonSchemaForm);
|
|
11
12
|
/**
|
|
12
13
|
* Initialize the storage.
|
|
@@ -18,8 +18,8 @@ type OptionalZodZobject = z.ZodOptional<z.ZodObject<Record<string, z.ZodTypeAny>
|
|
|
18
18
|
[x: string]: any;
|
|
19
19
|
}> | z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>> | z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
20
20
|
type OptionalZodArray = z.ZodOptional<z.ZodType<any, any, any>> | z.ZodType<any, any, any>;
|
|
21
|
-
type OptionalZodEnum = z.ZodOptional<z.ZodUnion<[z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]]>> | z.ZodUnion<[z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]]>;
|
|
22
|
-
type OptionalZodEnumMultiple = z.ZodOptional<z.ZodArray<z.ZodUnion<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>, 'many'>> | z.ZodArray<z.ZodUnion<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>, 'many'>;
|
|
21
|
+
type OptionalZodEnum = z.ZodOptional<z.ZodUnion<[z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]]>> | z.ZodUnion<[z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]]> | z.ZodEffects<z.ZodAny, any, any> | z.ZodUnion<any>;
|
|
22
|
+
type OptionalZodEnumMultiple = z.ZodOptional<z.ZodArray<z.ZodUnion<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>, 'many'>> | z.ZodArray<z.ZodUnion<[ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>, 'many'> | z.ZodEffects<z.ZodAny, any, any> | z.ZodUnion<any>;
|
|
23
23
|
type ZodAny = z.ZodType<any, any, any>;
|
|
24
24
|
/**
|
|
25
25
|
* Generate root JSON schema from value.
|
|
@@ -137,7 +137,7 @@ export declare const generateStringSchema: (value: string) => JsonSchemaString;
|
|
|
137
137
|
* @param type - The type of the enum.
|
|
138
138
|
* @returns - The generated JSON schema for the enum.
|
|
139
139
|
*/
|
|
140
|
-
export declare const generateEnumSchema: (value:
|
|
140
|
+
export declare const generateEnumSchema: (value: string[]) => JsonSchemaEnum;
|
|
141
141
|
/**
|
|
142
142
|
* Generates a JSON schema for an object.
|
|
143
143
|
*
|
|
@@ -27,7 +27,7 @@ export interface JSONObject {
|
|
|
27
27
|
export type JSONArray = JSONValue[];
|
|
28
28
|
export type PluginConfig = Record<string, any>;
|
|
29
29
|
export declare const CAMERA_EXTENSIONS: CameraExtension[];
|
|
30
|
-
export type CameraExtension = 'hub' | 'prebuffer' | 'motionDetection' | 'objectDetection' | 'audioDetection' | 'ptz';
|
|
30
|
+
export type CameraExtension = 'hub' | 'prebuffer' | 'motionDetection' | 'objectDetection' | 'audioDetection' | 'ptz' | 'intercom';
|
|
31
31
|
type ExtensionOrSupport = {
|
|
32
32
|
extension: CameraExtension;
|
|
33
33
|
supportAdditionalCameras?: never;
|
|
@@ -80,7 +80,7 @@ export interface ProcessResponse {
|
|
|
80
80
|
}
|
|
81
81
|
export type JsonSchemaType = 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
82
82
|
export interface JsonBaseSchema<T = any> {
|
|
83
|
-
type:
|
|
83
|
+
type: JsonSchemaType;
|
|
84
84
|
key?: string;
|
|
85
85
|
title?: string;
|
|
86
86
|
description?: string;
|
|
@@ -124,14 +124,14 @@ export interface JsonSchemaBoolean extends JsonBaseSchema<boolean> {
|
|
|
124
124
|
export interface PluginJsonSchemaBoolean extends PluginJsonBaseSchema<boolean> {
|
|
125
125
|
type: 'boolean';
|
|
126
126
|
}
|
|
127
|
-
export interface JsonSchemaEnum extends JsonBaseSchema<string
|
|
128
|
-
type: 'string'
|
|
129
|
-
enum:
|
|
127
|
+
export interface JsonSchemaEnum extends JsonBaseSchema<string> {
|
|
128
|
+
type: 'string';
|
|
129
|
+
enum: string[];
|
|
130
130
|
multiple?: boolean;
|
|
131
131
|
}
|
|
132
|
-
export interface PluginJsonSchemaEnum extends PluginJsonBaseSchema<string
|
|
133
|
-
type: 'string'
|
|
134
|
-
enum:
|
|
132
|
+
export interface PluginJsonSchemaEnum extends PluginJsonBaseSchema<string> {
|
|
133
|
+
type: 'string';
|
|
134
|
+
enum: string[];
|
|
135
135
|
multiple?: boolean;
|
|
136
136
|
}
|
|
137
137
|
export interface JsonSchemaObject extends JsonBaseSchema {
|
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CameraController } from '../../camera';
|
|
2
|
+
import { StreamingSession } from '../../camera/streaming/streaming-session';
|
|
2
3
|
import type { Camera } from '../../api/database/types';
|
|
3
|
-
import type { StateValues, OnSetEvent,
|
|
4
|
+
import type { StateValues, OnSetEvent, StreamingConnectionOptions, FfmpegOptions, CameraSource } from '../../camera/types';
|
|
4
5
|
import type { IceServer } from '../../services/config/types';
|
|
5
|
-
export declare class CameraDeviceClientProxy extends
|
|
6
|
-
private removed;
|
|
6
|
+
export declare class CameraDeviceClientProxy extends CameraController {
|
|
7
7
|
private api;
|
|
8
|
+
private logger;
|
|
8
9
|
private dealer;
|
|
9
10
|
private subscriber;
|
|
10
11
|
private messageQueue;
|
|
11
12
|
private dealerId;
|
|
12
|
-
private
|
|
13
|
+
private subscriberIds;
|
|
13
14
|
private pluginID;
|
|
14
|
-
private
|
|
15
|
+
private routerAddress;
|
|
16
|
+
private publisherAddress;
|
|
17
|
+
get sources(): CameraSource[];
|
|
15
18
|
constructor(camera: Camera, pluginId: string, pluginName: string, routerAddress: string, publisherAddress: string, serverPublicKey: string);
|
|
16
|
-
|
|
17
|
-
setPrebufferSource(sourceName: string, address: string | null, type: PrebufferType): Promise<void>;
|
|
18
|
-
removePrebufferSource(sourceName: string, type: 'recording' | 'stream'): Promise<void>;
|
|
19
|
-
removePrebufferSources(): Promise<void>;
|
|
19
|
+
reboot(): Promise<void>;
|
|
20
20
|
getFfmpegPath(): Promise<string>;
|
|
21
21
|
getIceServers(): Promise<IceServer[]>;
|
|
22
|
+
snapshot(forceNew?: boolean): Promise<ArrayBuffer>;
|
|
23
|
+
createSession(sourceName: string, options?: StreamingConnectionOptions): Promise<StreamingSession>;
|
|
24
|
+
streamVideo(sourceName: string, options: FfmpegOptions): Promise<StreamingSession>;
|
|
25
|
+
recordToFile(sourceName: string, outputPath: string, duration?: number): Promise<void>;
|
|
22
26
|
updateState<T extends keyof StateValues>(stateName: T, eventData: OnSetEvent<T>): Promise<void>;
|
|
23
27
|
refreshStates(): Promise<void>;
|
|
28
|
+
close(): void;
|
|
24
29
|
private handleRouterRequest;
|
|
25
30
|
private listenToSubscriberEvents;
|
|
26
31
|
private onRequest;
|
|
@@ -13,7 +13,7 @@ export declare class DeviceManager implements DeviceManagerProxyMethods, DeviceM
|
|
|
13
13
|
private pluginId;
|
|
14
14
|
private pluginName;
|
|
15
15
|
private dealerId;
|
|
16
|
-
private
|
|
16
|
+
private subscriberIds;
|
|
17
17
|
private MAX_LISTENERS_PER_EVENT;
|
|
18
18
|
private devices;
|
|
19
19
|
private eventListeners;
|
|
@@ -9,7 +9,7 @@ export declare class PluginsManager implements PluginsManagerProxyMethods, Plugi
|
|
|
9
9
|
private pluginId;
|
|
10
10
|
private pluginName;
|
|
11
11
|
private dealerId;
|
|
12
|
-
private
|
|
12
|
+
private subscriberIds;
|
|
13
13
|
private MAX_LISTENERS_PER_EVENT;
|
|
14
14
|
private eventListeners;
|
|
15
15
|
constructor(pluginId: string, pluginName: string, routerAddress: string, publisherAddress: string, serverPublicKey: string);
|
|
@@ -4,10 +4,12 @@ export declare class ClientMessageQueue {
|
|
|
4
4
|
private logger;
|
|
5
5
|
private dealer;
|
|
6
6
|
private requestHandler;
|
|
7
|
+
private aborted;
|
|
7
8
|
private isProcessing;
|
|
8
9
|
private queue;
|
|
9
10
|
private pendingResponses;
|
|
10
11
|
constructor(requestHandler: (message: ProxyMessageStructure) => void, dealer: Dealer);
|
|
12
|
+
abortQueue(): void;
|
|
11
13
|
enqueue(message: ProxyMessageStructure): Promise<any>;
|
|
12
14
|
private processQueue;
|
|
13
15
|
private listenToRouter;
|
|
@@ -8,7 +8,7 @@ export declare class SystemManager implements SystemManagerProxyMethods, SystemM
|
|
|
8
8
|
private pluginId;
|
|
9
9
|
private pluginName;
|
|
10
10
|
private dealerId;
|
|
11
|
-
private
|
|
11
|
+
private subscriberIds;
|
|
12
12
|
private MAX_LISTENERS_PER_EVENT;
|
|
13
13
|
private eventListeners;
|
|
14
14
|
constructor(pluginId: string, pluginName: string, routerAddress: string, publisherAddress: string, serverPublicKey: string);
|
|
@@ -23,7 +23,7 @@ export declare class ProxyServer {
|
|
|
23
23
|
publishCameraEvent<K extends keyof StateValues>(cameraId: string, stateName: K, data: {
|
|
24
24
|
newEvent: StateValues[K];
|
|
25
25
|
oldEvent: StateValues[K];
|
|
26
|
-
}): Promise<void>;
|
|
27
|
-
publishCameraEvent(cameraId: string, type: CameraDeviceListenerMessagePayload['type'], data?: any): Promise<void>;
|
|
26
|
+
}, targetId?: string): Promise<void>;
|
|
27
|
+
publishCameraEvent(cameraId: string, type: CameraDeviceListenerMessagePayload['type'], data?: any, targetId?: string): Promise<void>;
|
|
28
28
|
private isCameraState;
|
|
29
29
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/// <reference types="pouchdb-core" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import type { OnSetEvent, StateValues } from '../../camera/types';
|
|
3
|
+
import type { OnSetEvent, StateValues, StreamInfo } from '../../camera/types';
|
|
4
4
|
import type { IceServer } from '../../services/config/types';
|
|
5
|
-
import type { FfmpegOptions,
|
|
5
|
+
import type { FfmpegOptions, CameraDelegate, CameraPrebufferDelegate, PrebufferType } from '../../camera/types';
|
|
6
6
|
import type { CameraDeviceProxyMethods, ProxyMessageStructure } from '../types';
|
|
7
7
|
import type { MessageQueue } from '../queue';
|
|
8
|
-
import type { CameraDeviceHub } from '../../camera';
|
|
9
8
|
import type { Camera } from '../../api/database/types';
|
|
10
9
|
export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
|
|
11
10
|
private api;
|
|
@@ -14,32 +13,31 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
|
|
|
14
13
|
private pluginsService;
|
|
15
14
|
private messageQueue;
|
|
16
15
|
constructor(messageQueue: MessageQueue);
|
|
17
|
-
|
|
18
|
-
prebuffer?: boolean;
|
|
16
|
+
reboot(data: {
|
|
19
17
|
cameraId: string;
|
|
20
18
|
pluginId: string;
|
|
21
|
-
ws?: boolean;
|
|
22
|
-
}): Promise<
|
|
23
|
-
|
|
19
|
+
ws?: boolean | undefined;
|
|
20
|
+
}): Promise<void>;
|
|
21
|
+
getStreamInfo(data: {
|
|
24
22
|
sourceName: string;
|
|
25
|
-
address: string;
|
|
26
|
-
type: PrebufferType;
|
|
27
23
|
cameraId: string;
|
|
28
24
|
pluginId: string;
|
|
29
|
-
ws?: boolean;
|
|
30
|
-
}): Promise<
|
|
31
|
-
|
|
25
|
+
ws?: boolean | undefined;
|
|
26
|
+
}): Promise<StreamInfo | undefined>;
|
|
27
|
+
isPrebuffering(data: {
|
|
32
28
|
sourceName: string;
|
|
33
29
|
type: PrebufferType;
|
|
34
30
|
cameraId: string;
|
|
35
31
|
pluginId: string;
|
|
36
|
-
ws?: boolean;
|
|
37
|
-
}): Promise<
|
|
38
|
-
|
|
32
|
+
ws?: boolean | undefined;
|
|
33
|
+
}): Promise<boolean>;
|
|
34
|
+
getPrebufferRawUrl(data: {
|
|
35
|
+
sourceName: string;
|
|
36
|
+
type: PrebufferType;
|
|
39
37
|
cameraId: string;
|
|
40
38
|
pluginId: string;
|
|
41
|
-
ws?: boolean;
|
|
42
|
-
}): Promise<
|
|
39
|
+
ws?: boolean | undefined;
|
|
40
|
+
}): Promise<string | undefined>;
|
|
43
41
|
getFffmpegPath(data: {
|
|
44
42
|
cameraId: string;
|
|
45
43
|
pluginId: string;
|
|
@@ -50,21 +48,12 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
|
|
|
50
48
|
pluginId: string;
|
|
51
49
|
ws?: boolean;
|
|
52
50
|
}): IceServer[];
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
eventData: OnSetEvent<T>;
|
|
56
|
-
cameraId: string;
|
|
57
|
-
pluginId: string;
|
|
58
|
-
ws?: boolean;
|
|
59
|
-
}): Promise<void>;
|
|
60
|
-
refreshStates(data: {
|
|
51
|
+
snapshot(data: {
|
|
52
|
+
forceNew?: boolean;
|
|
61
53
|
cameraId: string;
|
|
62
54
|
pluginId: string;
|
|
63
55
|
ws?: boolean;
|
|
64
|
-
}): Promise<
|
|
65
|
-
camera: Camera;
|
|
66
|
-
states: StateValues;
|
|
67
|
-
}>;
|
|
56
|
+
}): Promise<ArrayBuffer>;
|
|
68
57
|
streamVideo(data: {
|
|
69
58
|
sourceName: string;
|
|
70
59
|
options: FfmpegOptions;
|
|
@@ -80,9 +69,28 @@ export declare class CameraDeviceProxy implements CameraDeviceProxyMethods {
|
|
|
80
69
|
pluginId: string;
|
|
81
70
|
ws?: boolean;
|
|
82
71
|
}): Promise<void>;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
72
|
+
updateState<T extends keyof StateValues>(data: {
|
|
73
|
+
stateName: T;
|
|
74
|
+
eventData: OnSetEvent<T>;
|
|
75
|
+
cameraId: string;
|
|
76
|
+
pluginId: string;
|
|
77
|
+
ws?: boolean;
|
|
78
|
+
}): Promise<void>;
|
|
79
|
+
refreshStates(data: {
|
|
80
|
+
cameraId: string;
|
|
81
|
+
pluginId: string;
|
|
82
|
+
ws?: boolean;
|
|
83
|
+
}): Promise<{
|
|
84
|
+
camera: Camera;
|
|
85
|
+
states: StateValues;
|
|
86
|
+
}>;
|
|
87
|
+
onRequestReboot(pluginId: string, cameraId: string, ...args: Parameters<CameraDelegate['reboot']>): Promise<Buffer>;
|
|
88
|
+
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
|
+
onRequestSnapshotRequest(pluginId: string, cameraId: string, ...args: Parameters<CameraDelegate['snapshotRequest']>): Promise<Buffer>;
|
|
92
|
+
onRequestPrepareStream(pluginId: string, cameraId: string, ...args: Parameters<CameraDelegate['prepareStream']>): Promise<void>;
|
|
93
|
+
onRequestWebRTCOffer(pluginId: string, cameraId: string, ...args: Parameters<CameraDelegate['onOffer']>): Promise<string>;
|
|
94
|
+
onRequestWebRTCIceCandidates(pluginId: string, cameraId: string, ...args: Parameters<CameraDelegate['onCandidates']>): Promise<void>;
|
|
87
95
|
handleMessage(message: ProxyMessageStructure): Promise<void>;
|
|
88
96
|
}
|
|
@@ -4,10 +4,12 @@ export declare class MessageQueue {
|
|
|
4
4
|
private logger;
|
|
5
5
|
private proxyServer;
|
|
6
6
|
private router;
|
|
7
|
+
private aborted;
|
|
7
8
|
private isProcessing;
|
|
8
9
|
private queue;
|
|
9
10
|
private pendingResponses;
|
|
10
11
|
constructor(proxyServer: ProxyServer);
|
|
12
|
+
abortQueue(): void;
|
|
11
13
|
enqueue(message: ProxyMessageStructure): Promise<any>;
|
|
12
14
|
private processQueue;
|
|
13
15
|
private listenToDealer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Camera } from '../api/database/types';
|
|
2
2
|
import type { CameraExtension } from '../plugins/types';
|
|
3
|
-
import type { CameraConfig, OnSetEvent, StateValues, CameraDevice, FfmpegOptions, PrebufferType } from '../camera/types';
|
|
3
|
+
import type { CameraConfig, OnSetEvent, StateValues, CameraDevice, FfmpegOptions, PrebufferType, StreamInfo } from '../camera/types';
|
|
4
4
|
import type { IceServer } from '../services/config/types';
|
|
5
5
|
export type MethodKeys<T> = {
|
|
6
6
|
[K in keyof T]: T[K] extends Function ? K : never;
|
|
@@ -18,7 +18,7 @@ export interface ProxyMessageStructure {
|
|
|
18
18
|
pluginId: string;
|
|
19
19
|
type: 'request' | 'reply';
|
|
20
20
|
proxy: 'system' | 'device' | 'plugins' | 'camera';
|
|
21
|
-
client: 'pluginFn' | 'pluginStorage' | 'cameraFn' | 'cameraDelegate' | 'device' | 'system';
|
|
21
|
+
client: 'pluginFn' | 'pluginStorage' | 'cameraFn' | 'cameraDelegate' | 'cameraPrebufferDelegate' | 'device' | 'system';
|
|
22
22
|
fn: string;
|
|
23
23
|
args: any;
|
|
24
24
|
timeout: number;
|
|
@@ -147,37 +147,35 @@ export interface CameraDeviceListenerStatePayload<K extends keyof StateValues> {
|
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
149
|
export interface CameraDeviceListenerMessagePayload {
|
|
150
|
-
type: 'removed' | 'updated'
|
|
150
|
+
type: 'removed' | 'updated';
|
|
151
151
|
data?: any;
|
|
152
152
|
}
|
|
153
153
|
export interface CameraDeviceProxyMethods {
|
|
154
|
-
|
|
155
|
-
sourceName: string;
|
|
156
|
-
prebuffer?: boolean;
|
|
154
|
+
reboot(data: {
|
|
157
155
|
cameraId: string;
|
|
158
156
|
pluginId: string;
|
|
159
157
|
ws?: boolean;
|
|
160
|
-
}): Promise<
|
|
161
|
-
|
|
158
|
+
}): Promise<void>;
|
|
159
|
+
isPrebuffering(data: {
|
|
162
160
|
sourceName: string;
|
|
163
|
-
address: string;
|
|
164
161
|
type: PrebufferType;
|
|
165
162
|
cameraId: string;
|
|
166
163
|
pluginId: string;
|
|
167
164
|
ws?: boolean;
|
|
168
|
-
}): Promise<
|
|
169
|
-
|
|
165
|
+
}): Promise<boolean>;
|
|
166
|
+
getPrebufferRawUrl(data: {
|
|
170
167
|
sourceName: string;
|
|
171
168
|
type: PrebufferType;
|
|
172
169
|
cameraId: string;
|
|
173
170
|
pluginId: string;
|
|
174
171
|
ws?: boolean;
|
|
175
|
-
}): Promise<
|
|
176
|
-
|
|
172
|
+
}): Promise<string | undefined>;
|
|
173
|
+
getStreamInfo(data: {
|
|
174
|
+
sourceName: string;
|
|
177
175
|
cameraId: string;
|
|
178
176
|
pluginId: string;
|
|
179
177
|
ws?: boolean;
|
|
180
|
-
}): Promise<
|
|
178
|
+
}): Promise<StreamInfo | undefined>;
|
|
181
179
|
getFffmpegPath(data: {
|
|
182
180
|
cameraId: string;
|
|
183
181
|
pluginId: string;
|
|
@@ -188,21 +186,12 @@ export interface CameraDeviceProxyMethods {
|
|
|
188
186
|
pluginId: string;
|
|
189
187
|
ws?: boolean;
|
|
190
188
|
}): IceServer[];
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
eventData: OnSetEvent<T>;
|
|
194
|
-
cameraId: string;
|
|
195
|
-
pluginId: string;
|
|
196
|
-
ws?: boolean;
|
|
197
|
-
}): void;
|
|
198
|
-
refreshStates(data: {
|
|
189
|
+
snapshot(data: {
|
|
190
|
+
forceNew?: boolean;
|
|
199
191
|
cameraId: string;
|
|
200
192
|
pluginId: string;
|
|
201
193
|
ws?: boolean;
|
|
202
|
-
}): Promise<
|
|
203
|
-
camera: Camera;
|
|
204
|
-
states: StateValues;
|
|
205
|
-
}>;
|
|
194
|
+
}): Promise<ArrayBuffer>;
|
|
206
195
|
streamVideo(data: {
|
|
207
196
|
sourceName: string;
|
|
208
197
|
options: FfmpegOptions;
|
|
@@ -218,6 +207,21 @@ export interface CameraDeviceProxyMethods {
|
|
|
218
207
|
pluginId: string;
|
|
219
208
|
ws?: boolean;
|
|
220
209
|
}): Promise<void>;
|
|
210
|
+
updateState<T extends keyof StateValues>(data: {
|
|
211
|
+
stateName: T;
|
|
212
|
+
eventData: OnSetEvent<T>;
|
|
213
|
+
cameraId: string;
|
|
214
|
+
pluginId: string;
|
|
215
|
+
ws?: boolean;
|
|
216
|
+
}): void;
|
|
217
|
+
refreshStates(data: {
|
|
218
|
+
cameraId: string;
|
|
219
|
+
pluginId: string;
|
|
220
|
+
ws?: boolean;
|
|
221
|
+
}): Promise<{
|
|
222
|
+
camera: Camera;
|
|
223
|
+
states: StateValues;
|
|
224
|
+
}>;
|
|
221
225
|
}
|
|
222
226
|
export type CameraDeviceProxyMethodNames = MethodKeys<CameraDeviceProxyMethods>;
|
|
223
227
|
export type CameraDeviceProxyEventCallbacks = {
|
|
@@ -30,7 +30,7 @@ export interface IConfig {
|
|
|
30
30
|
settings: Partial<InterfaceSettings>;
|
|
31
31
|
plugins: Partial<PluginsSettings>;
|
|
32
32
|
}
|
|
33
|
-
export type LoggingLevel = 'info' | 'debug' | 'warn' | 'error' | '
|
|
33
|
+
export type LoggingLevel = 'info' | 'debug' | 'warn' | 'error' | 'trace';
|
|
34
34
|
export interface Logger {
|
|
35
35
|
level?: LoggingLevel;
|
|
36
36
|
disableTimestamps?: boolean;
|
|
@@ -12,17 +12,18 @@ export declare class PluginLogger {
|
|
|
12
12
|
warn(...args: any[]): void;
|
|
13
13
|
attention(...args: any[]): void;
|
|
14
14
|
debug(...args: any[]): void;
|
|
15
|
+
trace(...args: any[]): void;
|
|
15
16
|
}
|
|
16
17
|
export declare class Logger {
|
|
17
18
|
private _loggerPrefix;
|
|
18
19
|
private _debugEnabled;
|
|
19
|
-
private
|
|
20
|
+
private _traceLogging;
|
|
20
21
|
private _disableTimestamps;
|
|
21
22
|
notifications: UiNotification[];
|
|
22
23
|
get debugEnabled(): boolean;
|
|
23
24
|
set debugEnabled(state: boolean);
|
|
24
|
-
get
|
|
25
|
-
set
|
|
25
|
+
get traceLogging(): boolean;
|
|
26
|
+
set traceLogging(state: boolean);
|
|
26
27
|
get disableTimestamps(): boolean;
|
|
27
28
|
set disableTimestamps(state: boolean);
|
|
28
29
|
get prefix(): string;
|
|
@@ -32,7 +33,7 @@ export declare class Logger {
|
|
|
32
33
|
warn(...args: any[]): void;
|
|
33
34
|
attention(...args: any[]): void;
|
|
34
35
|
debug(...args: any[]): void;
|
|
35
|
-
|
|
36
|
+
trace(...args: any[]): void;
|
|
36
37
|
notify(title: string, text: string, type: LoggingLevel, link: string, socket?: Socket): Promise<void>;
|
|
37
38
|
private setNotification;
|
|
38
39
|
private formatDateTime;
|