@camera.ui/browser 0.0.110 → 0.0.111
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/bundle.js +1 -1
- package/dist/bundle.js.LICENSE.txt +11 -20
- package/dist/types/packages/client/browser/src/client.d.ts +5 -7
- package/dist/types/packages/client/browser/src/proxy/cameraDevice.d.ts +20 -24
- package/dist/types/packages/client/browser/src/proxy/coreManager.d.ts +10 -12
- package/dist/types/packages/client/browser/src/proxy/deviceManager.d.ts +10 -12
- package/dist/types/packages/client/browser/src/proxy.d.ts +7 -0
- package/dist/types/packages/client/browser/src/streaming/config.d.ts +21 -0
- package/dist/types/packages/client/browser/src/streaming/go2rts-session.d.ts +255 -40
- package/dist/types/packages/client/browser/src/streaming/types.d.ts +38 -0
- package/dist/types/packages/client/browser/src/types.d.ts +6 -8
- package/dist/types/packages/types/src/index.d.ts +302 -220
- package/dist/types/server/src/api/database/types.d.ts +17 -25
- package/dist/types/server/src/api/go2rtc/types.d.ts +66 -11
- package/dist/types/server/src/api/schemas/backup.schema.d.ts +24 -24
- package/dist/types/server/src/api/schemas/cameras.schema.d.ts +1407 -523
- package/dist/types/server/src/api/schemas/config.schema.d.ts +30 -42
- package/dist/types/server/src/api/schemas/go2rtc.schema.d.ts +186 -154
- package/dist/types/server/src/api/schemas/plugins.schema.d.ts +17 -17
- package/dist/types/server/src/api/schemas/storage.schema.d.ts +22 -0
- package/dist/types/server/src/api/schemas/system.schema.d.ts +171 -3
- package/dist/types/server/src/api/schemas/users.schema.d.ts +162 -318
- package/dist/types/server/src/api/types/index.d.ts +48 -46
- package/dist/types/server/src/api/websocket/types.d.ts +4 -2
- package/dist/types/server/src/camera/classes.d.ts +2 -0
- package/dist/types/{packages/plugineer/src/polyglot/node → server/src}/camera/index.d.ts +31 -30
- package/dist/types/server/src/camera/interfaces.d.ts +17 -0
- package/dist/types/server/src/camera/types.d.ts +16 -10
- package/dist/types/server/src/go2rtc/types.d.ts +5 -4
- package/dist/types/server/src/manager/types.d.ts +15 -0
- package/dist/types/server/src/plugins/schema.d.ts +27 -34
- package/dist/types/server/src/plugins/types.d.ts +43 -1
- package/dist/types/server/src/rpc/namespaces.d.ts +35 -0
- package/dist/types/server/src/rpc/types.d.ts +111 -0
- package/dist/types/server/src/services/config/defaults.d.ts +12 -0
- package/dist/types/server/src/services/config/types.d.ts +10 -4
- package/dist/types/server/src/types.d.ts +3 -0
- package/dist/types/shared/types/index.d.ts +9 -8
- package/package.json +19 -16
- package/dist/types/packages/client/browser/src/socket.d.ts +0 -15
- package/dist/types/packages/common/src/nats/messageQueue.d.ts +0 -48
- package/dist/types/packages/common/src/nats/nats.d.ts +0 -30
- package/dist/types/packages/common/src/nats/packer.d.ts +0 -2
- package/dist/types/packages/plugineer/src/polyglot/node/camera/interfaces/camera.d.ts +0 -8
- package/dist/types/packages/plugineer/src/polyglot/node/camera/interfaces/ptz.d.ts +0 -11
- package/dist/types/packages/plugineer/src/polyglot/node/camera/types.d.ts +0 -18
- package/dist/types/packages/plugineer/src/polyglot/node/plugins/schema.d.ts +0 -62
- package/dist/types/packages/plugineer/src/polyglot/node/plugins/types.d.ts +0 -135
- package/dist/types/packages/plugineer/src/types.d.ts +0 -4
- package/dist/types/server/src/api/controllers/api.controller.d.ts +0 -7
- package/dist/types/server/src/api/controllers/auth.controller.d.ts +0 -16
- package/dist/types/server/src/api/controllers/backup.controller.d.ts +0 -10
- package/dist/types/server/src/api/controllers/cameras.controller.d.ts +0 -38
- package/dist/types/server/src/api/controllers/config.controller.d.ts +0 -14
- package/dist/types/server/src/api/controllers/files.controller.d.ts +0 -8
- package/dist/types/server/src/api/controllers/frameWorkers.controller.d.ts +0 -11
- package/dist/types/server/src/api/controllers/plugins.controller.d.ts +0 -48
- package/dist/types/server/src/api/controllers/system.controller.d.ts +0 -23
- package/dist/types/server/src/api/controllers/users.controller.d.ts +0 -28
- package/dist/types/server/src/api/database/checks.d.ts +0 -55
- package/dist/types/server/src/api/database/constants.d.ts +0 -8
- package/dist/types/server/src/api/database/index.d.ts +0 -30
- package/dist/types/server/src/api/database/migration.d.ts +0 -15
- package/dist/types/server/src/api/database/selfcheck.d.ts +0 -48
- package/dist/types/server/src/api/go2rtc/api/application.d.ts +0 -9
- package/dist/types/server/src/api/go2rtc/api/config.d.ts +0 -8
- package/dist/types/server/src/api/go2rtc/api/index.d.ts +0 -1
- package/dist/types/server/src/api/go2rtc/api/snapshot.d.ts +0 -8
- package/dist/types/server/src/api/go2rtc/api/streams.d.ts +0 -12
- package/dist/types/server/src/api/go2rtc/index.d.ts +0 -14
- package/dist/types/server/src/api/go2rtc/queue.d.ts +0 -10
- package/dist/types/server/src/api/index.d.ts +0 -22
- package/dist/types/server/src/api/middlewares/authPermission.middleware.d.ts +0 -5
- package/dist/types/server/src/api/middlewares/authValidation.middleware.d.ts +0 -4
- package/dist/types/server/src/api/middlewares/pagination.middleware.d.ts +0 -3
- package/dist/types/server/src/api/middlewares/socketAuth.middleware.d.ts +0 -41
- package/dist/types/server/src/api/plugins/header.plugin.d.ts +0 -2
- package/dist/types/server/src/api/plugins/socket.plugin.d.ts +0 -11
- package/dist/types/server/src/api/plugins/system.plugin.d.ts +0 -20
- package/dist/types/server/src/api/plugins/useragent.plugin.d.ts +0 -8
- package/dist/types/server/src/api/routes/api.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/auth.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/backup.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/cameras.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/config.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/files.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/frameWorkers.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/index.d.ts +0 -6
- package/dist/types/server/src/api/routes/plugins.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/system.routes.d.ts +0 -2
- package/dist/types/server/src/api/routes/users.routes.d.ts +0 -2
- package/dist/types/server/src/api/services/auth.service.d.ts +0 -24
- package/dist/types/server/src/api/services/backup.service.d.ts +0 -11
- package/dist/types/server/src/api/services/cameras.service.d.ts +0 -54
- package/dist/types/server/src/api/services/plugins.service.d.ts +0 -38
- package/dist/types/server/src/api/services/system.service.d.ts +0 -13
- package/dist/types/server/src/api/services/users.service.d.ts +0 -25
- package/dist/types/server/src/api/utils/cameraSource.d.ts +0 -6
- package/dist/types/server/src/api/utils/cert.d.ts +0 -11
- package/dist/types/server/src/api/utils/constants.d.ts +0 -13
- package/dist/types/server/src/api/utils/fetch.d.ts +0 -1
- package/dist/types/server/src/api/utils/moveFiles.d.ts +0 -4
- package/dist/types/server/src/api/utils/parse.d.ts +0 -2
- package/dist/types/server/src/api/websocket/go2rtc.d.ts +0 -21
- package/dist/types/server/src/api/websocket/index.d.ts +0 -16
- package/dist/types/server/src/api/websocket/nsp/logs.d.ts +0 -19
- package/dist/types/server/src/api/websocket/nsp/main.d.ts +0 -9
- package/dist/types/server/src/api/websocket/nsp/metrics.d.ts +0 -24
- package/dist/types/server/src/api/websocket/nsp/notifications.d.ts +0 -12
- package/dist/types/server/src/api/websocket/nsp/plugins.d.ts +0 -13
- package/dist/types/server/src/api/websocket/nsp/proxy.d.ts +0 -27
- package/dist/types/server/src/api/websocket/nsp/server.d.ts +0 -26
- package/dist/types/server/src/api/websocket/nsp/status.d.ts +0 -15
- package/dist/types/server/src/api.d.ts +0 -29
- package/dist/types/server/src/camera/controller.d.ts +0 -61
- package/dist/types/server/src/camera/frameWorker.d.ts +0 -45
- package/dist/types/server/src/go2rtc/index.d.ts +0 -25
- package/dist/types/server/src/main.d.ts +0 -25
- package/dist/types/server/src/nats/index.d.ts +0 -40
- package/dist/types/server/src/nats/proxy/cameraDevice.d.ts +0 -22
- package/dist/types/server/src/nats/proxy/coreManager.d.ts +0 -14
- package/dist/types/server/src/nats/proxy/deviceManager.d.ts +0 -14
- package/dist/types/server/src/nats/server.d.ts +0 -38
- package/dist/types/server/src/nats/types.d.ts +0 -18
- package/dist/types/server/src/nats/utils.d.ts +0 -2
- package/dist/types/server/src/plugins/index.d.ts +0 -33
- package/dist/types/server/src/plugins/plugin.d.ts +0 -35
- package/dist/types/server/src/plugins/worker.d.ts +0 -55
- package/dist/types/server/src/services/config/constants.d.ts +0 -6
- package/dist/types/server/src/services/config/index.d.ts +0 -67
- package/dist/types/server/src/services/logger/index.d.ts +0 -16
- /package/dist/types/{packages/plugineer/src/polyglot/node → server/src}/camera/iou.d.ts +0 -0
- /package/dist/types/{packages/plugineer/src/polyglot/node → server/src}/camera/polygon.d.ts +0 -0
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
/*! *****************************************************************************
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
Copyright (C) Microsoft. All rights reserved.
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
5
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
8
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
9
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
10
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* splaytree v3.1.2
|
|
18
|
-
* Fast Splay tree for Node and browser
|
|
19
|
-
*
|
|
20
|
-
* @author Alexander Milevski <info@w8r.name>
|
|
21
|
-
* @license MIT
|
|
22
|
-
* @preserve
|
|
23
|
-
*/
|
|
12
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
|
+
and limitations under the License.
|
|
14
|
+
***************************************************************************** */
|
|
@@ -5,19 +5,17 @@ export interface API {
|
|
|
5
5
|
deviceManager: DeviceManager;
|
|
6
6
|
}
|
|
7
7
|
export declare class CameraUiClient {
|
|
8
|
-
private
|
|
9
|
-
private socketService?;
|
|
8
|
+
private interceptor;
|
|
10
9
|
private config;
|
|
11
10
|
private logger;
|
|
11
|
+
private proxy?;
|
|
12
12
|
private token?;
|
|
13
|
-
private
|
|
14
|
-
|
|
13
|
+
private _api?;
|
|
14
|
+
get api(): API | undefined;
|
|
15
15
|
constructor(config: CameraUiClientConfig);
|
|
16
16
|
connect(): Promise<API>;
|
|
17
17
|
disconnect(): Promise<void>;
|
|
18
18
|
updateCredentials(newConfig: CameraUiClientConfig): Promise<void>;
|
|
19
19
|
private login;
|
|
20
|
-
|
|
21
|
-
private checkSession;
|
|
22
|
-
private cleanUpClient;
|
|
20
|
+
private getNatsEndpoint;
|
|
23
21
|
}
|
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
import { BaseCameraDevice } from '../../../../../
|
|
2
|
-
import { CameraInterface } from '../../../../../
|
|
3
|
-
import { CameraPTZInterface } from '../../../../../packages/plugineer/src/polyglot/node/camera/interfaces/ptz.js';
|
|
1
|
+
import { BaseCameraDevice } from '../../../../../server/src/camera/index.js';
|
|
2
|
+
import { CameraInterface } from '../../../../../server/src/camera/interfaces.js';
|
|
4
3
|
import { Go2RTCSession } from '../streaming/go2rts-session.js';
|
|
5
|
-
import type { Camera,
|
|
6
|
-
import type {
|
|
7
|
-
import type { BaseLogger, CameraDevice, Go2RTCSessionOptions } from '../types.js';
|
|
4
|
+
import type { Camera, CameraSource, ProbeConfig, ProbeStream } from '../../../../../shared/types/index.js';
|
|
5
|
+
import type { Proxy } from '../proxy.js';
|
|
6
|
+
import type { BaseLogger, CameraDevice, CameraUiClientConfig, Go2RTCSessionOptions } from '../types.js';
|
|
8
7
|
export declare class CameraDeviceProxy extends BaseCameraDevice implements CameraDevice {
|
|
9
|
-
private
|
|
10
|
-
private
|
|
11
|
-
private
|
|
12
|
-
private
|
|
13
|
-
private
|
|
14
|
-
|
|
15
|
-
protected cameraDelegate: CameraInterface;
|
|
16
|
-
protected ptzDelegate: CameraPTZInterface;
|
|
8
|
+
private proxy;
|
|
9
|
+
private config;
|
|
10
|
+
private token;
|
|
11
|
+
private subscription?;
|
|
12
|
+
private namespaces;
|
|
13
|
+
protected cameraInterfaces: CameraInterface;
|
|
17
14
|
get sources(): CameraSource[];
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
stop(): void;
|
|
22
|
-
close(): void;
|
|
23
|
-
connect(): Promise<void>;
|
|
24
|
-
disconnect(): Promise<void>;
|
|
15
|
+
constructor(proxy: Proxy, config: CameraUiClientConfig, token: string, camera: Camera, logger: BaseLogger);
|
|
16
|
+
init(): Promise<void>;
|
|
17
|
+
close(): Promise<void>;
|
|
25
18
|
createWebRTCSession(options: Go2RTCSessionOptions): Go2RTCSession;
|
|
26
19
|
refreshStates(): Promise<void>;
|
|
27
|
-
cleanup(): Promise<void>;
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
protected cleanup(): Promise<void>;
|
|
21
|
+
protected snapshot(sourceId: string, forceNew?: boolean): Promise<ArrayBuffer | undefined>;
|
|
22
|
+
probeStream(sourceId: string, probeConfig?: ProbeConfig, refresh?: boolean): Promise<ProbeStream | undefined>;
|
|
23
|
+
private onEventMessage;
|
|
24
|
+
private cameraControllerProxy;
|
|
25
|
+
private disconnectRpc;
|
|
30
26
|
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
private
|
|
6
|
-
private
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
private subject;
|
|
10
|
-
constructor(socketService: SocketService, logger: BaseLogger);
|
|
1
|
+
import type { CuiPlugin, FfmpegArgs, HWAccelOptions, IceServer, CoreManager as ICoreManager } from '../../../../../shared/types/index.js';
|
|
2
|
+
import type { Proxy } from '../proxy.js';
|
|
3
|
+
export declare class CoreManager implements ICoreManager {
|
|
4
|
+
private proxy;
|
|
5
|
+
private namespaces;
|
|
6
|
+
private rpcConnections;
|
|
7
|
+
constructor(proxy: Proxy);
|
|
8
|
+
connectToPlugin(pluginName: string): Promise<CuiPlugin | undefined>;
|
|
11
9
|
getFFmpegPath(): Promise<string>;
|
|
12
|
-
getHwaccelInfo(
|
|
10
|
+
getHwaccelInfo(options: HWAccelOptions): Promise<FfmpegArgs[]>;
|
|
13
11
|
getServerAddresses(): Promise<string[]>;
|
|
14
12
|
getIceServers(): Promise<IceServer[]>;
|
|
15
|
-
private
|
|
13
|
+
private coreManagerProxy;
|
|
16
14
|
}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { BaseLogger, CameraDevice } from '../types.js';
|
|
1
|
+
import type { Proxy } from '../proxy.js';
|
|
2
|
+
import type { BaseLogger, CameraDevice, CameraUiClientConfig } from '../types.js';
|
|
3
3
|
interface DeviceManagerBrowserProxyMethods {
|
|
4
|
-
|
|
5
|
-
getCameraById(id: string): Promise<CameraDevice | undefined>;
|
|
4
|
+
getCamera(cameraIdOrName: string): Promise<CameraDevice | undefined>;
|
|
6
5
|
}
|
|
7
6
|
export declare class DeviceManager implements DeviceManagerBrowserProxyMethods {
|
|
8
|
-
private
|
|
9
|
-
private
|
|
7
|
+
private proxy;
|
|
8
|
+
private config;
|
|
9
|
+
private token;
|
|
10
10
|
private logger;
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
getCameraByName(name: string): Promise<CameraDevice | undefined>;
|
|
16
|
-
private onRequest;
|
|
11
|
+
private namespaces;
|
|
12
|
+
constructor(proxy: Proxy, config: CameraUiClientConfig, token: string, logger: BaseLogger);
|
|
13
|
+
getCamera(cameraIdOrName: string): Promise<CameraDevice | undefined>;
|
|
14
|
+
private deviceManagerProxy;
|
|
17
15
|
}
|
|
18
16
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ClientInstance } from '@camera.ui/rpc-client';
|
|
2
|
+
import type { ClientConnectionOptions } from '@camera.ui/rpc-common';
|
|
3
|
+
export declare class Proxy extends ClientInstance {
|
|
4
|
+
constructor(options: ClientConnectionOptions);
|
|
5
|
+
protected onStart(): Promise<void>;
|
|
6
|
+
protected onStop(): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare function createConfig(): {
|
|
2
|
+
WEBRTC: {
|
|
3
|
+
RECONNECT_TIMER: number;
|
|
4
|
+
TIMEOUT_TIMER: number;
|
|
5
|
+
ICE_SERVERS: {
|
|
6
|
+
urls: string;
|
|
7
|
+
}[];
|
|
8
|
+
};
|
|
9
|
+
QUALITY: {
|
|
10
|
+
METRICS_INTERVAL: number;
|
|
11
|
+
METRICS_WINDOW: number;
|
|
12
|
+
STABILITY_PERIOD: number;
|
|
13
|
+
PACKET_LOSS_THRESHOLD: number;
|
|
14
|
+
FRAME_DROP_THRESHOLD: number;
|
|
15
|
+
QUALITY_CHANGE_COOLDOWN: number;
|
|
16
|
+
};
|
|
17
|
+
MEDIA: {
|
|
18
|
+
BUFFER_SIZE: number;
|
|
19
|
+
DEFAULT_CODECS: string[];
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -1,71 +1,286 @@
|
|
|
1
|
-
import type { VideoStreamingMode } from '../../../../../shared/types/index.js';
|
|
2
|
-
import type {
|
|
3
|
-
import type { BaseLogger,
|
|
1
|
+
import type { CameraSource, StreamingRole, VideoStreamingMode } from '../../../../../shared/types/index.js';
|
|
2
|
+
import type { CameraDeviceProxy } from '../proxy/cameraDevice.js';
|
|
3
|
+
import type { BaseLogger, CameraUiClientConfig, Go2RTCSessionOptions } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Manages streaming sessions using go2rtc as backend service
|
|
6
|
+
* Supports WebRTC, MSE, and automatic mode switching
|
|
7
|
+
*/
|
|
4
8
|
export declare class Go2RTCSession extends EventTarget {
|
|
5
|
-
private cameraDevice;
|
|
6
|
-
private
|
|
7
|
-
private
|
|
8
|
-
private
|
|
9
|
-
private
|
|
10
|
-
private
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
hasAudio: boolean;
|
|
14
|
-
closed: boolean;
|
|
9
|
+
private readonly cameraDevice;
|
|
10
|
+
private readonly logger;
|
|
11
|
+
private readonly config;
|
|
12
|
+
private readonly token;
|
|
13
|
+
private readonly initialOptions;
|
|
14
|
+
private readonly videoPlayer;
|
|
15
|
+
private readonly CONFIG;
|
|
16
|
+
private ws?;
|
|
15
17
|
private pc;
|
|
16
18
|
private micTransceiver;
|
|
17
|
-
private buf;
|
|
18
19
|
private mediaSource;
|
|
19
20
|
private sourceBuffer;
|
|
21
|
+
private buf;
|
|
20
22
|
private bufLen;
|
|
21
|
-
private mseCodecs;
|
|
22
|
-
private videoPlayerMp4?;
|
|
23
|
-
private media;
|
|
24
23
|
private codecList;
|
|
24
|
+
private streamProbe?;
|
|
25
|
+
private metrics;
|
|
26
|
+
private metricsInterval?;
|
|
27
|
+
private lastQualityChange;
|
|
28
|
+
private isMonitoring;
|
|
29
|
+
private wsReconnectTimer?;
|
|
25
30
|
private wsReconnectTimeout?;
|
|
26
31
|
private webrtcConnectTimeout?;
|
|
27
32
|
private webrtcReconnectTimeout?;
|
|
28
|
-
private
|
|
29
|
-
private webrtcReconnectTimer;
|
|
30
|
-
private webrtcTimeoutTimer;
|
|
31
|
-
private _finishLoading;
|
|
32
|
-
private _firstFrameReceived;
|
|
33
|
+
private firstFrameReceived;
|
|
33
34
|
private animationFrameId?;
|
|
34
|
-
private
|
|
35
|
+
private userRequestedMode;
|
|
36
|
+
private internalMode;
|
|
37
|
+
private activeMode;
|
|
38
|
+
private isAutoSwitchingInProgress;
|
|
39
|
+
private _closed;
|
|
40
|
+
private _hasBackchannel;
|
|
41
|
+
private _hasAudio;
|
|
42
|
+
private _hasVideo;
|
|
43
|
+
private _finishLoading;
|
|
44
|
+
private userRequestedRole;
|
|
45
|
+
private effectiveRole;
|
|
46
|
+
private _streamingSource?;
|
|
47
|
+
/**
|
|
48
|
+
* Get current streaming source
|
|
49
|
+
*/
|
|
50
|
+
get streamingSource(): CameraSource | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Is the session closed
|
|
53
|
+
*/
|
|
54
|
+
get closed(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Indicates if backchannel (two-way audio) is available
|
|
57
|
+
*/
|
|
58
|
+
get hasBackchannel(): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Indicates if audio is available in the stream
|
|
61
|
+
*/
|
|
62
|
+
get hasAudio(): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Indicates if video is available in the stream
|
|
65
|
+
*/
|
|
66
|
+
get hasVideo(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Indicates if loading has finished
|
|
69
|
+
*/
|
|
70
|
+
get finishLoading(): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* User requested streaming mode
|
|
73
|
+
*/
|
|
35
74
|
get mode(): VideoStreamingMode;
|
|
75
|
+
/**
|
|
76
|
+
* Current effective mode being used (never 'auto')
|
|
77
|
+
*/
|
|
78
|
+
get currentMode(): VideoStreamingMode;
|
|
79
|
+
/**
|
|
80
|
+
* Current effective resolution being used
|
|
81
|
+
*/
|
|
82
|
+
get currentResolution(): StreamingRole;
|
|
83
|
+
/**
|
|
84
|
+
* Prefix for logging, includes camera name and mode
|
|
85
|
+
*/
|
|
36
86
|
private get logPrefix();
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
87
|
+
/**
|
|
88
|
+
* WebSocket URL with proper authentication and source
|
|
89
|
+
*/
|
|
90
|
+
private get wsUrl();
|
|
91
|
+
/**
|
|
92
|
+
* Creates a new Go2RTCSession
|
|
93
|
+
*/
|
|
94
|
+
constructor(cameraDevice: CameraDeviceProxy, config: CameraUiClientConfig, token: string, logger: BaseLogger, options: Go2RTCSessionOptions);
|
|
95
|
+
/**
|
|
96
|
+
* Starts the streaming session
|
|
97
|
+
* @param customMode Optional mode override for this start
|
|
98
|
+
*/
|
|
99
|
+
start(customMode?: VideoStreamingMode): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Closes the streaming session
|
|
102
|
+
*/
|
|
42
103
|
close(): void;
|
|
104
|
+
/**
|
|
105
|
+
* Restarts the streaming session
|
|
106
|
+
* @param customMode Optional mode override for restart
|
|
107
|
+
* @param sourceChange Whether restart is due to source change
|
|
108
|
+
*/
|
|
109
|
+
restart(customMode?: VideoStreamingMode, sourceChange?: boolean): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Toggles microphone track for two-way audio
|
|
112
|
+
* @param track Media track or null to disable
|
|
113
|
+
*/
|
|
43
114
|
toggleMicrophone(track: MediaStreamTrack | null): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Changes the stream resolution
|
|
117
|
+
* @param role Target resolution or 'auto' for adaptive
|
|
118
|
+
*/
|
|
119
|
+
toggleRole(role: StreamingRole | 'auto'): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Changes the streaming transport mode
|
|
122
|
+
* @param mode Target transport mode
|
|
123
|
+
*/
|
|
124
|
+
toggleMode(mode: VideoStreamingMode): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* Initialize streaming source based on user preferences
|
|
127
|
+
*/
|
|
128
|
+
private initializeStreamingSource;
|
|
129
|
+
/**
|
|
130
|
+
* Check if a stream is WebRTC compatible
|
|
131
|
+
*/
|
|
132
|
+
private checkWebRTCCompatibility;
|
|
133
|
+
/**
|
|
134
|
+
* Initialize adaptive streaming if role is auto
|
|
135
|
+
*/
|
|
136
|
+
private initializeAdaptiveStreaming;
|
|
137
|
+
/**
|
|
138
|
+
* Select initial mode based on codec compatibility
|
|
139
|
+
* If we know WebRTC won't work, don't even try it
|
|
140
|
+
*/
|
|
141
|
+
private selectInitialMode;
|
|
142
|
+
/**
|
|
143
|
+
* Set up WebSocket connection
|
|
144
|
+
*/
|
|
145
|
+
private connectWs;
|
|
146
|
+
/**
|
|
147
|
+
* Disconnect and clean up WebSocket
|
|
148
|
+
*/
|
|
149
|
+
private disconnectWs;
|
|
150
|
+
/**
|
|
151
|
+
* Reset internal state completely
|
|
152
|
+
*/
|
|
153
|
+
private reset;
|
|
154
|
+
/**
|
|
155
|
+
* WebSocket open event handler
|
|
156
|
+
*/
|
|
44
157
|
private onWsOpen;
|
|
158
|
+
/**
|
|
159
|
+
* WebSocket close event handler - handles reconnection
|
|
160
|
+
*/
|
|
45
161
|
private onWsClose;
|
|
162
|
+
/**
|
|
163
|
+
* WebSocket message handler - routes to appropriate processor
|
|
164
|
+
*/
|
|
46
165
|
private onWsMessage;
|
|
166
|
+
/**
|
|
167
|
+
* Handle streaming errors from server
|
|
168
|
+
*/
|
|
169
|
+
private handleStreamError;
|
|
170
|
+
/**
|
|
171
|
+
* Request WebRTC session
|
|
172
|
+
* @param autoMode Whether this is part of auto mode detection
|
|
173
|
+
*/
|
|
47
174
|
private requestWebrtc;
|
|
175
|
+
/**
|
|
176
|
+
* Process WebRTC signaling messages
|
|
177
|
+
*/
|
|
48
178
|
private onWebrtcData;
|
|
179
|
+
/**
|
|
180
|
+
* Request MSE session
|
|
181
|
+
*/
|
|
49
182
|
private requestMse;
|
|
183
|
+
/**
|
|
184
|
+
* Process MSE initialization message
|
|
185
|
+
*/
|
|
50
186
|
private onMseData;
|
|
187
|
+
/**
|
|
188
|
+
* Process MSE binary data
|
|
189
|
+
*/
|
|
51
190
|
private onMseBuffer;
|
|
191
|
+
/**
|
|
192
|
+
* Request auto mode (tries both WebRTC and MSE)
|
|
193
|
+
*/
|
|
52
194
|
private requestAuto;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
private
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
private
|
|
61
|
-
|
|
62
|
-
|
|
195
|
+
/**
|
|
196
|
+
* Send message to WebSocket
|
|
197
|
+
*/
|
|
198
|
+
private send;
|
|
199
|
+
/**
|
|
200
|
+
* Switch to WebRTC in auto mode
|
|
201
|
+
*/
|
|
202
|
+
private switchToWebRTC;
|
|
203
|
+
/**
|
|
204
|
+
* Play video with automatic muting fallback if autoplay is blocked
|
|
205
|
+
*/
|
|
63
206
|
private play;
|
|
207
|
+
/**
|
|
208
|
+
* Start quality monitoring for adaptive streaming
|
|
209
|
+
*/
|
|
210
|
+
private startQualityMonitoring;
|
|
211
|
+
/**
|
|
212
|
+
* Stop quality monitoring
|
|
213
|
+
*/
|
|
214
|
+
private stopQualityMonitoring;
|
|
215
|
+
/**
|
|
216
|
+
* Gather metrics from current connection
|
|
217
|
+
*/
|
|
218
|
+
private gatherMetrics;
|
|
219
|
+
/**
|
|
220
|
+
* Analyze quality metrics to determine stability
|
|
221
|
+
*/
|
|
222
|
+
private analyzeQualityMetrics;
|
|
223
|
+
/**
|
|
224
|
+
* Analyze current quality and adapt resolution if needed
|
|
225
|
+
*/
|
|
226
|
+
private analyzeAndAdaptQuality;
|
|
227
|
+
/**
|
|
228
|
+
* Change stream resolution
|
|
229
|
+
* @param resolution Target resolution
|
|
230
|
+
* @param reason Why the change is happening (for logging)
|
|
231
|
+
* @param initial Whether this is initial setup
|
|
232
|
+
*/
|
|
233
|
+
private setStreamResolution;
|
|
234
|
+
/**
|
|
235
|
+
* Find the best source for a requested resolution
|
|
236
|
+
*/
|
|
237
|
+
private getSourceForResolution;
|
|
238
|
+
/**
|
|
239
|
+
* Handle first frame received in WebRTC mode
|
|
240
|
+
*/
|
|
64
241
|
private onFirstFrameWebrtc;
|
|
242
|
+
/**
|
|
243
|
+
* Handle camera device change event
|
|
244
|
+
*/
|
|
245
|
+
private setActiveMode;
|
|
246
|
+
/**
|
|
247
|
+
* Handle first frame received event
|
|
248
|
+
*/
|
|
65
249
|
private onFirstFrame;
|
|
250
|
+
/**
|
|
251
|
+
* Handle loaded data event from video element
|
|
252
|
+
*/
|
|
253
|
+
private onLoadedData;
|
|
254
|
+
/**
|
|
255
|
+
* Mark loading as finished and dispatch event
|
|
256
|
+
*/
|
|
66
257
|
private onFinishLoading;
|
|
67
|
-
|
|
258
|
+
/**
|
|
259
|
+
* Create a list of supported codecs based on browser
|
|
260
|
+
*/
|
|
68
261
|
private createCodecsList;
|
|
262
|
+
/**
|
|
263
|
+
* Parse codecs list into string for MSE
|
|
264
|
+
*/
|
|
69
265
|
private parseCodecs;
|
|
70
|
-
|
|
266
|
+
/**
|
|
267
|
+
* Probe stream capabilities
|
|
268
|
+
*/
|
|
269
|
+
private probeStream;
|
|
270
|
+
/**
|
|
271
|
+
* Check if audio codec is WebRTC compatible
|
|
272
|
+
*/
|
|
273
|
+
private isWebRtcCompatibleAudioCodec;
|
|
274
|
+
/**
|
|
275
|
+
* Check if video codec is WebRTC compatible
|
|
276
|
+
*/
|
|
277
|
+
private isWebRtcCompatibleVideoCodec;
|
|
278
|
+
/**
|
|
279
|
+
* Create WebSocket source name from camera and source
|
|
280
|
+
*/
|
|
281
|
+
private createWsSourceName;
|
|
282
|
+
/**
|
|
283
|
+
* Check if H.265 is supported by the browser's WebRTC implementation
|
|
284
|
+
*/
|
|
285
|
+
private isWebRTCH265Supported;
|
|
71
286
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface Go2RTCMessageBase {
|
|
2
|
+
type: 'mse' | 'webrtc/candidate' | 'webrtc/answer' | 'webrtc/offer' | 'error';
|
|
3
|
+
}
|
|
4
|
+
export interface MSEMessage extends Go2RTCMessageBase {
|
|
5
|
+
type: 'mse';
|
|
6
|
+
value: string | ArrayBuffer;
|
|
7
|
+
}
|
|
8
|
+
export interface WebRTCAnswerMessage extends Go2RTCMessageBase {
|
|
9
|
+
type: 'webrtc/answer';
|
|
10
|
+
value: string;
|
|
11
|
+
}
|
|
12
|
+
export interface WebRTCOfferMessage extends Go2RTCMessageBase {
|
|
13
|
+
type: 'webrtc/offer';
|
|
14
|
+
value: string;
|
|
15
|
+
}
|
|
16
|
+
export interface WebRTCCandidateMessage extends Go2RTCMessageBase {
|
|
17
|
+
type: 'webrtc/candidate';
|
|
18
|
+
value?: string;
|
|
19
|
+
}
|
|
20
|
+
export type WebRTCMessage = WebRTCAnswerMessage | WebRTCCandidateMessage;
|
|
21
|
+
export interface ErrorMessage extends Go2RTCMessageBase {
|
|
22
|
+
type: 'error';
|
|
23
|
+
value: string;
|
|
24
|
+
}
|
|
25
|
+
export type Go2RTCMessage = MSEMessage | WebRTCMessage | ErrorMessage;
|
|
26
|
+
export type Go2RTCWsMessage = WebRTCOfferMessage | WebRTCCandidateMessage | MSEMessage;
|
|
27
|
+
export interface NetworkMetrics {
|
|
28
|
+
packetsLost: number;
|
|
29
|
+
packetsReceived: number;
|
|
30
|
+
framesDropped: number;
|
|
31
|
+
framesReceived: number;
|
|
32
|
+
timestamp: number;
|
|
33
|
+
}
|
|
34
|
+
export interface QualityMetrics {
|
|
35
|
+
packetLossRate: number;
|
|
36
|
+
frameDropRate: number;
|
|
37
|
+
isStable: boolean;
|
|
38
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Observable, Subject } from 'rxjs';
|
|
2
|
-
import type { BaseCameraDevice } from '../../../../
|
|
3
|
-
import type { VideoStreamingMode } from '../../../../shared/types/index.js';
|
|
2
|
+
import type { BaseCameraDevice } from '../../../../server/src/camera/index.js';
|
|
3
|
+
import type { StreamingRole, VideoStreamingMode } from '../../../../shared/types/index.js';
|
|
4
4
|
import type { Go2RTCSession } from './streaming/go2rts-session.js';
|
|
5
|
-
export
|
|
5
|
+
export * from '@camera.ui/types';
|
|
6
6
|
export type { Go2RTCSession } from './streaming/go2rts-session.js';
|
|
7
|
+
export type { VideoStreamingMode } from '../../../../shared/types/index.js';
|
|
7
8
|
export type CameraUiClientConfig = WithCredentials | WithToken;
|
|
8
9
|
export interface BasicBrowserPeerConnection {
|
|
9
10
|
enableMicrophone(track: MediaStreamTrack): void;
|
|
@@ -19,14 +20,11 @@ export interface BasicBrowserPeerConnection {
|
|
|
19
20
|
close(): void;
|
|
20
21
|
}
|
|
21
22
|
export interface CameraDevice extends BaseCameraDevice {
|
|
22
|
-
|
|
23
|
-
start(): Promise<void>;
|
|
24
|
-
stop(): void;
|
|
25
|
-
close(): void;
|
|
23
|
+
close(): Promise<void>;
|
|
26
24
|
createWebRTCSession(options: Go2RTCSessionOptions): Go2RTCSession;
|
|
27
25
|
}
|
|
28
26
|
export interface Go2RTCSessionOptions {
|
|
29
|
-
|
|
27
|
+
role: StreamingRole | 'auto';
|
|
30
28
|
mode: VideoStreamingMode;
|
|
31
29
|
videoElement: HTMLVideoElement;
|
|
32
30
|
wsReconnectTimeout?: number;
|