@camera.ui/browser 0.0.52 → 0.0.54

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,5 +1,5 @@
1
1
  import { DeviceManagerClient, PluginsManagerClient, SystemManagerClient } from './proxy';
2
- import type { CameraUiClientConfig } from '../../node/src/types';
2
+ import type { CameraUiClientConfig } from './types';
3
3
  export interface API {
4
4
  deviceManager: DeviceManagerClient;
5
5
  pluginsManager: PluginsManagerClient;
@@ -1,2 +1,2 @@
1
- export * from '../../node/src/types';
2
1
  export * from './client';
2
+ export * from './types';
@@ -1,5 +1,5 @@
1
1
  import type { BaseLogger } from '../../../../shared/types';
2
- export type { AudioState, BaseLogger, BasicPeerConnection, Camera, CameraConfig, CameraDevice, CameraInput, DoorbellState, FfmpegOptions, Go2RtcAnswerMessage, Go2RtcIceCandidateMessage, Go2RtcIncomingMessage, Go2RtcOfferMessage, Go2RtcOutgoingMessage, LightState, MotionState, ObjectState, SirenState, } from '../../../../shared/types';
2
+ export type { AudioState, BaseLogger, BasicBrowserPeerConnection, Camera, CameraConfig, BrowserCameraDeviceBase as CameraDevice, CameraInput, DoorbellState, FfmpegOptions, Go2RtcAnswerMessage, Go2RtcIceCandidateMessage, Go2RtcIncomingMessage, Go2RtcOfferMessage, Go2RtcOutgoingMessage, LightState, MotionState, ObjectState, SirenState, } from '../../../../shared/types';
3
3
  export { BrowserStreamingSession } from '../../../../shared/types';
4
4
  export type CameraUiClientConfig = WithCredentials | WithToken;
5
5
  interface BaseConfig {
@@ -359,6 +359,11 @@ export declare const createCameraSchema: zod.ZodObject<{
359
359
  }>, "many">>;
360
360
  motionTimeout: zod.ZodDefault<zod.ZodNumber>;
361
361
  }, "strict", zod.ZodTypeAny, {
362
+ recording: {
363
+ enabled: boolean;
364
+ };
365
+ _id: string;
366
+ name: string;
362
367
  info: {
363
368
  model: string;
364
369
  manufacturer: string;
@@ -367,20 +372,6 @@ export declare const createCameraSchema: zod.ZodObject<{
367
372
  firmwareVersion: string;
368
373
  supportUrl: string;
369
374
  };
370
- recording: {
371
- enabled: boolean;
372
- };
373
- _id: string;
374
- name: string;
375
- extensions: {
376
- plugins: string[];
377
- hub?: string[] | undefined;
378
- prebuffer?: string | undefined;
379
- motionDetection?: string | undefined;
380
- objectDetection?: string | undefined;
381
- audioDetection?: string | undefined;
382
- ptz?: string | undefined;
383
- };
384
375
  type: "doorbell" | "camera";
385
376
  pluginId: string;
386
377
  sources: {
@@ -416,6 +407,15 @@ export declare const createCameraSchema: zod.ZodObject<{
416
407
  }[];
417
408
  }[];
418
409
  motionTimeout: number;
410
+ extensions: {
411
+ plugins: string[];
412
+ hub?: string[] | undefined;
413
+ prebuffer?: string | undefined;
414
+ motionDetection?: string | undefined;
415
+ objectDetection?: string | undefined;
416
+ audioDetection?: string | undefined;
417
+ ptz?: string | undefined;
418
+ };
419
419
  interface: {
420
420
  streamingModes: ("mse" | "webrtc" | "webrtc/tcp" | "mjpeg" | "hls" | "mp4")[];
421
421
  };
@@ -428,6 +428,10 @@ export declare const createCameraSchema: zod.ZodObject<{
428
428
  urls: string[];
429
429
  _id?: string | undefined;
430
430
  }[];
431
+ recording?: {
432
+ enabled?: boolean | undefined;
433
+ } | undefined;
434
+ _id?: string | undefined;
431
435
  info?: {
432
436
  model: string;
433
437
  manufacturer: string;
@@ -436,19 +440,6 @@ export declare const createCameraSchema: zod.ZodObject<{
436
440
  firmwareVersion: string;
437
441
  supportUrl: string;
438
442
  } | undefined;
439
- recording?: {
440
- enabled?: boolean | undefined;
441
- } | undefined;
442
- _id?: string | undefined;
443
- extensions?: {
444
- plugins: string[];
445
- hub?: string[] | undefined;
446
- prebuffer?: string | undefined;
447
- motionDetection?: string | undefined;
448
- objectDetection?: string | undefined;
449
- audioDetection?: string | undefined;
450
- ptz?: string | undefined;
451
- } | undefined;
452
443
  type?: "doorbell" | "camera" | undefined;
453
444
  nativeId?: string | undefined;
454
445
  pluginId?: string | undefined;
@@ -479,6 +470,15 @@ export declare const createCameraSchema: zod.ZodObject<{
479
470
  }[];
480
471
  }[] | undefined;
481
472
  motionTimeout?: number | undefined;
473
+ extensions?: {
474
+ plugins: string[];
475
+ hub?: string[] | undefined;
476
+ prebuffer?: string | undefined;
477
+ motionDetection?: string | undefined;
478
+ objectDetection?: string | undefined;
479
+ audioDetection?: string | undefined;
480
+ ptz?: string | undefined;
481
+ } | undefined;
482
482
  interface?: {
483
483
  streamingModes: ("mse" | "webrtc" | "webrtc/tcp" | "mjpeg" | "hls" | "mp4")[];
484
484
  } | undefined;
@@ -658,6 +658,10 @@ export declare const patchCameraSchema: zod.ZodObject<{
658
658
  }>, "many">>;
659
659
  motionTimeout: zod.ZodOptional<zod.ZodNumber>;
660
660
  }, "strict", zod.ZodTypeAny, {
661
+ recording?: {
662
+ enabled?: boolean | undefined;
663
+ } | undefined;
664
+ name?: string | undefined;
661
665
  info?: {
662
666
  model?: string | undefined;
663
667
  manufacturer?: string | undefined;
@@ -666,19 +670,6 @@ export declare const patchCameraSchema: zod.ZodObject<{
666
670
  firmwareVersion?: string | undefined;
667
671
  supportUrl?: string | undefined;
668
672
  } | undefined;
669
- recording?: {
670
- enabled?: boolean | undefined;
671
- } | undefined;
672
- name?: string | undefined;
673
- extensions?: {
674
- hub?: string[] | undefined;
675
- prebuffer?: string | undefined;
676
- motionDetection?: string | undefined;
677
- objectDetection?: string | undefined;
678
- audioDetection?: string | undefined;
679
- ptz?: string | undefined;
680
- plugins?: string[] | undefined;
681
- } | undefined;
682
673
  type?: "doorbell" | "camera" | undefined;
683
674
  sources?: {
684
675
  _id: string;
@@ -708,10 +699,23 @@ export declare const patchCameraSchema: zod.ZodObject<{
708
699
  }[];
709
700
  }[] | undefined;
710
701
  motionTimeout?: number | undefined;
702
+ extensions?: {
703
+ hub?: string[] | undefined;
704
+ prebuffer?: string | undefined;
705
+ motionDetection?: string | undefined;
706
+ objectDetection?: string | undefined;
707
+ audioDetection?: string | undefined;
708
+ ptz?: string | undefined;
709
+ plugins?: string[] | undefined;
710
+ } | undefined;
711
711
  interface?: {
712
712
  streamingModes?: ("mse" | "webrtc" | "webrtc/tcp" | "mjpeg" | "hls" | "mp4")[] | undefined;
713
713
  } | undefined;
714
714
  }, {
715
+ recording?: {
716
+ enabled?: boolean | undefined;
717
+ } | undefined;
718
+ name?: string | undefined;
715
719
  info?: {
716
720
  model?: string | undefined;
717
721
  manufacturer?: string | undefined;
@@ -720,19 +724,6 @@ export declare const patchCameraSchema: zod.ZodObject<{
720
724
  firmwareVersion?: string | undefined;
721
725
  supportUrl?: string | undefined;
722
726
  } | undefined;
723
- recording?: {
724
- enabled?: boolean | undefined;
725
- } | undefined;
726
- name?: string | undefined;
727
- extensions?: {
728
- hub?: string[] | undefined;
729
- prebuffer?: string | undefined;
730
- motionDetection?: string | undefined;
731
- objectDetection?: string | undefined;
732
- audioDetection?: string | undefined;
733
- ptz?: string | undefined;
734
- plugins?: string[] | undefined;
735
- } | undefined;
736
727
  type?: "doorbell" | "camera" | undefined;
737
728
  sources?: {
738
729
  name: string;
@@ -762,6 +753,15 @@ export declare const patchCameraSchema: zod.ZodObject<{
762
753
  }[];
763
754
  }[] | undefined;
764
755
  motionTimeout?: number | undefined;
756
+ extensions?: {
757
+ hub?: string[] | undefined;
758
+ prebuffer?: string | undefined;
759
+ motionDetection?: string | undefined;
760
+ objectDetection?: string | undefined;
761
+ audioDetection?: string | undefined;
762
+ ptz?: string | undefined;
763
+ plugins?: string[] | undefined;
764
+ } | undefined;
765
765
  interface?: {
766
766
  streamingModes?: ("mse" | "webrtc" | "webrtc/tcp" | "mjpeg" | "hls" | "mp4")[] | undefined;
767
767
  } | undefined;
@@ -61,8 +61,8 @@ export declare const mqttSchema: zod.ZodObject<{
61
61
  key?: string | undefined;
62
62
  }>>>;
63
63
  }, "strict", zod.ZodTypeAny, {
64
- enabled: boolean;
65
64
  port: number;
65
+ enabled: boolean;
66
66
  host: string;
67
67
  topicPrefix: string;
68
68
  clientId: string;
@@ -74,8 +74,8 @@ export declare const mqttSchema: zod.ZodObject<{
74
74
  password?: string | undefined;
75
75
  user?: string | undefined;
76
76
  }, {
77
- enabled?: boolean | undefined;
78
77
  port?: number | undefined;
78
+ enabled?: boolean | undefined;
79
79
  password?: string | undefined;
80
80
  host?: string | undefined;
81
81
  topicPrefix?: string | undefined;
@@ -0,0 +1,5 @@
1
+ import { BrowserStreamingSession } from '../streaming/browser/browser-streaming-session';
2
+ import { CameraDeviceBase } from './base';
3
+ export declare abstract class BrowserCameraDeviceBase extends CameraDeviceBase {
4
+ createBrowserSession(sourceName: string, videoElement: HTMLVideoElement): Promise<BrowserStreamingSession>;
5
+ }
@@ -1,12 +1,9 @@
1
1
  import { BehaviorSubject, Observable } from 'rxjs';
2
- import { Subscribed } from './utils/subscribed';
3
- import type { Camera, CameraInformation, CameraPublicProperties, CameraType, CameraZone } from '../api/database/types';
4
- import type { Frame } from '../detector/types';
5
- import type { IceServer } from '../services/config/types';
6
- import type { AudioState, BaseLogger, BatteryState, CameraDelegate, CameraPrebufferDelegate, CameraSource, DoorbellState, FfmpegOptions, LightState, MotionState, ObjectState, OnSetEvent, SirenState, StateValues, StreamingConnectionOptions } from './types';
7
- type StreamingSession = InstanceType<typeof import('./streaming/streaming-session').StreamingSession>;
8
- type BrowserStreamingSession = InstanceType<typeof import('./streaming/browser/browser-streaming-session').BrowserStreamingSession>;
9
- export type CameraDevice = ServerCameraDeviceBase | BrowserCameraDeviceBase;
2
+ import { Subscribed } from '../utils/subscribed';
3
+ import type { Camera, CameraInformation, CameraPublicProperties, CameraType, CameraZone } from '../../api/database/types';
4
+ import type { Frame } from '../../detector/types';
5
+ import type { IceServer } from '../../services/config/types';
6
+ import type { AudioState, BaseLogger, BatteryState, CameraDelegate, CameraPrebufferDelegate, CameraSource, DoorbellState, LightState, MotionState, ObjectState, OnSetEvent, SirenState, StateValues } from '../types';
10
7
  export declare abstract class CameraDeviceBase extends Subscribed {
11
8
  protected logger: BaseLogger;
12
9
  protected cameraSubject: BehaviorSubject<Camera>;
@@ -80,12 +77,3 @@ export declare abstract class CameraDeviceBase extends Subscribed {
80
77
  protected updateCameraState(state: boolean): void;
81
78
  protected removeAllListeners(): void;
82
79
  }
83
- export declare abstract class ServerCameraDeviceBase extends CameraDeviceBase {
84
- createSession(sourceName: string, options?: StreamingConnectionOptions): Promise<StreamingSession>;
85
- streamVideo(sourceName: string, options: FfmpegOptions): Promise<StreamingSession>;
86
- recordToFile(sourceName: string, outputPath: string, duration?: number): Promise<void>;
87
- }
88
- export declare abstract class BrowserCameraDeviceBase extends CameraDeviceBase {
89
- createBrowserSession(sourceName: string, videoElement: HTMLVideoElement): Promise<BrowserStreamingSession>;
90
- }
91
- export {};
@@ -0,0 +1,9 @@
1
+ import { StreamingConnectionOptions } from '../streaming/peer-connection';
2
+ import { StreamingSession } from '../streaming/streaming-session';
3
+ import { CameraDeviceBase } from './base';
4
+ import type { FfmpegOptions } from '../types';
5
+ export declare abstract class ServerCameraDeviceBase extends CameraDeviceBase {
6
+ createSession(sourceName: string, options?: StreamingConnectionOptions): Promise<StreamingSession>;
7
+ streamVideo(sourceName: string, options: FfmpegOptions): Promise<StreamingSession>;
8
+ recordToFile(sourceName: string, outputPath: string, duration?: number): Promise<void>;
9
+ }
@@ -0,0 +1,6 @@
1
+ import { BrowserCameraDeviceBase } from './base.browser';
2
+ import { ServerCameraDeviceBase } from './base.server';
3
+ export { CameraDeviceBase } from './base';
4
+ export { BrowserCameraDeviceBase } from './base.browser';
5
+ export { ServerCameraDeviceBase } from './base.server';
6
+ export type CameraDevice = BrowserCameraDeviceBase | ServerCameraDeviceBase;
@@ -1,7 +1,7 @@
1
1
  import { ReplaySubject, Subject } from 'rxjs';
2
2
  import { Subscribed } from '../../utils/subscribed';
3
3
  import type { IceServer } from '../../../services/config/types';
4
- import type { BrowserCameraDeviceBase as CameraDevice } from '../../base';
4
+ import type { BrowserCameraDeviceBase as CameraDevice } from '../../base/base.browser';
5
5
  import type { BaseLogger, BasicBrowserPeerConnection } from '../../types';
6
6
  export declare class BrowserPeerConnection extends Subscribed implements BasicBrowserPeerConnection {
7
7
  onIceCandidate: Subject<RTCIceCandidate>;
@@ -1,6 +1,6 @@
1
1
  import { Observable, ReplaySubject } from 'rxjs';
2
2
  import { Subscribed } from '../../utils/subscribed';
3
- import type { BrowserCameraDeviceBase as CameraDevice } from '../../base';
3
+ import type { BrowserCameraDeviceBase as CameraDevice } from '../../base/base.browser';
4
4
  import type { BaseLogger } from '../../types';
5
5
  import type { WebrtcBrowserConnection } from './webrtc-browser-connection';
6
6
  export declare class BrowserStreamingSession extends Subscribed {
@@ -2,7 +2,7 @@ import { ReplaySubject, type Observable } from 'rxjs';
2
2
  import { Subscribed } from '../../utils/subscribed';
3
3
  import { BrowserPeerConnection } from './browser-peer-connection';
4
4
  import type { IceServer } from '../../../services/config/types';
5
- import type { BrowserCameraDeviceBase as CameraDevice } from '../../base';
5
+ import type { BrowserCameraDeviceBase as CameraDevice } from '../../base/base.browser';
6
6
  import type { BaseLogger } from '../../types';
7
7
  export declare class WebrtcBrowserConnection extends Subscribed {
8
8
  readonly onCallAnswered: ReplaySubject<string>;
@@ -1,17 +1,32 @@
1
- import { ReplaySubject, Subject } from 'rxjs';
2
- import { MediaStreamTrack, RTCSessionDescription } from 'werift';
1
+ import { Observable, ReplaySubject, Subject } from 'rxjs';
2
+ import { MediaStreamTrack, RTCSessionDescription, RTCIceCandidate as WeriftRTCICECandidate } from 'werift';
3
3
  import { Subscribed } from '../utils/subscribed';
4
- import type { RTCIceCandidate, RtcpPacket, RtpPacket } from 'werift';
4
+ import type { ConnectionState, RTCIceCandidate, RtcpPacket, RtpPacket } from 'werift';
5
5
  import type { IceServer } from '../../services/config/types';
6
- import type { ServerCameraDeviceBase as CameraDevice } from '../base';
7
- import type { BaseLogger, BasicPeerConnection } from '../types';
6
+ import type { ServerCameraDeviceBase as CameraDevice } from '../base/base.server';
7
+ import type { BaseLogger } from '../types';
8
+ export interface BasicPeerConnection {
9
+ createOffer(): Promise<RTCSessionDescription>;
10
+ acceptAnswer(answer: {
11
+ type: 'answer';
12
+ sdp: string;
13
+ }): Promise<void>;
14
+ addIceCandidate(candidate: Partial<WeriftRTCICECandidate>): Promise<void>;
15
+ onIceCandidate: Subject<WeriftRTCICECandidate>;
16
+ onConnectionState: Observable<ConnectionState>;
17
+ close(): void;
18
+ requestKeyFrame?: () => void;
19
+ }
20
+ export interface StreamingConnectionOptions {
21
+ createPeerConnection?: () => BasicPeerConnection;
22
+ }
8
23
  export declare class WeriftPeerConnection extends Subscribed implements BasicPeerConnection {
9
24
  onAudioRtp: Subject<RtpPacket>;
10
25
  onAudioRtcp: Subject<RtcpPacket>;
11
26
  onVideoRtp: Subject<RtpPacket>;
12
27
  onVideoRtcp: Subject<RtcpPacket>;
13
- onIceCandidate: Subject<RTCIceCandidate>;
14
- onConnectionState: ReplaySubject<"closed" | "failed" | "disconnected" | "new" | "connecting" | "connected">;
28
+ onIceCandidate: Subject<WeriftRTCICECandidate>;
29
+ onConnectionState: ReplaySubject<"closed" | "connected" | "connecting" | "disconnected" | "failed" | "new">;
15
30
  returnAudioTrack: MediaStreamTrack;
16
31
  private onRequestKeyFrame;
17
32
  private cameraDevice;
@@ -1,7 +1,7 @@
1
1
  import { ReplaySubject, Subject } from 'rxjs';
2
2
  import { RtpPacket } from 'werift';
3
3
  import { Subscribed } from '../utils/subscribed';
4
- import type { ServerCameraDeviceBase as CameraDevice } from '../base';
4
+ import type { ServerCameraDeviceBase as CameraDevice } from '../base/base.server';
5
5
  import type { BaseLogger, FfmpegOptions, SpawnInput } from '../types';
6
6
  import type { WebrtcConnection } from './webrtc-connection';
7
7
  export declare class StreamingSession extends Subscribed {
@@ -2,8 +2,9 @@ import { ReplaySubject, Subject, type Observable } from 'rxjs';
2
2
  import { Subscribed } from '../utils/subscribed';
3
3
  import type { RtpPacket } from 'werift';
4
4
  import type { IceServer } from '../../services/config/types';
5
- import type { ServerCameraDeviceBase as CameraDevice } from '../base';
6
- import type { BaseLogger, StreamingConnectionOptions } from '../types';
5
+ import type { ServerCameraDeviceBase as CameraDevice } from '../base/base.server';
6
+ import type { BaseLogger } from '../types';
7
+ import type { StreamingConnectionOptions } from './peer-connection';
7
8
  export declare class WebrtcConnection extends Subscribed {
8
9
  readonly onCameraConnected: ReplaySubject<void>;
9
10
  readonly onCallAnswered: ReplaySubject<string>;
@@ -1,6 +1,5 @@
1
1
  /// <reference types="node" />
2
2
  import type { Observable, Subject } from 'rxjs';
3
- import type { ConnectionState, RTCSessionDescription, RTCIceCandidate as WeriftRTCICECandidate } from 'werift';
4
3
  import type { CameraInformation, CameraInput, CameraInputSettings } from '../api/database/types';
5
4
  export type SpawnInput = string | number;
6
5
  export type PrebufferType = 'recording' | 'stream';
@@ -22,21 +21,6 @@ export interface FfmpegOptions {
22
21
  audio?: SpawnInput[];
23
22
  output: SpawnInput[];
24
23
  }
25
- export interface StreamingConnectionOptions {
26
- createPeerConnection?: () => BasicPeerConnection;
27
- }
28
- export interface BasicPeerConnection {
29
- createOffer(): Promise<RTCSessionDescription>;
30
- acceptAnswer(answer: {
31
- type: 'answer';
32
- sdp: string;
33
- }): Promise<void>;
34
- addIceCandidate(candidate: Partial<WeriftRTCICECandidate>): Promise<void>;
35
- onIceCandidate: Subject<WeriftRTCICECandidate>;
36
- onConnectionState: Observable<ConnectionState>;
37
- close(): void;
38
- requestKeyFrame?: () => void;
39
- }
40
24
  export interface BasicBrowserPeerConnection {
41
25
  enableMicrophone(track: MediaStreamTrack): void;
42
26
  disableMicrophone(): void;
@@ -1,12 +1,12 @@
1
1
  export * from '../../server/src/api/database/types';
2
2
  export * from '../../server/src/api/types';
3
3
  export * from '../../server/src/api/ws/types';
4
- export * from '../../server/src/camera/base';
4
+ export * from '../../server/src/camera/base/base.browser';
5
5
  export * from '../../server/src/camera/streaming/browser/browser-streaming-session';
6
6
  export * from '../../server/src/camera/streaming/browser/webrtc-browser-connection';
7
7
  export * from '../../server/src/camera/types';
8
8
  export * from '../../server/src/detector/types';
9
9
  export * from '../../server/src/go2rtc/types';
10
10
  export * from '../../server/src/plugins/types';
11
+ export * from '../../server/src/proxy/types';
11
12
  export * from '../../server/src/services/config/types';
12
- export * from '../../server/src/test/types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camera.ui/browser",
3
- "version": "0.0.52",
3
+ "version": "0.0.54",
4
4
  "description": "camera.ui browser client",
5
5
  "author": "seydx (https://github.com/seydx/camera.ui)",
6
6
  "module": "./dist/bundle.js",