camstreamerlib 3.5.2 → 4.0.0-beta.2
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/CamOverlayAPI.d.ts +11 -28
- package/CamOverlayAPI.js +116 -138
- package/CamOverlayDrawingAPI.js +26 -18
- package/CamOverlayPainter/Frame.js +167 -182
- package/CamOverlayPainter/Painter.js +80 -101
- package/CamOverlayPainter/ResourceManager.js +31 -46
- package/CamScripterAPI.d.ts +19 -0
- package/CamScripterAPI.js +66 -0
- package/CamScripterAPICameraEventsGenerator.js +22 -16
- package/CamStreamerAPI.d.ts +5 -27
- package/CamStreamerAPI.js +45 -71
- package/CamSwitcherAPI.d.ts +38 -71
- package/CamSwitcherAPI.js +329 -91
- package/CamSwitcherEvents.d.ts +15 -33
- package/CamSwitcherEvents.js +53 -97
- package/CreatePackage.js +5 -7
- package/README.md +3 -1
- package/VapixAPI.d.ts +66 -0
- package/VapixAPI.js +454 -0
- package/VapixEvents.js +18 -16
- package/errors/errors.d.ts +34 -0
- package/errors/errors.js +66 -0
- package/events/AxisCameraStationEvents.js +29 -42
- package/events/GenetecAgent.d.ts +14 -15
- package/events/GenetecAgent.js +81 -100
- package/internal/Digest.js +5 -11
- package/internal/ProxyClient.d.ts +11 -0
- package/internal/ProxyClient.js +40 -0
- package/internal/common.d.ts +19 -4
- package/internal/common.js +11 -26
- package/internal/constants.d.ts +1 -0
- package/internal/constants.js +1 -0
- package/internal/transformers.d.ts +5 -0
- package/internal/transformers.js +25 -0
- package/internal/utils.d.ts +11 -0
- package/internal/utils.js +34 -0
- package/internal/versionCompare.d.ts +6 -0
- package/internal/versionCompare.js +44 -0
- package/node/DefaultClient.d.ts +15 -0
- package/node/DefaultClient.js +50 -0
- package/{internal → node}/HttpRequestSender.d.ts +2 -2
- package/node/HttpRequestSender.js +85 -0
- package/{HttpServer.d.ts → node/HttpServer.d.ts} +1 -1
- package/{HttpServer.js → node/HttpServer.js} +22 -24
- package/{internal → node}/WsClient.d.ts +1 -1
- package/{internal → node}/WsClient.js +32 -39
- package/node/WsEventClient.d.ts +13 -0
- package/node/WsEventClient.js +18 -0
- package/package.json +7 -3
- package/types/CamOverlayAPI.d.ts +188 -0
- package/types/CamOverlayAPI.js +44 -0
- package/types/CamScripterAPI.d.ts +67 -0
- package/types/CamScripterAPI.js +17 -0
- package/types/CamStreamerAPI.d.ts +139 -0
- package/types/CamStreamerAPI.js +25 -0
- package/types/CamSwitcherAPI.d.ts +814 -0
- package/types/CamSwitcherAPI.js +134 -0
- package/types/CamswitcherEvents.d.ts +491 -0
- package/types/CamswitcherEvents.js +59 -0
- package/types/VapixAPI.d.ts +1704 -0
- package/types/VapixAPI.js +129 -0
- package/types/common.d.ts +37 -0
- package/types/common.js +11 -0
- package/web/DefaultClient.d.ts +6 -0
- package/web/DefaultClient.js +16 -0
- package/web/WsClient.d.ts +13 -0
- package/web/WsClient.js +58 -0
- package/CameraVapix.d.ts +0 -98
- package/CameraVapix.js +0 -441
- package/DefaultAgent.d.ts +0 -15
- package/DefaultAgent.js +0 -68
- package/internal/HttpRequestSender.js +0 -117
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const fs = require("fs/promises");
|
|
13
|
-
class ResourceManager {
|
|
1
|
+
import * as fs from 'fs/promises';
|
|
2
|
+
export default class ResourceManager {
|
|
3
|
+
co;
|
|
4
|
+
imgFileNames = {};
|
|
5
|
+
fontFileNames = {};
|
|
6
|
+
images = {};
|
|
7
|
+
fonts = {};
|
|
14
8
|
constructor(co) {
|
|
15
9
|
this.co = co;
|
|
16
|
-
this.imgFileNames = {};
|
|
17
|
-
this.fontFileNames = {};
|
|
18
|
-
this.images = {};
|
|
19
|
-
this.fonts = {};
|
|
20
10
|
}
|
|
21
11
|
registerImage(moniker, fileName) {
|
|
22
12
|
this.imgFileNames[moniker] = process.env.INSTALL_PATH + '/images/' + fileName;
|
|
@@ -24,39 +14,34 @@ class ResourceManager {
|
|
|
24
14
|
registerFont(moniker, fileName) {
|
|
25
15
|
this.fontFileNames[moniker] = process.env.INSTALL_PATH + '/fonts/' + fileName;
|
|
26
16
|
}
|
|
27
|
-
image(moniker) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
});
|
|
17
|
+
async image(moniker) {
|
|
18
|
+
if (moniker in this.images) {
|
|
19
|
+
return this.images[moniker];
|
|
20
|
+
}
|
|
21
|
+
else if (moniker in this.imgFileNames) {
|
|
22
|
+
const imgData = await fs.readFile(this.imgFileNames[moniker]);
|
|
23
|
+
this.images[moniker] = await this.co.uploadImageData(imgData);
|
|
24
|
+
return this.images[moniker];
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
throw new Error('Error! Unknown image requested!');
|
|
28
|
+
}
|
|
41
29
|
}
|
|
42
|
-
font(moniker) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
});
|
|
30
|
+
async font(moniker) {
|
|
31
|
+
if (moniker in this.fonts) {
|
|
32
|
+
return this.fonts[moniker];
|
|
33
|
+
}
|
|
34
|
+
else if (moniker in this.fontFileNames) {
|
|
35
|
+
const fontData = await fs.readFile(this.fontFileNames[moniker]);
|
|
36
|
+
this.fonts[moniker] = await this.co.uploadFontData(fontData);
|
|
37
|
+
return this.fonts[moniker];
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
throw new Error('Error! Unknown font requested!');
|
|
41
|
+
}
|
|
56
42
|
}
|
|
57
43
|
clear() {
|
|
58
44
|
this.images = {};
|
|
59
45
|
this.fonts = {};
|
|
60
46
|
}
|
|
61
47
|
}
|
|
62
|
-
exports.default = ResourceManager;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IClient } from './internal/common';
|
|
2
|
+
import { CamScripterOptions, TNodeState, TPackageInfoList, TStorage, TStorageType } from './types/CamScripterAPI';
|
|
3
|
+
import { TNetworkCamera } from './types/common';
|
|
4
|
+
export declare class CamOverlayAPI {
|
|
5
|
+
private client;
|
|
6
|
+
constructor(options?: CamScripterOptions | IClient);
|
|
7
|
+
checkCameraTime(): Promise<boolean>;
|
|
8
|
+
getStorageInfo(): Promise<TStorage>;
|
|
9
|
+
getNetworkCameraList(): Promise<TNetworkCamera[]>;
|
|
10
|
+
getPackageList(): Promise<TPackageInfoList>;
|
|
11
|
+
installPackages(formData: FormData, storage: TStorageType): Promise<void>;
|
|
12
|
+
uninstallPackage(packageId: string): Promise<void>;
|
|
13
|
+
importSettings(packageId: string, formData: FormData): Promise<void>;
|
|
14
|
+
exportSettings(packageId: string, formData: FormData): Promise<void>;
|
|
15
|
+
getNodejsStatus(): Promise<TNodeState>;
|
|
16
|
+
installNodejs(storage: TStorageType): Promise<void>;
|
|
17
|
+
private get;
|
|
18
|
+
private post;
|
|
19
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { isClient, responseStringify } from './internal/common';
|
|
2
|
+
import { DefaultClient } from './node/DefaultClient';
|
|
3
|
+
import { packageInfoListSchema, storageSchema, } from './types/CamScripterAPI';
|
|
4
|
+
import { networkCameraListSchema } from './types/common';
|
|
5
|
+
export class CamOverlayAPI {
|
|
6
|
+
client;
|
|
7
|
+
constructor(options = {}) {
|
|
8
|
+
if (isClient(options)) {
|
|
9
|
+
this.client = options;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
this.client = new DefaultClient(options);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
async checkCameraTime() {
|
|
16
|
+
return (await this.get('/local/camscripter/camera_time.cgi')).state;
|
|
17
|
+
}
|
|
18
|
+
async getStorageInfo() {
|
|
19
|
+
const data = await this.get(`/local/camscripter/package/get_storage.cgi`);
|
|
20
|
+
return storageSchema.parse(data);
|
|
21
|
+
}
|
|
22
|
+
async getNetworkCameraList() {
|
|
23
|
+
const response = await this.get('/local/camscripter/network_camera_list.cgi');
|
|
24
|
+
return networkCameraListSchema.parse(response.camera_list);
|
|
25
|
+
}
|
|
26
|
+
async getPackageList() {
|
|
27
|
+
const data = await this.get('/local/camscripter/package/list.cgi');
|
|
28
|
+
return packageInfoListSchema.parse(data);
|
|
29
|
+
}
|
|
30
|
+
async installPackages(formData, storage) {
|
|
31
|
+
await this.post(`/local/camscripter/package/install.cgi?storage=${storage}`, formData);
|
|
32
|
+
}
|
|
33
|
+
async uninstallPackage(packageId) {
|
|
34
|
+
await this.get(`/local/camscripter/package/remove.cgi?package_name=${packageId}`);
|
|
35
|
+
}
|
|
36
|
+
async importSettings(packageId, formData) {
|
|
37
|
+
await this.post(`/local/camscripter/package/data.cgi?action=IMPORT&package_name=${packageId}`, formData);
|
|
38
|
+
}
|
|
39
|
+
async exportSettings(packageId, formData) {
|
|
40
|
+
await this.post(`/local/camscripter/package/data.cgi?action=EXPORT&package_name=${packageId}`, formData);
|
|
41
|
+
}
|
|
42
|
+
async getNodejsStatus() {
|
|
43
|
+
return (await this.get('/local/camscripter/diagnostics.cgi')).node_state;
|
|
44
|
+
}
|
|
45
|
+
async installNodejs(storage) {
|
|
46
|
+
await this.get(`/local/camscripter/node_update.cgi?storage=${storage}`);
|
|
47
|
+
}
|
|
48
|
+
async get(path, params) {
|
|
49
|
+
const res = await this.client.get(path, params);
|
|
50
|
+
if (res.ok) {
|
|
51
|
+
return await res.json();
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
throw new Error(await responseStringify(res));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async post(path, data, params) {
|
|
58
|
+
const res = await this.client.post(path, data, params);
|
|
59
|
+
if (res.ok) {
|
|
60
|
+
return await res.json();
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
throw new Error(await responseStringify(res));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import * as EventEmitter from 'events';
|
|
2
|
+
import { WsClient } from './node/WsClient';
|
|
3
|
+
export class CamScripterAPICameraEventsGenerator extends EventEmitter {
|
|
4
|
+
tls;
|
|
5
|
+
tlsInsecure;
|
|
6
|
+
ip;
|
|
7
|
+
port;
|
|
8
|
+
user;
|
|
9
|
+
pass;
|
|
10
|
+
callId;
|
|
11
|
+
sendMessages;
|
|
12
|
+
timeoutCheckTimer;
|
|
13
|
+
wsConnected;
|
|
14
|
+
ws;
|
|
7
15
|
constructor(options) {
|
|
8
|
-
var _a, _b, _c, _d, _e, _f;
|
|
9
16
|
super();
|
|
10
|
-
this.tls =
|
|
11
|
-
this.tlsInsecure =
|
|
12
|
-
this.ip =
|
|
13
|
-
this.port =
|
|
14
|
-
this.user =
|
|
15
|
-
this.pass =
|
|
17
|
+
this.tls = options?.tls ?? false;
|
|
18
|
+
this.tlsInsecure = options?.tlsInsecure ?? false;
|
|
19
|
+
this.ip = options?.ip ?? '127.0.0.1';
|
|
20
|
+
this.port = options?.port ?? (this.tls ? 443 : 80);
|
|
21
|
+
this.user = options?.user ?? '';
|
|
22
|
+
this.pass = options?.pass ?? '';
|
|
16
23
|
this.callId = 0;
|
|
17
24
|
this.sendMessages = {};
|
|
18
25
|
this.wsConnected = false;
|
|
@@ -59,7 +66,7 @@ class CamScripterAPICameraEventsGenerator extends EventEmitter {
|
|
|
59
66
|
address: `/local/camscripter/ws`,
|
|
60
67
|
protocol: 'camera-events',
|
|
61
68
|
};
|
|
62
|
-
this.ws = new
|
|
69
|
+
this.ws = new WsClient(options);
|
|
63
70
|
this.ws.on('open', () => {
|
|
64
71
|
this.wsConnected = true;
|
|
65
72
|
this.emit('open');
|
|
@@ -79,7 +86,7 @@ class CamScripterAPICameraEventsGenerator extends EventEmitter {
|
|
|
79
86
|
if ('error' in dataJSON) {
|
|
80
87
|
errorResponse = dataJSON;
|
|
81
88
|
}
|
|
82
|
-
if (dataJSON.call_id !== undefined
|
|
89
|
+
if (dataJSON.call_id !== undefined) {
|
|
83
90
|
if (errorResponse !== undefined) {
|
|
84
91
|
this.sendMessages[dataJSON.call_id].reject(new Error(errorResponse.error));
|
|
85
92
|
}
|
|
@@ -146,4 +153,3 @@ class CamScripterAPICameraEventsGenerator extends EventEmitter {
|
|
|
146
153
|
this.emit('close');
|
|
147
154
|
}
|
|
148
155
|
}
|
|
149
|
-
exports.CamScripterAPICameraEventsGenerator = CamScripterAPICameraEventsGenerator;
|
package/CamStreamerAPI.d.ts
CHANGED
|
@@ -1,38 +1,16 @@
|
|
|
1
|
-
import { IClient
|
|
2
|
-
|
|
3
|
-
export type TStreamAttributes = {
|
|
4
|
-
enabled: string;
|
|
5
|
-
active: string;
|
|
6
|
-
audioSource: string;
|
|
7
|
-
avSyncMsec: string;
|
|
8
|
-
internalVapixParameters: string;
|
|
9
|
-
userVapixParameters: string;
|
|
10
|
-
outputParameters: string;
|
|
11
|
-
outputType: string;
|
|
12
|
-
mediaServerUrl: string;
|
|
13
|
-
inputType: string;
|
|
14
|
-
inputUrl: string;
|
|
15
|
-
forceStereo: string;
|
|
16
|
-
streamDelay: string;
|
|
17
|
-
statusLed: string;
|
|
18
|
-
statusPort: string;
|
|
19
|
-
callApi: string;
|
|
20
|
-
trigger: string;
|
|
21
|
-
schedule: string;
|
|
22
|
-
prepareAhead: string;
|
|
23
|
-
startTime: string;
|
|
24
|
-
stopTime: string;
|
|
25
|
-
};
|
|
26
|
-
export type TStreamList = Record<string, TStreamAttributes>;
|
|
1
|
+
import { IClient } from './internal/common';
|
|
2
|
+
import { CamStreamerAPIOptions, TStreamAttributes, TStreamList } from './types/CamStreamerAPI';
|
|
27
3
|
export declare class CamStreamerAPI {
|
|
28
4
|
private client;
|
|
29
5
|
constructor(options?: CamStreamerAPIOptions | IClient);
|
|
30
6
|
getStreamList(): Promise<TStreamList>;
|
|
31
7
|
getStream(streamID: string): Promise<TStreamAttributes>;
|
|
32
8
|
getStreamParameter(streamID: string, paramName: string): Promise<string>;
|
|
33
|
-
setStream(streamID: string, params: TStreamAttributes): Promise<void>;
|
|
9
|
+
setStream(streamID: string, params: Partial<TStreamAttributes>): Promise<void>;
|
|
34
10
|
setStreamParameter(streamID: string, paramName: string, value: string): Promise<void>;
|
|
35
11
|
isStreaming(streamID: string): Promise<boolean>;
|
|
36
12
|
deleteStream(streamID: string): Promise<void>;
|
|
13
|
+
wsAutoratization(): Promise<string>;
|
|
14
|
+
getUtcTime(): Promise<number>;
|
|
37
15
|
private get;
|
|
38
16
|
}
|
package/CamStreamerAPI.js
CHANGED
|
@@ -1,87 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
-
var t = {};
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
-
t[p] = s[p];
|
|
15
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
-
t[p[i]] = s[p[i]];
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.CamStreamerAPI = void 0;
|
|
24
|
-
const common_1 = require("./internal/common");
|
|
25
|
-
const DefaultAgent_1 = require("./DefaultAgent");
|
|
26
|
-
class CamStreamerAPI {
|
|
1
|
+
import { isClient, responseStringify } from './internal/common';
|
|
2
|
+
import { DefaultClient } from './node/DefaultClient';
|
|
3
|
+
import { streamAttributesSchema, streamListSchema, } from './types/CamStreamerAPI';
|
|
4
|
+
export class CamStreamerAPI {
|
|
5
|
+
client;
|
|
27
6
|
constructor(options = {}) {
|
|
28
|
-
if (
|
|
7
|
+
if (isClient(options)) {
|
|
29
8
|
this.client = options;
|
|
30
9
|
}
|
|
31
10
|
else {
|
|
32
|
-
this.client = new
|
|
11
|
+
this.client = new DefaultClient(options);
|
|
33
12
|
}
|
|
34
13
|
}
|
|
35
|
-
getStreamList() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return streamListRes.data;
|
|
39
|
-
});
|
|
14
|
+
async getStreamList() {
|
|
15
|
+
const streamListRes = await this.get('/local/camstreamer/stream/list.cgi');
|
|
16
|
+
return streamListSchema.parse(streamListRes.data);
|
|
40
17
|
}
|
|
41
|
-
getStream(streamID) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return stream.data;
|
|
45
|
-
});
|
|
18
|
+
async getStream(streamID) {
|
|
19
|
+
const stream = await this.get(`/local/camstreamer/stream/get.cgi?stream_id=${streamID}`);
|
|
20
|
+
return streamAttributesSchema.parse(stream.data);
|
|
46
21
|
}
|
|
47
|
-
getStreamParameter(streamID, paramName) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return stream.data[paramName];
|
|
51
|
-
});
|
|
22
|
+
async getStreamParameter(streamID, paramName) {
|
|
23
|
+
const stream = await this.get(`/local/camstreamer/stream/get.cgi?stream_id=${streamID}`);
|
|
24
|
+
return stream.data[paramName];
|
|
52
25
|
}
|
|
53
|
-
setStream(streamID, params) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
26
|
+
async setStream(streamID, params) {
|
|
27
|
+
const { streamDelay, startTime, stopTime, ...rest } = params;
|
|
28
|
+
await this.get('/local/camstreamer/stream/set.cgi', {
|
|
29
|
+
stream_id: streamID,
|
|
30
|
+
streamDelay: streamDelay ?? '',
|
|
31
|
+
startTime: startTime ?? 'null',
|
|
32
|
+
stopTime: stopTime ?? 'null',
|
|
33
|
+
...rest,
|
|
57
34
|
});
|
|
58
35
|
}
|
|
59
|
-
setStreamParameter(streamID, paramName, value) {
|
|
60
|
-
|
|
61
|
-
yield this.get(`/local/camstreamer/stream/set.cgi?stream_id=${streamID}&${paramName}=${value}`);
|
|
62
|
-
});
|
|
36
|
+
async setStreamParameter(streamID, paramName, value) {
|
|
37
|
+
await this.get(`/local/camstreamer/stream/set.cgi?stream_id=${streamID}&${paramName}=${value}`);
|
|
63
38
|
}
|
|
64
|
-
isStreaming(streamID) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return response.data.is_streaming === 1;
|
|
68
|
-
});
|
|
39
|
+
async isStreaming(streamID) {
|
|
40
|
+
const response = await this.get(`/local/camstreamer/get_streamstat.cgi?stream_id=${streamID}`);
|
|
41
|
+
return response.data.is_streaming === 1;
|
|
69
42
|
}
|
|
70
|
-
deleteStream(streamID) {
|
|
71
|
-
|
|
72
|
-
yield this.get('/local/camstreamer/stream/remove.cgi', { stream_id: streamID });
|
|
73
|
-
});
|
|
43
|
+
async deleteStream(streamID) {
|
|
44
|
+
await this.get('/local/camstreamer/stream/remove.cgi', { stream_id: streamID });
|
|
74
45
|
}
|
|
75
|
-
|
|
76
|
-
return
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
46
|
+
wsAutoratization() {
|
|
47
|
+
return this.get('/local/camstreamer/ws_authorization.cgi');
|
|
48
|
+
}
|
|
49
|
+
async getUtcTime() {
|
|
50
|
+
return await this.get('/local/camstreamer/get_utc_time.cgi');
|
|
51
|
+
}
|
|
52
|
+
async get(path, parameters) {
|
|
53
|
+
const res = await this.client.get(path, parameters);
|
|
54
|
+
if (res.ok) {
|
|
55
|
+
return await res.json();
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
throw new Error(await responseStringify(res));
|
|
59
|
+
}
|
|
85
60
|
}
|
|
86
61
|
}
|
|
87
|
-
exports.CamStreamerAPI = CamStreamerAPI;
|
package/CamSwitcherAPI.d.ts
CHANGED
|
@@ -1,81 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
channel: string;
|
|
15
|
-
isFavourite: false;
|
|
16
|
-
keyboard: object;
|
|
17
|
-
loop: boolean;
|
|
18
|
-
niceName: string;
|
|
19
|
-
sortIndexFavourite: number;
|
|
20
|
-
sortIndexOverview: number;
|
|
21
|
-
stream_list: TStreamInfo[];
|
|
22
|
-
};
|
|
23
|
-
export type TPlaylistList = Record<string, TPlaylistInfo>;
|
|
24
|
-
export type TClipInfo = {
|
|
25
|
-
niceName: string;
|
|
26
|
-
channel: string;
|
|
27
|
-
keyboard: object;
|
|
28
|
-
sortIndexOverview: number;
|
|
29
|
-
};
|
|
30
|
-
export type TClipList = Record<string, TClipInfo>;
|
|
31
|
-
export type TApiClipType = 'audio' | 'video';
|
|
32
|
-
export type TClipStorage = 'SD_DISK' | 'FLASH';
|
|
33
|
-
export type TPlaylistQueue = {
|
|
34
|
-
playlist_queue_list: string[];
|
|
35
|
-
};
|
|
36
|
-
export type TOutputInfo = {
|
|
37
|
-
rtsp_url: string;
|
|
38
|
-
ws: string;
|
|
39
|
-
ws_initial_message: string;
|
|
40
|
-
};
|
|
41
|
-
export type TSilenceChannel = 'mono' | 'stereo';
|
|
42
|
-
export type TAvailableCameraList = {
|
|
43
|
-
camera_list: {
|
|
44
|
-
name: string;
|
|
45
|
-
ip: string;
|
|
46
|
-
}[];
|
|
47
|
-
};
|
|
48
|
-
export type TStorageInfo = {
|
|
49
|
-
storage: TClipStorage;
|
|
50
|
-
writable: boolean;
|
|
51
|
-
size: number;
|
|
52
|
-
available: number;
|
|
53
|
-
};
|
|
54
|
-
declare const cgiNames: {
|
|
55
|
-
camera: string;
|
|
56
|
-
audio: string;
|
|
57
|
-
playlist: string;
|
|
58
|
-
clip: string;
|
|
59
|
-
tracker: string;
|
|
60
|
-
};
|
|
61
|
-
export type TSourceType = keyof typeof cgiNames;
|
|
62
|
-
export declare class CamSwitcherAPI {
|
|
63
|
-
private client;
|
|
64
|
-
constructor(options?: CamSwitcherAPIOptions | IClient);
|
|
65
|
-
generateSilence(sampleRate: number, channels: TSilenceChannel): Promise<void>;
|
|
66
|
-
getIpListFromNetworkCheck(): Promise<TAvailableCameraList>;
|
|
1
|
+
import { IClient } from './internal/common';
|
|
2
|
+
import { TAudioPushInfo, TOutputInfo, TStorageInfo, TStreamSaveList, TClipList, TStreamSaveLoadList, TClipSaveLoadList, TPlaylistSaveLoadList, TTrackerSaveList, TrackerSaveLoadList, TClipSaveList, TPlaylistSaveList, TCameraOptions, TGlobalAudioSettings, TSecondaryAudioSettings } from './types/CamSwitcherAPI';
|
|
3
|
+
import { TAudioChannel, TNetworkCamera, TStorageType } from './types/common';
|
|
4
|
+
export declare class CamSwitcherAPI<Client extends IClient = IClient> {
|
|
5
|
+
client: Client;
|
|
6
|
+
private vapixAgent;
|
|
7
|
+
constructor(client: Client);
|
|
8
|
+
static getProxyUrl: () => string;
|
|
9
|
+
static getWsEventsUrl: () => string;
|
|
10
|
+
static getClipPreview: (id: string, storage: TStorageType) => string;
|
|
11
|
+
generateSilence(sampleRate: number, channels: TAudioChannel): Promise<void>;
|
|
12
|
+
checkCameraTime(): Promise<boolean>;
|
|
13
|
+
getIpListFromNetworkCheck(): Promise<TNetworkCamera[]>;
|
|
67
14
|
getMaxFps(source: number): Promise<number>;
|
|
68
15
|
getStorageInfo(): Promise<TStorageInfo[]>;
|
|
16
|
+
wsAuthorization(): Promise<string>;
|
|
69
17
|
getOutputInfo(): Promise<TOutputInfo>;
|
|
70
|
-
|
|
18
|
+
getAudioPushInfo(): Promise<TAudioPushInfo>;
|
|
19
|
+
getStreamSaveList(): Promise<TStreamSaveLoadList>;
|
|
20
|
+
getClipSaveList(): Promise<TClipSaveLoadList>;
|
|
21
|
+
getPlaylistSaveList(): Promise<TPlaylistSaveLoadList>;
|
|
22
|
+
getTrackerSaveList(): Promise<TrackerSaveLoadList>;
|
|
23
|
+
setStreamSaveList(data: TStreamSaveList): Promise<boolean>;
|
|
24
|
+
setClipSaveList(data: TClipSaveList): Promise<boolean>;
|
|
25
|
+
setPlaylistSaveList(data: TPlaylistSaveList): Promise<boolean>;
|
|
26
|
+
setTrackerSaveList(data: TTrackerSaveList): Promise<boolean>;
|
|
71
27
|
playlistSwitch(playlistName: string): Promise<void>;
|
|
72
28
|
playlistQueuePush(playlistName: string): Promise<void>;
|
|
73
29
|
playlistQueueClear(): Promise<void>;
|
|
74
|
-
playlistQueueList(): Promise<
|
|
30
|
+
playlistQueueList(): Promise<string[]>;
|
|
75
31
|
playlistQueuePlayNext(): Promise<void>;
|
|
32
|
+
addNewClip(file: any, clipType: 'video' | 'audio', storage: TStorageType, id: string, fileName?: string): Promise<void>;
|
|
33
|
+
removeClip(id: string, storage: TStorageType): Promise<any>;
|
|
76
34
|
getClipList(): Promise<TClipList>;
|
|
77
|
-
|
|
78
|
-
|
|
35
|
+
setCamSwitchOptions(data: TCameraOptions, cameraFWVersion: string): Promise<boolean>;
|
|
36
|
+
setGlobalAudioSettings(settings: TGlobalAudioSettings): Promise<boolean>;
|
|
37
|
+
setSecondaryAudioSettings(settings: TSecondaryAudioSettings): Promise<boolean>;
|
|
38
|
+
setDefaultPlaylist(id: string): Promise<boolean>;
|
|
39
|
+
setPermanentRtspUrlToken(token: string): Promise<boolean>;
|
|
40
|
+
getCamSwitchOptions(): Promise<Partial<TCameraOptions>>;
|
|
41
|
+
getGlobalAudioSettings(): Promise<TGlobalAudioSettings>;
|
|
42
|
+
getSecondaryAudioSettings(): Promise<TSecondaryAudioSettings>;
|
|
43
|
+
getPermanentRtspUrlToken(): Promise<string>;
|
|
79
44
|
private get;
|
|
45
|
+
private set;
|
|
46
|
+
private setParamFromCameraJSON;
|
|
47
|
+
private getParamFromCameraAndJSONParse;
|
|
80
48
|
}
|
|
81
|
-
export {};
|