@camera.ui/browser 0.0.107 → 0.0.108

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.
@@ -1,6 +1,5 @@
1
1
  import { BaseCameraDevice } from '../../../../../packages/plugineer/src/polyglot/node/camera/index.js';
2
2
  import { CameraInterface } from '../../../../../packages/plugineer/src/polyglot/node/camera/interfaces/camera.js';
3
- import { CameraPrebufferInterface } from '../../../../../packages/plugineer/src/polyglot/node/camera/interfaces/prebuffer.js';
4
3
  import { CameraPTZInterface } from '../../../../../packages/plugineer/src/polyglot/node/camera/interfaces/ptz.js';
5
4
  import { Go2RTCSession } from '../streaming/go2rts-session.js';
6
5
  import type { Camera, CameraInternalSource, CameraSource } from '../../../../../shared/types/index.js';
@@ -15,7 +14,6 @@ export declare class CameraDeviceProxy extends BaseCameraDevice implements Camer
15
14
  get started(): boolean;
16
15
  protected cameraDelegate: CameraInterface;
17
16
  protected ptzDelegate: CameraPTZInterface;
18
- protected prebufferDelegate: CameraPrebufferInterface;
19
17
  get sources(): CameraSource[];
20
18
  get internalSources(): CameraInternalSource[];
21
19
  constructor(camera: Camera, socketService: SocketService, logger: BaseLogger);
@@ -2,7 +2,7 @@ import type { Observable, Subject } from 'rxjs';
2
2
  import type { BaseCameraDevice } from '../../../../packages/plugineer/src/polyglot/node/camera/index.js';
3
3
  import type { VideoStreamingMode } from '../../../../shared/types/index.js';
4
4
  import type { Go2RTCSession } from './streaming/go2rts-session.js';
5
- export type { AudioSetEvent, AudioState, BatterySetEvent, BatteryState, CameraActivitySettings, CameraRoles, CameraSource, CameraZone, Container, Detection, DetectionZone, DoorbellState, LightSetEvent, LightState, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, Point, PrebufferState, SirenSetEvent, SirenState, VideoStreamingMode, ZoneFilter, ZoneType, } from '../../../../shared/types/index.js';
5
+ export type { AudioSetEvent, AudioState, BatterySetEvent, BatteryState, CameraActivitySettings, CameraRoles, CameraSource, CameraZone, Detection, DetectionZone, DoorbellState, LightSetEvent, LightState, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, Point, SirenSetEvent, SirenState, VideoStreamingMode, ZoneFilter, ZoneType, } from '../../../../shared/types/index.js';
6
6
  export type { Go2RTCSession } from './streaming/go2rts-session.js';
7
7
  export type CameraUiClientConfig = WithCredentials | WithToken;
