import type { IReactionDisposer } from 'mobx'; import { JSX } from 'react/jsx-runtime'; import { Matrix } from 'transformation-matrix'; import { Observable } from 'rxjs'; import { default as React_2 } from 'react'; import { Ref } from 'react'; import { Subscription } from 'rxjs'; declare type ArchiveChunk = Chunk & { isLive: false; }; declare class ArchiveChunk_2 implements Chunk_2 { json?: string; startTime: Date; endTime: Date; streamUrl: string; duration?: number; isLive: false; cameraId: number; id: number; constructor(raw: Pick & Partial>); } declare interface ArchivesStore { fetchPrevChunk: (params: { cameraId: number; time: Date; }) => Observable; fetchNextChunk: (params: { cameraId: number; time: Date; }) => Observable; getChunks: (query: ChunksQuery) => ArchiveChunk[]; } declare type BehaviorFactory = (controller: PlayerController) => PlayerBehavior; declare interface Box { Top: number; Left: number; Bottom: number; Right: number; } export declare const BoxSelector: (({ onSelect, onRequestCancel, onClose }: Props_3) => JSX.Element) & { displayName: string; }; export declare class Camera { id: number; name: string; imageUrl: string; streamUrl: string; dashStreamUrl: string; address: CameraAddress | null; archiveDuration: number; dvrWindowLength: number; stateUpdatedAt: Date; raw: RawCamera; enabled: boolean; isMicEnabled: boolean; state: string; pin: string; webRtcUrl: string; isPtz: boolean; permissions: number; get isOnline(): boolean; get supportsWebRTC(): boolean; constructor(raw: RawCamera); update: (raw: RawCamera) => void; can: (permission: CameraPermissions) => boolean; } declare interface Camera_2 { id: number; name: string; streamUrl: string; dashStreamUrl: string; webRtcUrl: string; pin: string; dvrWindowLength: number; enabled: boolean; isOnline: boolean; isPtz: boolean; isMicEnabled: boolean; address?: { Lat: number; Lng: number; } | null; archiveDuration: number; permissions: number; raw: RawCamera; imageUrl: string; stateUpdatedAt: Date; state: string; supportsWebRTC: boolean; update: (raw: RawCamera) => void; can: (permission: CameraPermissions) => boolean; } declare interface CameraAddress { Lat: number; Lng: number; Country: string; State: string; City: string; Address: string; } declare const enum CameraPermissions { View = 1, SaveClip = 2, Share = 4, Ptz = 8, EditSettings = 16, Timelapse = 32, Delete = 64 } /** * Camera player component */ declare const CameraPlayer: React_2.MemoExoticComponent, "ref"> & React_2.RefAttributes>>; export { CameraPlayer } export default CameraPlayer; declare interface CameraStatistics { id: number; month: number; trafficOutMBytes: number; archiveStorageMBytes: number; clipStorageMBytes: number; } declare interface Chunk { startTime: Date; endTime: Date; streamUrl: string; duration?: number; cameraId: number; } declare interface Chunk_2 { json?: string; startTime: Date; endTime: Date; streamUrl: string; duration?: number; } declare interface ChunksQuery { cameraId: number; from: Date; to: Date; } declare interface Clip { id: number; cameraId: number; startTime: Date; endTime: Date; isTimelapse: boolean; duration: number; clipUrl?: string; name: string; archives?: ArchiveChunk[]; } declare class Clip_2 { id: number; cameraId: number; name: string; startTime: Date; endTime: Date; type: 'Archive' | 'Timelaps' | 'Timelaps to do'; createdAt: Date; /** * clip duration in seconds */ duration: number; chunks: ArchiveChunk_2[]; clipUrl?: string; description: string; version: string; raw: RawClip; isDownloading: boolean; archives?: ArchiveChunk_2[]; constructor(raw: RawClip); get isTimelapse(): boolean; update(raw: RawClip): void; } export declare const CloseControl: { ({ onClick }: Props_4): JSX.Element | null; displayName: string; }; export declare const Control: React_2.ForwardRefExoticComponent & React_2.RefAttributes>; export declare function Controls({ style, children }: Props_6): JSX.Element; export declare namespace Controls { var Spacer: () => JSX.Element; } export declare const DefaultControls: (({ onRequestClose, fullscreenControl }: Props_8) => JSX.Element) & { displayName: string; }; declare class ErrorBase extends Error { name: T; message: string; cause?: unknown; constructor(name: T, message: string, cause?: unknown); } export declare const FullscreenControl: { ({ toggle, active }: Props_7): JSX.Element; displayName: string; }; declare class LiveChunk { cameraId: number; streamUrl: string; dashStreamUrl: string; startTime: Date; endTime: Date; length: number; isLive: boolean; isDvr: boolean; hasDvr: boolean; rtmpStreamUrl: string; managed: boolean; constructor(data: { cameraId: number; endTime: Date; startTime: Date; streamUrl: string; dashStreamUrl: string; length: number; }); setBounds: (range: [Date, Date]) => void; } export declare const PlaybackRateControl: (() => JSX.Element | null) & { displayName: string; }; export declare const Player: React_2.MemoExoticComponent, "ref"> & React_2.RefAttributes>>; declare interface PlayerBehavior { state: PlayerState | null; player: PlayerController; loading: boolean; error: PlayerError | null; delay?: number; live?: boolean; seek?: (time: Date) => void; goLive?: () => void; getCurrentTime: () => Date | null; getDateRange?: () => [Date, Date] | null; dispose: () => Promise | void; } export declare const PlayerContext: React_2.Context; export declare class PlayerController { id: number; disposables: (IReactionDisposer | Subscription)[]; liveChunk?: LiveChunk | null; currentTime: Date | null; targetTime: Date | null; chunk: ArchiveChunk | LiveChunk | null; paused: boolean; error: PlayerError | null; get loading(): boolean; playbackRate: number; volume: number; muted: boolean; videoResizeMode: VideoResizeMode; camera: Camera_2; stats: any; mode: 'archive' | 'DVR' | 'WebRTC' | null; behavior: PlayerBehavior | null; transform: Matrix | null; isRotating: boolean; setTransform: (matrix: Matrix | null, animate?: boolean) => void; resetTransform: () => void; animationController: REACT_SRPING_CONTROLLER_TYPE_HACK; width: number; height: number; chunkRequest: { time: Date; backward: boolean; } | null; loopRange: { start: Date; end: Date; } | null; loopRangeEnabled: boolean; restoreFromDvrEnabled: boolean; pendingBehavior: PlayerBehavior | null; video: HTMLVideoElement; clip?: Clip; startTime: Date | null; endTime: Date | null; stream: MediaStream | null; canSeek: boolean; canSeek$: Observable; progress$: Observable; muted$: Observable; volume$: Observable; ended$: Observable; archivesStore: ArchivesStore; behaviors: { archive: BehaviorFactory; DVR: BehaviorFactory; WebRTC: BehaviorFactory | null; }; seekTime?: Date | null; constructor({ camera, startTime, endTime, clip, archivesStore, behaviors }: { camera: Camera_2; clip?: Clip; startTime?: Date | null; endTime?: Date | null; archivesStore: ArchivesStore; behaviors: { archive: BehaviorFactory; DVR: BehaviorFactory; WebRTC: BehaviorFactory | null; }; }); attach(video: HTMLVideoElement, { canSeek$, progress$, muted$, volume$, ended$ }: PlayerEventStreams): void; private seek; private seekAfterReady; private stopLoadingOnError; private replaceErrorMessageOnOffline; changeMedia: ({ time, chunk, backward }: { time: Date; chunk?: ArchiveChunk | LiveChunk; backward?: boolean; }) => void; private initCurrentTime; private initPlayableRange; /** * If the chunk after chunk request is the same as the current chunk, * then we can dismiss loading indicator and seek. */ private initSameChunkRequestFix; private initLiveChunkUpdate; private initChunkRequest; private setupLiveChunk; /** * Inits correct behavior for current player mode */ private initPlayerBehavior; /** * Rewind by given amount of milliseconds * @param value milliseconds * @returns */ seekBackward: (value: number) => void; /** * Seek forward by given amount of milliseconds * @param value * @returns */ seekForward: (value: number) => void; goLive: () => void; setCamera: (camera: Camera_2) => void; setCameraAndStartTime: (camera: Camera_2, startTime: Date | null) => void; toggleResizeMode: () => void; setVideoResizeMode: (mode: VideoResizeMode) => void; toggleMute: () => void; setStartTime: (time: Date | null) => void; setVolume: (volume: number) => void; setPlaybackRate: (rate: number) => void; reactToVolumeChange(): void; togglePlayback: () => void; play: () => void; pause: () => void; detach: () => void; private initUpgradeToWebRtcWhenCameraIsBackOnline; private initFallbackToDVR; private initUpgradeToWebRtcAfterFallbackToDvr; } declare class PlayerError extends ErrorBase { } declare type PlayerErrorType = 'PLAYER_ERROR' | 'MEDIA_ERROR' | 'STREAMING_ERROR' | 'CAMERA_OFFLINE_ERROR' | 'PLAYBACK_TIMEOUT_ERROR' | 'CONNECTION_TIMEOUT_ERROR' | 'CONNECTION_FAILED_ERROR' | 'NO_PLAYABLE_STREAM_ERROR' | 'NO_VIDEO_TRACK_ERROR'; declare interface PlayerEventStreams { canSeek$: Observable; progress$: Observable; ended$: Observable; volume$: Observable; muted$: Observable; } declare enum PlayerState { Initial = "initial", InitiallyPaused = "initially-paused", Playing = "playing", Paused = "paused", Reconnecting = "reconnecting", Stalled = "stalled", Error = "error", Failed = "failed" } export declare interface PlayerWebRtcOptions { enabled: boolean; allowedIceCandidateProtocols?: ('udp' | 'tcp')[]; iceServers?: RTCIceServer[]; iceTransportPolicy?: RTCIceTransportPolicy; } export declare const PlayPauseControl: (() => JSX.Element) & { displayName: string; }; declare interface Props extends Omit, 'onMouseDown'> { cameraId: number; startTime?: Date | null; controls?: React_2.ReactNode; onMouseDown?: (e: MouseEvent) => void; onRequestClose?: () => void; playerRef?: Ref; webRtcOptions?: PlayerWebRtcOptions; } declare interface Props_2 extends Omit, 'onMouseDown'> { camera: Camera; startTime?: Date | null; endTime?: Date | null; clip?: Clip_2; controls: React_2.ReactNode; onMouseDown?: (e: MouseEvent) => void; hideCameraTitle?: boolean; webRtcOptions?: PlayerWebRtcOptions; controllerRef?: Ref; videoRef?: Ref; archivesStore: ArchivesStore; } declare interface Props_3 { onSelect: (box: Box) => void; onClose: () => void; onRequestCancel: () => void; } declare interface Props_4 { onClick?: () => void; } declare type Props_5 = Omit, 'title'> & { ref?: React_2.Ref; title?: React_2.ReactNode; }; declare interface Props_6 { children: React.ReactNode; style?: React.CSSProperties; } declare interface Props_7 { toggle: (() => void) | null; active: boolean; } declare interface Props_8 { onRequestClose?: () => void; fullscreenControl?: React.ReactNode; } export declare const PtzControls: ((props: PtzControlsProps) => JSX.Element) & { displayName: string; }; declare interface PtzControlsProps { cameraId: number; style?: React.CSSProperties; initialZoomSpeed?: number; initialMovementSpeed?: number; disabled?: boolean; disallowHomePositionUpdate?: boolean; disallowGoHome?: boolean; } declare interface RawArchiveChunk { id: number; tagName: string | null; description: string; cameraId: number; startTime: string; endTime: string; elapsedTime: number; streamUrl: string; isDvr: boolean; thumbnailUrl: string; duration?: number; } declare interface RawCamera { id: number; customerId: number; name: string; description: string; cameraBrand: string; cameraModel: string; enabled: boolean; cameraUserName: string; cameraPassword: null; serialNum: string; isOnvif: boolean; isP2P: boolean; p2pRegistrationCode: null; planId: null; p2pState: string; cameraVideoFormat: string; cameraState: string; cameraStateChangedTime: string; cameraError: null; cameraAddress: string; isMicEnabled: boolean; imageQuality: number; cameraSourceChannel: string; pin: string; streamUrl: string; dashStreamUrl: string; rtmpUrl: string; webRtcStreamHost: string; webRtcUrl: string; cameraHttpSourceUrl: string; cameraRtspSourceUrl: string; supportedResolutions: string; cameraType: string; isCloud: boolean; generateImageUrl: null; imageUrl: string; qualityProfile: string; encodingProfile: null; width: number; height: number; bitRate: number; frameRate: number; archiveDuration: number; isArchiveByMotionEvent: boolean; isAnalyticsEnabled: boolean; isTimelapseAvailable: boolean; motionEnabled: boolean; isPTZ: boolean; motionDuration: number; dvrWindowLength: number; jsonField: string; dtUpdUtc: string; version: string; statistics: CameraStatistics; } declare interface RawClip { id: number; recordType: 'Archive' | 'Timelaps' | 'Timelaps to do'; isReady: boolean; name: string; description: string; tagName: null; cameraId: number; clipUrl: string; thumbnailUrl: string; startTime: string; endTime: string; duration: number; validTo: string; timeCreated: string; timeUpdated: string; version: string; } declare type REACT_SRPING_CONTROLLER_TYPE_HACK = any; export declare const ResizeModeControl: (() => JSX.Element) & { displayName: string; }; export declare const SnapshotControl: { (): JSX.Element; displayName: string; }; export declare function useFullscreen(): { ref: (node: HTMLElement | null) => void; toggle: () => undefined; enabled: boolean; active: boolean; }; /** * Hook to get player controller reference * * Use this hook to get a reference to the player controller instance * to control the player from outside the component. * * @example * const { playerRef, player } = usePlayerRef(); * * */ export declare function usePlayerRef(): { playerRef: (p: PlayerController | null) => void; player: PlayerController | null; }; declare type VideoResizeMode = 'contain' | 'fill'; export declare const VolumeControl: (() => JSX.Element) & { displayName: string; }; export { }