@3deye-toolkit/react-camera 0.0.1-alpha.20 → 0.0.1-alpha.23
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/react-camera.css +214 -135
- package/dist/react-camera.d.ts +138 -36
- package/dist/react-camera.js +2 -2
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +17 -17
package/dist/react-camera.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
|
|
2
3
|
import { BehaviorSubject } from 'rxjs';
|
|
3
4
|
import crossfilter from 'crossfilter2';
|
|
4
|
-
import { IReactionDisposer } from 'mobx';
|
|
5
|
+
import type { IReactionDisposer } from 'mobx';
|
|
5
6
|
import { Observable } from 'rxjs';
|
|
6
7
|
import { default as React_2 } from 'react';
|
|
7
8
|
import { Subject } from 'rxjs';
|
|
@@ -77,6 +78,7 @@ declare class ArchiveChunk_2 implements Chunk_2 {
|
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
declare class ArchivesStore extends ApiStore {
|
|
81
|
+
private camerasStore;
|
|
80
82
|
data: crossfilter.Crossfilter<ArchiveChunk_2>;
|
|
81
83
|
chunksByCameraId: crossfilter.Dimension<ArchiveChunk_2, number>;
|
|
82
84
|
chunksByStart: crossfilter.Dimension<ArchiveChunk_2, number>;
|
|
@@ -88,22 +90,47 @@ declare class ArchivesStore extends ApiStore {
|
|
|
88
90
|
private pendingRequestsByCameraId;
|
|
89
91
|
knownIntervals: Map<number, [Date, Date]>;
|
|
90
92
|
updates: number;
|
|
91
|
-
constructor();
|
|
93
|
+
constructor(camerasStore: CamerasStore);
|
|
92
94
|
/**
|
|
93
95
|
* Fetches archive chunks for given camera and period
|
|
94
96
|
* @param cameraId - camera id
|
|
95
97
|
* @param startTime - start of the period
|
|
96
98
|
* @param endTime - end of the period
|
|
97
99
|
* TODO: add support for null endTime in order to remove requestedArchivesSince logic from player controller
|
|
100
|
+
* TODO: add error handling
|
|
98
101
|
*/
|
|
99
102
|
fetch(cameraId: number, startTime: Date, endTime: Date): Observable<ArchiveChunk_2[]>;
|
|
100
|
-
extendKnownInterval(cameraId: number, chunks: ArchiveChunk_2[]): void;
|
|
103
|
+
extendKnownInterval(cameraId: number, startTime: Date, chunks: ArchiveChunk_2[]): void;
|
|
101
104
|
add(chunks: ArchiveChunk_2[]): void;
|
|
102
105
|
getChunks({ cameraId, from, to }: ChunksQuery): ArchiveChunk_2[];
|
|
103
|
-
|
|
106
|
+
/**
|
|
107
|
+
* Returns chunk that either contain the given time or is right adjacent to it
|
|
108
|
+
* @param camera - camera id
|
|
109
|
+
* @param time - time to search for
|
|
110
|
+
* @returns ArchiveChunk or undefined if there is no such chunk in the current archive
|
|
111
|
+
*/
|
|
112
|
+
getClosestChunkRight: ({ cameraId, time }: {
|
|
113
|
+
cameraId: number;
|
|
114
|
+
time: Date;
|
|
115
|
+
}) => ArchiveChunk_2;
|
|
116
|
+
/**
|
|
117
|
+
* Return chunks that either contain the given time or is left adjacent to it
|
|
118
|
+
* @param camera - camera id
|
|
119
|
+
* @param time - time to search for
|
|
120
|
+
* @returns ArchiveChunk or undefined if there is no such chunk in the current archive
|
|
121
|
+
*/
|
|
122
|
+
getClosestChunkLeft: ({ cameraId, time }: {
|
|
123
|
+
cameraId: number;
|
|
124
|
+
time: Date;
|
|
125
|
+
}) => ArchiveChunk_2;
|
|
126
|
+
fetchNextChunk: ({ cameraId, time }: {
|
|
127
|
+
cameraId: number;
|
|
128
|
+
time: Date;
|
|
129
|
+
}) => Observable<ArchiveChunk_2 | undefined>;
|
|
130
|
+
fetchPrevChunk: ({ cameraId, time }: {
|
|
104
131
|
cameraId: number;
|
|
105
132
|
time: Date;
|
|
106
|
-
})
|
|
133
|
+
}) => Observable<ArchiveChunk_2 | undefined>;
|
|
107
134
|
protected afterInit(): void;
|
|
108
135
|
}
|
|
109
136
|
|
|
@@ -113,31 +140,30 @@ declare class Auth {
|
|
|
113
140
|
storage: Storage_2;
|
|
114
141
|
tokenServiceUrl: string;
|
|
115
142
|
tokenStorageKey: string;
|
|
116
|
-
widgetTokenServiceUrl?: string;
|
|
117
143
|
deviceInfo: string | null;
|
|
118
144
|
clientId: string;
|
|
119
145
|
private pendingUpdateTokenRequest;
|
|
120
146
|
get isAuthenticated(): boolean;
|
|
121
|
-
constructor({ tokenServiceUrl,
|
|
147
|
+
constructor({ tokenServiceUrl, storage, tokenStorageKey, deviceInfo, clientId }: AuthStoreOptions);
|
|
122
148
|
signOut: () => void;
|
|
123
|
-
signIn: (
|
|
149
|
+
signIn: (options: {
|
|
124
150
|
username: string;
|
|
125
151
|
password: string;
|
|
126
|
-
|
|
127
|
-
agreedWithTerms?: boolean
|
|
152
|
+
replaceToken?: string;
|
|
153
|
+
agreedWithTerms?: boolean;
|
|
154
|
+
code?: string;
|
|
128
155
|
}) => Promise<Token> | undefined;
|
|
129
156
|
invalidateToken: () => void;
|
|
130
157
|
getTokenFromStorage(): Promise<Token | null>;
|
|
131
158
|
private storeToken;
|
|
132
159
|
private getInitialToken;
|
|
133
|
-
private
|
|
160
|
+
private fetchToken;
|
|
134
161
|
private updateToken;
|
|
135
162
|
private fetchWidgetToken;
|
|
136
163
|
}
|
|
137
164
|
|
|
138
165
|
declare interface AuthStoreOptions {
|
|
139
166
|
tokenServiceUrl: string;
|
|
140
|
-
widgetTokenServiceUrl?: string;
|
|
141
167
|
storage: Storage_2;
|
|
142
168
|
tokenStorageKey: string;
|
|
143
169
|
deviceInfo: any;
|
|
@@ -157,12 +183,39 @@ export declare const BoxSelector: (({ onSelect, onRequestCancel, onClose }: Prop
|
|
|
157
183
|
displayName: string;
|
|
158
184
|
};
|
|
159
185
|
|
|
160
|
-
declare
|
|
186
|
+
export declare class Camera {
|
|
187
|
+
id: number;
|
|
188
|
+
name: string;
|
|
189
|
+
imageUrl: string;
|
|
190
|
+
streamUrl: string;
|
|
191
|
+
dashStreamUrl: string;
|
|
192
|
+
address: {
|
|
193
|
+
Lat: number;
|
|
194
|
+
Lng: number;
|
|
195
|
+
} | null;
|
|
196
|
+
archiveDuration: number;
|
|
197
|
+
dvrWindowLength: number;
|
|
198
|
+
stateUpdatedAt: Date;
|
|
199
|
+
raw: RawCamera;
|
|
200
|
+
enabled: boolean;
|
|
201
|
+
isMicEnabled: boolean;
|
|
202
|
+
state: string;
|
|
203
|
+
pin: string;
|
|
204
|
+
webRtcUrl: string;
|
|
205
|
+
isPtz: boolean;
|
|
206
|
+
permissions: number;
|
|
207
|
+
get isOnline(): boolean;
|
|
208
|
+
get supportsWebRTC(): boolean;
|
|
209
|
+
constructor(raw: RawCamera);
|
|
210
|
+
update: (raw: RawCamera) => void;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
declare const Camera_2: ((props: Props) => JSX.Element) & {
|
|
161
214
|
displayName: string;
|
|
162
215
|
};
|
|
163
|
-
export default
|
|
216
|
+
export default Camera_2;
|
|
164
217
|
|
|
165
|
-
declare interface
|
|
218
|
+
declare interface Camera_3 {
|
|
166
219
|
id: number;
|
|
167
220
|
name: string;
|
|
168
221
|
streamUrl: string;
|
|
@@ -179,9 +232,23 @@ declare interface Camera_2 {
|
|
|
179
232
|
Lng: number;
|
|
180
233
|
} | null;
|
|
181
234
|
archiveDuration: number;
|
|
235
|
+
permissions: number;
|
|
182
236
|
raw: RawCamera;
|
|
183
237
|
}
|
|
184
238
|
|
|
239
|
+
declare class CamerasStore extends ApiStore {
|
|
240
|
+
camerasById: Map<number, Camera>;
|
|
241
|
+
data: Camera[];
|
|
242
|
+
loading: boolean;
|
|
243
|
+
loaded: boolean;
|
|
244
|
+
constructor();
|
|
245
|
+
load: () => Observable<RawCamera[]> | undefined;
|
|
246
|
+
add: (cameras: RawCamera[]) => void;
|
|
247
|
+
sync: () => Observable<RawCamera[]>;
|
|
248
|
+
protected afterInit(): void;
|
|
249
|
+
dispose(): void;
|
|
250
|
+
}
|
|
251
|
+
|
|
185
252
|
declare interface CameraStatistics {
|
|
186
253
|
id: number;
|
|
187
254
|
month: number;
|
|
@@ -271,7 +338,7 @@ export declare class Controls extends React_2.Component<Props_5> {
|
|
|
271
338
|
static Spacer: React_2.FC;
|
|
272
339
|
containerRef: React_2.RefObject<HTMLDivElement>;
|
|
273
340
|
mutationObserver: MutationObserver;
|
|
274
|
-
resizeReactionDisposer:
|
|
341
|
+
resizeReactionDisposer: IReactionDisposer;
|
|
275
342
|
componentDidUpdate(): void;
|
|
276
343
|
componentDidMount(): void;
|
|
277
344
|
reflow: () => void;
|
|
@@ -333,6 +400,9 @@ declare interface IApi {
|
|
|
333
400
|
GetCameras: (camera: {
|
|
334
401
|
id?: number;
|
|
335
402
|
} | null, since: Date | null) => Observable<ApiResult<RawCamera>>;
|
|
403
|
+
/**
|
|
404
|
+
* @deprecated
|
|
405
|
+
*/
|
|
336
406
|
GetMotionEvents: (params: {
|
|
337
407
|
cameraId: number;
|
|
338
408
|
endTime: Date | null;
|
|
@@ -346,6 +416,12 @@ declare interface IApi {
|
|
|
346
416
|
MoveCamera: (camera: {
|
|
347
417
|
id: number;
|
|
348
418
|
}, x: number, y: number, zoom: number, moveSpeed: number, zoomSpeed: number) => Observable<any>;
|
|
419
|
+
MoveCameraContinuousStart: ({ id }: {
|
|
420
|
+
id: number;
|
|
421
|
+
}, x: number, y: number, zoom: number, timeout: number) => Observable<any>;
|
|
422
|
+
MoveCameraContinuousStop: ({ id }: {
|
|
423
|
+
id: number;
|
|
424
|
+
}) => Observable<any>;
|
|
349
425
|
GoHomePtzCamera: ({ id }: {
|
|
350
426
|
id: number;
|
|
351
427
|
}) => Observable<any>;
|
|
@@ -453,6 +529,7 @@ declare class PlayerController {
|
|
|
453
529
|
disposables: (IReactionDisposer | Subscription)[];
|
|
454
530
|
liveChunk?: LiveChunk | null;
|
|
455
531
|
currentTime: Date | null;
|
|
532
|
+
targetTime: Date | null;
|
|
456
533
|
chunk: ArchiveChunk | LiveChunk | null;
|
|
457
534
|
paused: boolean;
|
|
458
535
|
loading: boolean;
|
|
@@ -461,14 +538,17 @@ declare class PlayerController {
|
|
|
461
538
|
volume: number;
|
|
462
539
|
muted: boolean;
|
|
463
540
|
videoResizeMode: VideoResizeMode;
|
|
464
|
-
camera:
|
|
541
|
+
camera: Camera_3;
|
|
465
542
|
stats: any;
|
|
466
543
|
mode: 'archive' | 'DVR' | 'WebRTC' | null;
|
|
467
544
|
behavior: PlayerBehavior | null;
|
|
545
|
+
transform: string | null;
|
|
468
546
|
width: number;
|
|
469
547
|
height: number;
|
|
470
|
-
|
|
471
|
-
|
|
548
|
+
chunkRequest: {
|
|
549
|
+
time: Date;
|
|
550
|
+
backward: boolean;
|
|
551
|
+
} | null;
|
|
472
552
|
archivesRequest: Observable<ArchiveChunk[]>;
|
|
473
553
|
video: HTMLVideoElement;
|
|
474
554
|
clip?: Clip;
|
|
@@ -489,7 +569,7 @@ declare class PlayerController {
|
|
|
489
569
|
};
|
|
490
570
|
seekTime?: Date | null;
|
|
491
571
|
constructor({ camera, startTime, endTime, clip, archivesStore, behaviors }: {
|
|
492
|
-
camera:
|
|
572
|
+
camera: Camera_3;
|
|
493
573
|
clip?: Clip;
|
|
494
574
|
startTime?: Date | null;
|
|
495
575
|
endTime?: Date;
|
|
@@ -505,23 +585,40 @@ declare class PlayerController {
|
|
|
505
585
|
seekAfterReady(): void;
|
|
506
586
|
stopLoadingOnError(): void;
|
|
507
587
|
replaceErrorMessageOnOffline(): void;
|
|
508
|
-
changeMedia: ({ time, chunk }: {
|
|
509
|
-
time
|
|
588
|
+
changeMedia: ({ time, chunk, backward }: {
|
|
589
|
+
time: Date;
|
|
510
590
|
chunk?: LiveChunk | ArchiveChunk | undefined;
|
|
591
|
+
backward?: boolean | undefined;
|
|
511
592
|
}) => void;
|
|
512
593
|
initCurrentTime(): void;
|
|
594
|
+
/**
|
|
595
|
+
* If the chunk after chunk request is the same as the current chunk,
|
|
596
|
+
* then we can dismiss loading indicator and seek.
|
|
597
|
+
*/
|
|
598
|
+
initSameChunkRequestFix(): void;
|
|
513
599
|
initLiveChunkUpdate(): void;
|
|
514
600
|
initChunkRequest(): void;
|
|
515
|
-
requestArchives: (time: Date) => Observable<ArchiveChunk[]>;
|
|
516
601
|
setupLiveChunk(): void;
|
|
517
602
|
/**
|
|
518
603
|
* Inits correct behavior for current player mode
|
|
519
604
|
*/
|
|
520
605
|
initPlayerBehavior(): void;
|
|
606
|
+
/**
|
|
607
|
+
* Rewind by given amount of milliseconds
|
|
608
|
+
* @param value milliseconds
|
|
609
|
+
* @returns
|
|
610
|
+
*/
|
|
611
|
+
seekBackward: (value: number) => void;
|
|
612
|
+
/**
|
|
613
|
+
* Seek forward by given amount of milliseconds
|
|
614
|
+
* @param value
|
|
615
|
+
* @returns
|
|
616
|
+
*/
|
|
617
|
+
seekForward: (value: number) => void;
|
|
521
618
|
goLive: () => void;
|
|
522
619
|
fallbackToDVR: () => void;
|
|
523
|
-
setCamera: (camera:
|
|
524
|
-
setCameraAndStartTime: (camera:
|
|
620
|
+
setCamera: (camera: Camera_3) => void;
|
|
621
|
+
setCameraAndStartTime: (camera: Camera_3, startTime: Date | null) => void;
|
|
525
622
|
toggleResizeMode: () => void;
|
|
526
623
|
setVideoResizeMode: (mode: VideoResizeMode) => void;
|
|
527
624
|
toggleMute: () => void;
|
|
@@ -530,6 +627,7 @@ declare class PlayerController {
|
|
|
530
627
|
setPlaybackRate: (rate: number) => void;
|
|
531
628
|
reactToVolumeChange(): void;
|
|
532
629
|
togglePlayback: () => void;
|
|
630
|
+
setTransform(transform: string | null): void;
|
|
533
631
|
play: () => void;
|
|
534
632
|
pause: () => void;
|
|
535
633
|
detach: () => void;
|
|
@@ -572,6 +670,7 @@ declare type Props_4 = React_2.HTMLAttributes<HTMLButtonElement> & {
|
|
|
572
670
|
|
|
573
671
|
declare interface Props_5 {
|
|
574
672
|
children: React_2.ReactNode;
|
|
673
|
+
style?: React_2.CSSProperties;
|
|
575
674
|
}
|
|
576
675
|
|
|
577
676
|
declare interface Props_6 {
|
|
@@ -704,29 +803,32 @@ declare interface RawSharedClip {
|
|
|
704
803
|
validTo: string | Date;
|
|
705
804
|
}
|
|
706
805
|
|
|
707
|
-
declare
|
|
708
|
-
access_token: string;
|
|
806
|
+
declare type RawToken = {
|
|
709
807
|
accessToken: string;
|
|
710
|
-
access_token_expires: string;
|
|
711
808
|
accessTokenExpires: string;
|
|
712
|
-
access_token_issued: string;
|
|
713
809
|
accessTokenIssued: string;
|
|
714
|
-
client_id: string;
|
|
715
810
|
clientId: string;
|
|
716
|
-
expires_in: number;
|
|
717
811
|
expiresIn: number;
|
|
718
|
-
refresh_token: string;
|
|
719
812
|
refreshToken: string;
|
|
720
|
-
refresh_token_expires: string;
|
|
721
813
|
refreshTokenExpires: string;
|
|
722
|
-
refresh_token_issued: string;
|
|
723
814
|
refreshTokenIssued: string;
|
|
724
|
-
token_type: string;
|
|
725
815
|
tokenType: string;
|
|
726
816
|
userName: string;
|
|
817
|
+
} & {
|
|
818
|
+
access_token: string;
|
|
819
|
+
access_token_expires: string;
|
|
820
|
+
access_token_issued: string;
|
|
821
|
+
client_id: string;
|
|
822
|
+
expires_in: number;
|
|
823
|
+
refresh_token: string;
|
|
824
|
+
refresh_token_expires: string;
|
|
825
|
+
refresh_token_issued: string;
|
|
826
|
+
token_type: string;
|
|
827
|
+
userName: string;
|
|
828
|
+
} & {
|
|
727
829
|
widgetId?: string;
|
|
728
830
|
widgetToken?: string;
|
|
729
|
-
}
|
|
831
|
+
};
|
|
730
832
|
|
|
731
833
|
declare interface RawUser {
|
|
732
834
|
id: number;
|