@3deye-toolkit/react-camera 0.0.1 → 0.0.3-alpha.0

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,3 @@
1
- /// <reference types="react" />
2
-
3
1
  import type { IReactionDisposer } from 'mobx';
4
2
  import { Observable } from 'rxjs';
5
3
  import { default as React_2 } from 'react';
@@ -43,7 +41,7 @@ declare interface Box {
43
41
  Right: number;
44
42
  }
45
43
 
46
- export declare const BoxSelector: (({ onSelect, onRequestCancel, onClose }: Props_2) => JSX.Element) & {
44
+ export declare const BoxSelector: (({ onSelect, onRequestCancel, onClose }: Props_2) => React_2.JSX.Element) & {
47
45
  displayName: string;
48
46
  };
49
47
 
@@ -53,10 +51,7 @@ export declare class Camera {
53
51
  imageUrl: string;
54
52
  streamUrl: string;
55
53
  dashStreamUrl: string;
56
- address: {
57
- Lat: number;
58
- Lng: number;
59
- } | null;
54
+ address: CameraAddress | null;
60
55
  archiveDuration: number;
61
56
  dvrWindowLength: number;
62
57
  stateUpdatedAt: Date;
@@ -72,9 +67,10 @@ export declare class Camera {
72
67
  get supportsWebRTC(): boolean;
73
68
  constructor(raw: RawCamera);
74
69
  update: (raw: RawCamera) => void;
70
+ can: (permission: CameraPermissions) => number;
75
71
  }
76
72
 
77
- declare const Camera_2: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<Pick<Props & React_2.RefAttributes<HTMLDivElement>, "key" | keyof Props> & React_2.RefAttributes<HTMLDivElement>>>;
73
+ declare const Camera_2: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<Omit<Props & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>>;
78
74
  export default Camera_2;
79
75
 
80
76
  declare interface Camera_3 {
@@ -96,6 +92,26 @@ declare interface Camera_3 {
96
92
  archiveDuration: number;
97
93
  permissions: number;
98
94
  raw: RawCamera;
95
+ can: (permission: CameraPermissions) => number;
96
+ }
97
+
98
+ declare interface CameraAddress {
99
+ Lat: number;
100
+ Lng: number;
101
+ Country: string;
102
+ State: string;
103
+ City: string;
104
+ Address: string;
105
+ }
106
+
107
+ declare const enum CameraPermissions {
108
+ View = 1,
109
+ SaveClip = 2,
110
+ Share = 4,
111
+ Ptz = 8,
112
+ EditSettings = 16,
113
+ Timelapse = 32,
114
+ Delete = 64
99
115
  }
100
116
 
101
117
  declare interface CameraStatistics {
@@ -137,6 +153,7 @@ declare interface Clip {
137
153
  duration: number;
138
154
  clipUrl?: string;
139
155
  name: string;
156
+ archives?: ArchiveChunk[];
140
157
  }
141
158
 
142
159
  declare class Clip_2 {
@@ -160,36 +177,35 @@ declare class Clip_2 {
160
177
  archives?: ArchiveChunk_2[];
161
178
  constructor(raw: RawClip);
162
179
  get isTimelapse(): boolean;
163
- update(raw: any): void;
180
+ update(raw: RawClip): void;
164
181
  }
165
182
 
166
183
  export declare const CloseControl: {
167
- ({ onClick }: Props_4): JSX.Element | null;
184
+ ({ onClick }: Props_4): React_2.JSX.Element | null;
168
185
  displayName: string;
169
186
  };
170
187
 
171
188
  export declare const Control: React_2.FC<Props_5>;
172
189
 
173
- export declare class Controls extends React_2.Component<Props_6> {
174
- get player(): PlayerController;
175
- static contextType: React_2.Context<PlayerController>;
176
- static Spacer: React_2.FC;
177
- containerRef: React_2.RefObject<HTMLDivElement>;
178
- mutationObserver: MutationObserver;
179
- resizeReactionDisposer: IReactionDisposer;
180
- componentDidUpdate(): void;
181
- componentDidMount(): void;
182
- reflow: () => void;
183
- componentWillUnmount(): void;
184
- render(): JSX.Element;
185
- }
186
-
187
- export declare const DefaultControls: (({ onRequestClose, fullscreenControl }: Props_8) => JSX.Element) & {
190
+ export declare function Controls({ style, children }: Props_6): React_2.JSX.Element;
191
+
192
+ export declare namespace Controls {
193
+ var Spacer: () => React_2.JSX.Element;
194
+ }
195
+
196
+ export declare const DefaultControls: (({ onRequestClose, fullscreenControl }: Props_8) => React_2.JSX.Element) & {
188
197
  displayName: string;
189
198
  };
190
199
 
200
+ declare class ErrorBase<T extends string> extends Error {
201
+ name: T;
202
+ message: string;
203
+ cause?: any;
204
+ constructor(name: T, message: string, cause?: any);
205
+ }
206
+
191
207
  export declare const FullscreenControl: {
192
- ({ toggle: toggle, active }: Props_7): JSX.Element;
208
+ ({ toggle: toggle, active }: Props_7): React_2.JSX.Element;
193
209
  displayName: string;
194
210
  };
195
211
 
@@ -216,17 +232,17 @@ declare class LiveChunk {
216
232
  setBounds: (range: [Date, Date]) => void;
217
233
  }
218
234
 
219
- export declare const PlaybackRateControl: (() => JSX.Element | null) & {
235
+ export declare const PlaybackRateControl: (() => React_2.JSX.Element | null) & {
220
236
  displayName: string;
221
237
  };
222
238
 
223
- export declare const Player: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<Pick<Props_3 & React_2.RefAttributes<HTMLDivElement>, "key" | keyof Props_3> & React_2.RefAttributes<HTMLDivElement>>>;
239
+ export declare const Player: React_2.MemoExoticComponent<React_2.ForwardRefExoticComponent<Omit<Props_3 & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>>;
224
240
 
225
241
  declare interface PlayerBehavior {
226
242
  state: PlayerState | null;
227
243
  player: PlayerController;
228
244
  loading: boolean;
229
- error: any;
245
+ error: PlayerError | null;
230
246
  delay?: number;
231
247
  live?: boolean;
232
248
  seek?: (time: Date) => void;
@@ -246,7 +262,7 @@ export declare class PlayerController {
246
262
  targetTime: Date | null;
247
263
  chunk: ArchiveChunk | LiveChunk | null;
248
264
  paused: boolean;
249
- error: any;
265
+ error: PlayerError | null;
250
266
  get loading(): boolean;
251
267
  playbackRate: number;
252
268
  volume: number;
@@ -356,6 +372,11 @@ export declare class PlayerController {
356
372
  private initUpgradeToWebRtcAfterFallbackToDvr;
357
373
  }
358
374
 
375
+ declare class PlayerError extends ErrorBase<PlayerErrorType> {
376
+ }
377
+
378
+ declare type PlayerErrorType = 'PLAYER_ERROR' | 'MEDIA_ERROR' | 'STREAMING_ERROR' | 'CAMERA_OFFLINE_ERROR' | 'PLAYBACK_TIMEOUT_ERROR' | 'CONNECTION_TIMEOUT_ERROR' | 'NO_PLAYABLE_STREAM_ERROR' | 'NO_VIDEO_TRACK_ERROR';
379
+
359
380
  declare interface PlayerEventStreams {
360
381
  canSeek$: Observable<any>;
361
382
  progress$: Observable<any>;
@@ -366,6 +387,7 @@ declare interface PlayerEventStreams {
366
387
 
367
388
  declare enum PlayerState {
368
389
  Initial = "initial",
390
+ InitiallyPaused = "initially-paused",
369
391
  Playing = "playing",
370
392
  Paused = "paused",
371
393
  Reconnecting = "reconnecting",
@@ -374,7 +396,7 @@ declare enum PlayerState {
374
396
  Failed = "failed"
375
397
  }
376
398
 
377
- export declare const PlayPauseControl: (() => JSX.Element) & {
399
+ export declare const PlayPauseControl: (() => React_2.JSX.Element) & {
378
400
  displayName: string;
379
401
  };
380
402
 
@@ -433,7 +455,7 @@ declare interface Props_8 {
433
455
  fullscreenControl?: React_2.ReactNode;
434
456
  }
435
457
 
436
- export declare const PtzControls: ((props: PtzControlsProps) => JSX.Element) & {
458
+ export declare const PtzControls: ((props: PtzControlsProps) => React_2.JSX.Element) & {
437
459
  displayName: string;
438
460
  };
439
461
 
@@ -506,7 +528,7 @@ declare interface RawCamera {
506
528
 
507
529
  declare interface RawClip {
508
530
  id: number;
509
- recordType: string;
531
+ recordType: 'Archive' | 'Timelaps' | 'Timelaps to do';
510
532
  isReady: boolean;
511
533
  name: string;
512
534
  description: string;
@@ -523,11 +545,14 @@ declare interface RawClip {
523
545
  version: string;
524
546
  }
525
547
 
526
- export declare const ResizeModeControl: (() => JSX.Element) & {
548
+ export declare const ResizeModeControl: (() => React_2.JSX.Element) & {
527
549
  displayName: string;
528
550
  };
529
551
 
530
- export declare const SnapshotControl: React_2.FC;
552
+ export declare const SnapshotControl: {
553
+ (): React_2.JSX.Element;
554
+ displayName: string;
555
+ };
531
556
 
532
557
  export declare function useFullscreen(): {
533
558
  ref: (node: HTMLElement | null) => void;
@@ -541,7 +566,7 @@ declare enum VideoResizeMode {
541
566
  Stretch = "fill"
542
567
  }
543
568
 
544
- export declare const VolumeControl: (() => JSX.Element) & {
569
+ export declare const VolumeControl: (() => React_2.JSX.Element) & {
545
570
  displayName: string;
546
571
  };
547
572