8
8
  export interface BasicBrowserPeerConnection {
@@ -1,7 +1,7 @@
1
1
  import { Subscribed } from '@camera.ui/common/utils';
2
2
  import TTLCache from '@isaacs/ttlcache';
3
3
  import { BehaviorSubject } from 'rxjs';
4
- import type { AudioSetEvent, AudioState, BatterySetEvent, BatteryState, Camera, CameraActivitySettings, CameraDelegate, CameraFrameWorkerSettings, CameraInformation, CameraInput, CameraInternalSource, CameraPTZDelegate, CameraPrebufferDelegate, CameraSource, CameraType, DetectionZone, DoorbellSetEvent, DoorbellState, LightSetEvent, LightState, LoggerService, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, SetValues, SirenSetEvent, SirenState, StateValues } from '@camera.ui/types';
4
+ import type { AudioSetEvent, AudioState, BatterySetEvent, BatteryState, Camera, CameraActivitySettings, CameraDelegate, CameraFrameWorkerSettings, CameraInformation, CameraInput, CameraInternalSource, CameraPTZDelegate, CameraSource, CameraType, DetectionZone, DoorbellSetEvent, DoorbellState, LightSetEvent, LightState, LoggerService, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, SetValues, SirenSetEvent, SirenState, StateValues } from '@camera.ui/types';
5
5
  import type { Observable } from 'rxjs';
6
6
  export declare abstract class BaseCameraDevice extends Subscribed {
7
7
  readonly logger: LoggerService;
@@ -25,7 +25,6 @@ export declare abstract class BaseCameraDevice extends Subscribed {
25
25
  readonly onBatteryChanged: Observable<BatteryState>;
26
26
  protected abstract cameraDelegate: CameraDelegate;
27
27
  protected abstract ptzDelegate: CameraPTZDelegate;
28
- protected abstract prebufferDelegate: CameraPrebufferDelegate;
29
28
  protected get cameraObject(): Camera;
30
29
  get id(): string;
31
30
  get nativeId(): string | undefined;
@@ -45,7 +44,6 @@ export declare abstract class BaseCameraDevice extends Subscribed {
45
44
  get hasAudioDetector(): boolean;
46
45
  get hasObjectDetector(): boolean;
47
46
  get hasPtz(): boolean;
48
- get hasPrebuffer(): boolean;
49
47
  get snapshotTTL(): number;
50
48
  get activityZones(): DetectionZone[];
51
49
  get activitySettings(): CameraActivitySettings;
@@ -87,6 +85,7 @@ export declare abstract class BaseCameraDevice extends Subscribed {
87
85
  protected getLightState(event: LightSetEvent, ignoreLastEvet?: boolean): LightState;
88
86
  protected getSirenState(event: SirenSetEvent, ignoreLastEvet?: boolean): SirenState;
89
87
  protected getBatteryState(event: BatterySetEvent, ignoreLastEvet?: boolean): BatteryState;
88
+ protected cleanState<T extends keyof StateValues>(state: StateValues[T] | SetValues[T]): SetValues[T];
90
89
  private isStateEvent;
91
90
  private createStateObservable;
92
91
  }
@@ -1,6 +1,5 @@
1
1
  import type { AudioSetEvent, AudioState, BatterySetEvent, BatteryState, DoorbellSetEvent, DoorbellState, FrameData, FrameMetadata, LightSetEvent, LightState, MotionSetEvent, MotionState, ObjectSetEvent, ObjectState, SirenSetEvent, SirenState } from '@camera.ui/types';
2
2
  import type { CameraInterface } from './interfaces/camera.js';
3
- import type { CameraPrebufferInterface } from './interfaces/prebuffer.js';
4
3
  import type { CameraPTZInterface } from './interfaces/ptz.js';
5
4
  export interface FrameState extends MotionState {
6
5
  frameData: FrameData;
@@ -10,6 +9,10 @@ export type States = LightState | MotionState | AudioState | ObjectState | Doorb
10
9
  export type Sets = LightSetEvent | MotionSetEvent | AudioSetEvent | ObjectSetEvent | DoorbellSetEvent | SirenSetEvent | BatterySetEvent;
11
10
  export interface CameraInterfaces {
12
11
  readonly cameraDelegate: CameraInterface;
13
- readonly prebufferDelegate: CameraPrebufferInterface;
14
12
  readonly ptzDelegate: CameraPTZInterface;
15
13
  }
14
+ export type DelegateMethods = {
15
+ [K in keyof CameraInterfaces]: {
16
+ [M in keyof CameraInterfaces[K]]: M extends string ? M : never;
17
+ }[keyof CameraInterfaces[K]];
18
+ }[keyof CameraInterfaces];
@@ -1,29 +1,4 @@
1
- import { z } from 'zod';
2
- import type { JsonSchema, JsonSchemaArray, JsonSchemaBoolean, JsonSchemaButton, JsonSchemaEnum, JsonSchemaForm, JsonSchemaNumber, JsonSchemaObject, JsonSchemaObjectButton, JsonSchemaObjectWithButtons, JsonSchemaString, RootSchema } from '@camera.ui/types';
3
- import type { ZodTypeAny } from 'zod';
4
- type RootZodSchema = z.ZodObject<Record<string, ZodTypeAny>, 'strict', ZodTypeAny, Record<string, any>, Record<string, any>>;
5
- type OptionalZodString = z.ZodOptional<z.ZodString> | z.ZodString | z.ZodOptional<z.ZodEffects<z.ZodString, string, string>> | z.ZodEffects<z.ZodString, string, string>;
6
- type OptionalZodNumber = z.ZodOptional<z.ZodNumber> | z.ZodNumber | z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>> | z.ZodEffects<z.ZodNumber, number, number>;
7
- type OptionalZodBoolean = z.ZodOptional<z.ZodBoolean> | z.ZodBoolean;
8
- type OptionalZodZobject = z.ZodOptional<z.ZodObject<Record<string, z.ZodTypeAny>, 'strict', z.ZodTypeAny, Record<string, any>, Record<string, any>>> | z.ZodObject<Record<string, z.ZodTypeAny>, 'strict', z.ZodTypeAny, Record<string, any>, Record<string, any>> | z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>> | z.ZodRecord<z.ZodString, z.ZodAny>;
9
- type OptionalZodArray = z.ZodOptional<z.ZodType<any, any, any>> | z.ZodType<any, any, any>;
10
- 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>;
11
- 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>;
12
- type ZodAny = z.ZodType<any, any, any>;
13
- /**
14
- * Generate root JSON schema from value.
15
- *
16
- * @param value - Value.
17
- * @returns - Root JSON schema.
18
- */
19
- export declare const generateRootSchema: (value: Record<string, any>) => RootSchema;
20
- /**
21
- * Generate JSON schema from value.
22
- *
23
- * @param value - Value.
24
- * @returns - JSON schema.
25
- */
26
- export declare const generateSchema: (value: any) => JsonSchema;
1
+ import type { JsonSchema, JsonSchemaArray, JsonSchemaBoolean, JsonSchemaButton, JsonSchemaEnum, JsonSchemaForm, JsonSchemaNumber, JsonSchemaObject, JsonSchemaObjectWithButtons, JsonSchemaString, RootSchema } from '@camera.ui/types';
27
2
  /**
28
3
  * Generate a JSON object from a given Root JSON schema.
29
4
  *
@@ -38,23 +13,6 @@ export declare const generateJsonFromRootSchema: (rootSchema: RootSchema) => Rec
38
13
  * @returns - The generated JSON object.
39
14
  */
40
15
  export declare const generateJsonFromSchema: (jsonSchema: JsonSchema) => any;
41
- /**
42
- * Generate a JSON object from a given JSON schema and use values from a config file.
43
- *
44
- * @param jsonSchema - The JSON schema.
45
- * @param config - The config file with values to use.
46
- * @returns - The generated JSON object.
47
- */
48
- export declare const generateJsonFromSchemaWithConfig: (jsonSchema: JsonSchema, config: Record<string, any>, path?: string) => any;
49
- /**
50
- * Generate a new config object from a given JSON schema and use values from a config file.
51
- * Contains only storable values.
52
- *
53
- * @param jsonSchema - The JSON schema.
54
- * @param config - The config file with values to use.
55
- * @param path - The path to the current JSON schema.
56
- */
57
- export declare const generateStorableConfig: (jsonSchema: JsonSchemaForm | JsonSchema, config: Record<string, any>) => Record<string, any>;
58
16
  /**
59
17
  * Removes all functions from a given Plugin JSON schema form.
60
18
  *
@@ -69,22 +27,6 @@ export declare const removeFunctionsFromSchemaForm: (schemaForm: JsonSchemaForm)
69
27
  * @returns - The JSON schema without functions.
70
28
  */
71
29
  export declare const removeFunctionsFromSchema: (jsonSchema: JsonSchema) => JsonSchema;
72
- /**
73
- * Checks if a given JSON schema is readonly.
74
- *
75
- * @param jsonSchema - The JSON schema to check.
76
- * @param group - The group to check.
77
- * @returns - True if the JSON schema is readonly, false otherwise.
78
- */
79
- export declare const schemaIsReadonly: (jsonSchema: JsonSchema, group?: string) => boolean;
80
- /**
81
- * Checks if a given JSON schema is storable.
82
- *
83
- * @param jsonSchema - The JSON schema to check.
84
- * @param group - The group to check.
85
- * @returns - True if the JSON schema is storable, false otherwise.
86
- */
87
- export declare const schemaIsStorable: (jsonSchema: JsonSchema, group?: string) => boolean;
88
30
  /**
89
31
  * Converts a config path to a schema path.
90
32
  *
@@ -107,183 +49,14 @@ export declare const schemaPathToConfigPath: (schemaPath: string) => string;
107
49
  * @returns - The value of the searched key path, if found, otherwise undefined.
108
50
  */
109
51
  export declare const getValueByPath: (obj: Record<any, any> | undefined, path: string) => any;
110
- /**
111
- * Generates a Zod schema from a given JSON schema.
112
- *
113
- * @param jsonSchema - The JSON schema from which the Zod schema should be generated.
114
- * @returns - The generated Zod schema.
115
- */
116
- export declare const generateZodSchemaFromRoot: (rootSchema: RootSchema) => RootZodSchema;
117
- /**
118
- * Generates a Zod schema from a given JSON schema.
119
- *
120
- * @param jsonSchema - The JSON schema from which the Zod schema should be generated.
121
- * @param initial - A boolean indicating whether this is the initial call to the function.
122
- * This is used for handling nested schemas.
123
- * @returns - The generated Zod schema.
124
- */
125
- export declare const generateZodSchema: (jsonSchema: JsonSchema) => ZodAny;
126
- /**
127
- * Generates a JSON schema for a number.
128
- *
129
- * @param value - The number for which the JSON schema should be generated.
130
- * @returns - The generated JSON schema for the number.
131
- */
132
- export declare const generateNumberSchema: () => JsonSchemaNumber;
133
- /**
134
- * Generates a JSON schema for a boolean.
135
- *
136
- * @param value - The boolean for which the JSON schema should be generated.
137
- * @returns - The generated JSON schema for the boolean.
138
- */
139
- export declare const genereateBooleanSchema: () => JsonSchemaBoolean;
140
- /**
141
- * Generates a JSON schema for a string.
142
- *
143
- * @param value - The string for which the JSON schema should be generated.
144
- * @returns - The generated JSON schema for the string.
145
- */
146
- export declare const generateStringSchema: (value: string) => JsonSchemaString;
147
- /**
148
- * Generates a JSON schema for an enum.
149
- *
150
- * @param value - The enum for which the JSON schema should be generated.
151
- * @param type - The type of the enum.
152
- * @returns - The generated JSON schema for the enum.
153
- */
154
- export declare const generateEnumSchema: (value: (string | number | boolean)[]) => JsonSchemaEnum;
155
- /**
156
- * Generates a JSON schema for an object.
157
- *
158
- * @param value - The object for which the JSON schema should be generated.
159
- * @returns - The generated JSON schema for the object.
160
- */
161
- export declare const generateObjectSchema: (value: Record<string, any>) => JsonSchemaObject;
162
- /**
163
- * Generates a JSON schema for an object including up to two buttons.
164
- *
165
- * @param value - The object for which the JSON schema should be generated.
166
- * @param buttons - Array of min one button and up to two buttons to be included in the schema.
167
- * @returns - The generated JSON schema for the object.
168
- */
169
- export declare const generateObjectSchemaWithButtons: (value: Record<string, any>, buttons: JsonSchemaObjectButton[]) => JsonSchemaObjectWithButtons;
170
- /**
171
- * Generates a JSON schema for an array.
172
- *
173
- * @param array - The array for which the JSON schema should be generated.
174
- * @returns - The generated JSON schema for the array.
175
- */
176
- export declare const generateArraySchema: (array: string[] | number[] | boolean[] | Record<string, any>[]) => JsonSchemaArray;
177
- /**
178
- * Checks if the given JSON schema is of string type.
179
- *
180
- * @param jsonSchema - The JSON schema to check.
181
- * @returns - True if the JSON schema is of string type, false otherwise.
182
- */
183
52
  export declare const isStringType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaString;
184
- /**
185
- * Checks if the given JSON schema is of number type.
186
- *
187
- * @param jsonSchema - The JSON schema to check.
188
- * @returns - True if the JSON schema is of number type, false otherwise.
189
- */
190
53
  export declare const isNumberType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaNumber;
191
- /**
192
- * Checks if the given JSON schema is of boolean type.
193
- *
194
- * @param jsonSchema - The JSON schema to check.
195
- * @returns - True if the JSON schema is of boolean type, false otherwise.
196
- */
197
54
  export declare const isBooleanType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaBoolean;
198
- /**
199
- * Checks if the given JSON schema is of enum type.
200
- *
201
- * @param jsonSchema - The JSON schema to check.
202
- * @returns - True if the JSON schema is of enum type, false otherwise.
203
- */
204
55
  export declare const isEnumType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaEnum;
205
- /**
206
- * Checks if the given JSON schema is of object type.
207
- *
208
- * @param jsonSchema - The JSON schema to check.
209
- * @returns - True if the JSON schema is of object type, false otherwise.
210
- */
211
56
  export declare const isObjectType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaObject;
212
- /**
213
- * Checks if the given JSON schema is of object type with buttons.
214
- *
215
- * @param jsonSchema - The JSON schema to check.
216
- * @returns - True if the JSON schema is of object type with buttons, false otherwise.
217
- */
218
57
  export declare const isObjectTypeWithButtons: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaObjectWithButtons;
219
- /**
220
- * Checks if the given JSON schema is of array type.
221
- *
222
- * @param jsonSchema - The JSON schema to check.
223
- * @returns - True if the JSON schema is of array type, false otherwise.
224
- */
225
58
  export declare const isArrayType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaArray;
226
- /**
227
- * Checks if the given JSON schema is of button type.
228
- *
229
- * @param jsonSchema - The JSON schema to check.
230
- * @returns - True if the JSON schema is of button type, false otherwise.
231
- */
232
59
  export declare const isButtonType: (jsonSchema: Partial<JsonSchema>) => jsonSchema is JsonSchemaButton;
233
- /**
234
- * Checks if the given value is a JSON schema.
235
- *
236
- * @param value - The value to check.
237
- * @returns - True if the value is a JSON schema, false otherwise.
238
- */
60
+ export declare const isValidableStringType: (jsonSchema: JsonSchema) => jsonSchema is JsonSchemaString;
239
61
  export declare const isJsonSchema: (value: any) => value is JsonSchema;
240
- /**
241
- * Checks if the given value is a JSON Primitive schema.
242
- *
243
- * @param value - The value to check.
244
- * @returns - True if the value is a JSON schema, false otherwise.
245
- */
246
62
  export declare const isPrimitiveType: (value: any) => value is JsonSchemaString | JsonSchemaNumber | JsonSchemaBoolean | JsonSchemaEnum;
247
- /**
248
- * Creates a Zod string schema from a given JSON schema.
249
- *
250
- * @param jsonSchema - The JSON schema from which the Zod schema should be created.
251
- * @returns - The created Zod string schema.
252
- */
253
- export declare const createZodStringSchema: (jsonSchema: JsonSchemaString) => OptionalZodString;
254
- /**
255
- * Creates a Zod number schema from a given JSON schema.
256
- *
257
- * @param jsonSchema - The JSON schema from which the Zod schema should be created.
258
- * @returns - The created Zod number schema.
259
- */
260
- export declare const createZodNumberSchema: (jsonSchema: JsonSchemaNumber) => OptionalZodNumber;
261
- /**
262
- * Creates a Zod boolean schema from a given JSON schema.
263
- *
264
- * @param jsonSchema - The JSON schema from which the Zod schema should be created.
265
- * @returns - The created Zod boolean schema.
266
- */
267
- export declare const createZodBooleanSchema: (jsonSchema: JsonSchemaBoolean) => OptionalZodBoolean;
268
- /**
269
- * Creates a Zod union schema from a given JSON schema.
270
- *
271
- * @param jsonSchema - The JSON schema from which the Zod schema should be created.
272
- * @returns - The created Zod union schema.
273
- */
274
- export declare const createEnumSchema: (jsonSchema: JsonSchemaEnum) => OptionalZodEnum | OptionalZodEnumMultiple;
275
- /**
276
- * Creates a Zod object schema from a given JSON schema.
277
- *
278
- * @param jsonSchema - The JSON schema from which the Zod schema should be created.
279
- * @returns - The created Zod object schema.
280
- */
281
- export declare const createZodObjectSchema: (jsonSchema: JsonSchemaObject) => OptionalZodZobject;
282
- /**
283
- * Creates a Zod array schema from a given JSON schema.
284
- *
285
- * @param jsonSchema - The JSON schema from which the Zod schema should be created.
286
- * @returns - The created Zod array schema.
287
- */
288
- export declare const createZodArraySchema: (jsonSchema: JsonSchemaArray) => OptionalZodArray;
289
- export {};
@@ -40,25 +40,19 @@ export interface PluginInfo {
40
40
  name: string;
41
41
  contract: PluginContract;
42
42
  }
43
- export type ExtensionOrSupport = {
44
- extension: CameraExtension;
45
- supportAdditionalCameras?: never;
46
- } | {
47
- extension?: never;
48
- supportAdditionalCameras?: boolean;
49
- };
50
43
  export interface PluginOptions {
51
44
  extendedMotionDetection?: boolean;
52
45
  }
53
- export interface PluginContractBase {
46
+ export interface PluginContract {
47
+ extension: CameraExtension;
48
+ supportAdditionalCameras?: boolean;
54
49
  builtIns?: CameraExtensionWithoutHub[];
55
50
  options?: PluginOptions;
56
51
  dependencies?: string[];
57
52
  pythonVersion?: string;
58
53
  bundled?: boolean;
59
54
  }
60
- export type PluginContract = PluginContractBase & ExtensionOrSupport;
61
- export type CameraExtensionWithoutHub = 'prebuffer' | 'motionDetection' | 'objectDetection' | 'audioDetection' | 'ptz';
55
+ export type CameraExtensionWithoutHub = 'motionDetection' | 'objectDetection' | 'audioDetection' | 'ptz';
62
56
  export type Go2RtcIncomingMessage = Go2RtcAnswerMessage | Go2RtcIceCandidateMessage | ErrorMessage;
63
57
  export type Go2RtcOutgoingMessage = Go2RtcOfferMessage | Go2RtcIceCandidateMessage;
64
58
  export interface Go2RtcOfferMessage {
@@ -13,11 +13,10 @@ export type ZoneType = 'intersect' | 'contain';
13
13
  export type ZoneFilter = 'include' | 'exclude';
14
14
  export type ObjectClass = 'person' | 'bicycle' | 'car' | 'motorcycle' | 'airplane' | 'bus' | 'train' | 'truck' | 'boat' | 'traffic light' | 'fire hydrant' | 'stop sign' | 'parking meter' | 'bench' | 'bird' | 'cat' | 'dog' | 'horse' | 'sheep' | 'cow' | 'elephant' | 'bear' | 'zebra' | 'giraffe' | 'backpack' | 'umbrella' | 'handbag' | 'tie' | 'suitcase' | 'frisbee' | 'skis' | 'snowboard' | 'sports ball' | 'kite' | 'baseball bat' | 'baseball glove' | 'skateboard' | 'surfboard' | 'tennis racket' | 'bottle' | 'wine glass' | 'cup' | 'fork' | 'knife' | 'spoon' | 'bowl' | 'banana' | 'apple' | 'sandwich' | 'orange' | 'broccoli' | 'carrot' | 'hot dog' | 'pizza' | 'donut' | 'cake' | 'chair' | 'couch' | 'potted plant' | 'bed' | 'dining table' | 'toilet' | 'tv' | 'laptop' | 'mouse' | 'remote' | 'keyboard' | 'cell phone' | 'microwave' | 'oven' | 'toaster' | 'sink' | 'refrigerator' | 'book' | 'clock' | 'vase' | 'scissors' | 'teddy bear' | 'hair drier' | 'toothbrush' | 'motion';
15
15
  export type CameraRoles = 'high-resolution' | 'mid-resolution' | 'low-resolution' | 'snapshot';
16
- export type Container = 'mp4' | 'mpegts';
17
16
  export type DecoderFormat = 'yuv' | 'rgb';
18
17
  export type ImageInputFormat = 'yuv' | 'rgb' | 'rgba' | 'gray';
19
18
  export type ImageOutputFormat = 'rgb' | 'rgba' | 'gray';
20
- export type CameraExtension = 'hub' | 'prebuffer' | 'motionDetection' | 'objectDetection' | 'audioDetection' | 'ptz';
19
+ export type CameraExtension = 'cameraController' | 'hub' | 'motionDetection' | 'objectDetection' | 'audioDetection' | 'ptz';
21
20
  export type CameraFrameWorkerDecoder = 'pillow' | 'wasm' | 'rust';
22
21
  export type CameraFrameWorkerResolution = '3840x2160' | '3072x1728' | '2560x1440' | '1920x1080' | '1440x1080' | '1280x720' | '960x540' | '640x480' | '640x360' | '320x240' | '320x180';
23
22
  export type AudioCodec = 'PCMU' | 'PCMA' | 'MPEG4-GENERIC' | 'opus' | 'G722' | 'MPA' | 'PCM' | 'FLAC';
@@ -91,10 +90,6 @@ export interface CameraInput {
91
90
  urls: StreamUrls;
92
91
  internal: boolean;
93
92
  }
94
- export interface PrebufferState {
95
- url?: string;
96
- duration?: number;
97
- }
98
93
  export interface RTPInfo {
99
94
  payload?: number;
100
95
  codec: string;
@@ -174,6 +169,7 @@ export interface Go2RtcSource {
174
169
  }
175
170
  export interface Go2RtcWSSource {
176
171
  webrtc: string;
172
+ mse: string;
177
173
  }
178
174
  export interface BaseState<T extends LightState | AudioState | MotionState | ObjectState | SirenState | BatteryState | DoorbellState> {
179
175
  timestamp: number;
@@ -181,7 +177,7 @@ export interface BaseState<T extends LightState | AudioState | MotionState | Obj
181
177
  }
182
178
  export interface MotionSetEvent {
183
179
  state: boolean;
184
- detections: Detection[];
180
+ detections?: Detection[];
185
181
  }
186
182
  export interface AudioSetEvent {
187
183
  state: boolean;
@@ -313,9 +309,6 @@ export type CameraConfig = BaseCameraConfig & {
313
309
  export interface CameraDelegate {
314
310
  snapshot(): Promise<ArrayBuffer | undefined>;
315
311
  }
316
- export interface CameraPrebufferDelegate {
317
- getPrebufferingState(sourceName: string, container: Container): Promise<PrebufferState | undefined>;
318
- }
319
312
  export interface CameraPTZDelegate {
320
313
  moveAbsolute(pan: number, tilt: number, zoom: number): Promise<void>;
321
314
  moveRelative(pan: number, tilt: number, zoom: number): Promise<void>;
@@ -324,7 +317,6 @@ export interface CameraPTZDelegate {
324
317
  }
325
318
  export interface CameraDelegates {
326
319
  cameraDelegate: CameraDelegate;
327
- prebufferDelegate: CameraPrebufferDelegate;
328
320
  ptzDelegate: CameraPTZDelegate;
329
321
  }
330
322
  export type InternalSourceType = 'aac' | 'opus' | 'pcma';
@@ -333,7 +325,6 @@ export interface CameraBaseSource extends CameraInput {
333
325
  }
334
326
  export interface CameraSource extends CameraBaseSource {
335
327
  getInternalSource(type: InternalSourceType): CameraInternalSource;
336
- getPrebufferingState(container: Container): Promise<PrebufferState | undefined>;
337
328
  }
338
329
  export interface CameraInternalSource extends CameraBaseSource {
339
330
  type: InternalSourceType;
@@ -342,10 +333,12 @@ export interface CameraDeviceSource extends CameraSource {
342
333
  getInternalSource(type: InternalSourceType): CameraDeviceInternalSource;
343
334
  createWebRTCSession(options?: WebRTCConnectionOptions): WeriftSession;
344
335
  createRTSPSession(options?: RTSPConnectionOptions): RTSPSession;
336
+ createFMP4Session(): FMP4Session;
345
337
  }
346
338
  export interface CameraDeviceInternalSource extends CameraBaseSource {
347
339
  createWebRTCSession(options?: WebRTCConnectionOptions): WeriftSession;
348
340
  createRTSPSession(options?: RTSPConnectionOptions): RTSPSession;
341
+ createFMP4Session(): FMP4Session;
349
342
  type: InternalSourceType;
350
343
  }
351
344
  export interface WebRTCConnectionOptions {
@@ -367,7 +360,6 @@ export interface WeriftSession extends Subscribed {
367
360
  readonly onCallEnded: ReplaySubject<void>;
368
361
  readonly onVideoRtp: Subject<RtpPacket>;
369
362
  readonly onAudioRtp: Subject<RtpPacket>;
370
- reservePort(bufferPorts?: number): Promise<number>;
371
363
  startTranscoding(ffmpegOptions: FfmpegOptions, streamProbe?: ProbeStream): Promise<void>;
372
364
  transcodeReturnAudio(ffmpegOptions: ReturnAudioFFmpegOptions, streamProbe?: ProbeStream): Promise<void>;
373
365
  stop(): void;
@@ -380,12 +372,31 @@ export interface RTSPSession extends Subscribed {
380
372
  readonly onCallEnded: ReplaySubject<void>;
381
373
  readonly onVideoRtp: Subject<RtpPacket>;
382
374
  readonly onAudioRtp: Subject<RtpPacket>;
383
- reservePort(bufferPorts?: number): Promise<number>;
384
375
  startStream(): Promise<void>;
385
376
  startTranscoding(ffmpegOptions: FfmpegOptions): Promise<void>;
386
377
  transcodeReturnAudio(ffmpegOptions: ReturnAudioFFmpegOptions): Promise<void>;
387
378
  stop(): void;
388
- sendAudioPacket(rtp: RtpPacket | Buffer): void;
379
+ sendAudioPacket(rtp: RtpPacket): void;
380
+ }
381
+ export interface FMP4Session extends Subscribed {
382
+ readonly onStarted: ReplaySubject<void>;
383
+ readonly onError: ReplaySubject<Error>;
384
+ readonly onCallEnded: ReplaySubject<void>;
385
+ readonly onFragment: Subject<Fragment>;
386
+ readonly initSegment: Promise<Buffer>;
387
+ startStream(): void;
388
+ startTranscoding(ffmpegOptions: FragmentedFfmpegOptions): Promise<void>;
389
+ stop(): void;
390
+ fragments(abortSignal?: AbortSignal): AsyncGenerator<Fragment>;
391
+ }
392
+ export interface Fragment {
393
+ data: Buffer;
394
+ info: FragmentInfo;
395
+ }
396
+ export interface FragmentInfo {
397
+ isFtyp: boolean;
398
+ isMoov: boolean;
399
+ isKeyframe: boolean;
389
400
  }
390
401
  export type SpawnInput = string | number;
391
402
  export interface FfmpegOptions {
@@ -401,6 +412,13 @@ export interface ReturnAudioFFmpegOptions {
401
412
  input: SpawnInput[];
402
413
  logPrefix?: string;
403
414
  }
415
+ export interface FragmentedFfmpegOptions {
416
+ ffmpegPath: string;
417
+ input?: SpawnInput[];
418
+ video?: SpawnInput[];
419
+ audio?: SpawnInput[];
420
+ logPrefix?: string;
421
+ }
404
422
  export interface BasicPeerConnection {
405
423
  createOffer(): Promise<RTCSessionDescription>;
406
424
  acceptAnswer(answer: {
@@ -437,7 +455,6 @@ export interface Camera extends Omit<BaseCamera, 'activityZones'> {
437
455
  hasObjectDetector: boolean;
438
456
  extendedMotionDetector: boolean;
439
457
  hasPtz: boolean;
440
- hasPrebuffer: boolean;
441
458
  sources: CameraInput[];
442
459
  activityZones: DetectionZone[];
443
460
  }
@@ -461,7 +478,6 @@ export interface CameraDevice {
461
478
  readonly hasAudioDetector: boolean;
462
479
  readonly hasObjectDetector: boolean;
463
480
  readonly hasPtz: boolean;
464
- readonly hasPrebuffer: boolean;
465
481
  readonly activityZones: DetectionZone[];
466
482
  readonly activitySettings: CameraActivitySettings;
467
483
  readonly frameWorkerSettings: CameraFrameWorkerSettings;
@@ -63,7 +63,7 @@ export interface DBCamviewLayoutCamera {
63
63
  export type DBPluginStorageValue = Record<string, any>;
64
64
  export interface CameraExtensions {
65
65
  hub?: string[];
66
- prebuffer?: string;
66
+ cameraController?: string;
67
67
  motionDetection?: string;
68
68
  audioDetection?: string;
69
69
  objectDetection?: string;