camstreamerlib 4.0.0-beta.33 → 4.0.0-beta.35
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/cjs/CamOverlayAPI.js +3 -3
- package/cjs/CamStreamerAPI.js +54 -11
- package/cjs/CamSwitcherAPI.js +7 -7
- package/cjs/CamSwitcherEvents.js +4 -60
- package/cjs/PlaneTrackerAPI.js +52 -52
- package/cjs/VapixAPI.js +10 -7
- package/cjs/index.js +2 -11
- package/cjs/internal/ProxyClient.js +6 -6
- package/cjs/internal/WsEvents.js +72 -0
- package/cjs/node/DefaultClient.js +4 -4
- package/cjs/node/HttpRequestSender.js +1 -1
- package/cjs/node/WsClient.js +1 -1
- package/cjs/{events → node/events}/AxisCameraStationEvents.js +4 -4
- package/cjs/{events → node/events}/GenetecAgent.js +1 -1
- package/cjs/node/index.js +2 -2
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +14 -2
- package/cjs/types/CamOverlayAPI/scoreBoardSchema.js +127 -0
- package/cjs/types/CamStreamerAPI.js +30 -3
- package/esm/CamOverlayAPI.js +3 -3
- package/esm/CamStreamerAPI.js +53 -11
- package/esm/CamSwitcherAPI.js +7 -7
- package/esm/CamSwitcherEvents.js +5 -61
- package/esm/PlaneTrackerAPI.js +52 -52
- package/esm/VapixAPI.js +10 -7
- package/esm/index.js +1 -6
- package/esm/internal/ProxyClient.js +6 -6
- package/esm/internal/WsEvents.js +68 -0
- package/esm/node/DefaultClient.js +4 -4
- package/esm/node/HttpRequestSender.js +1 -1
- package/esm/node/WsClient.js +1 -1
- package/esm/{events → node/events}/AxisCameraStationEvents.js +3 -3
- package/esm/{events → node/events}/GenetecAgent.js +1 -1
- package/esm/node/index.js +2 -2
- package/esm/types/CamOverlayAPI/CamOverlayAPI.js +9 -1
- package/esm/types/CamOverlayAPI/scoreBoardSchema.js +124 -0
- package/esm/types/CamStreamerAPI.js +29 -2
- package/package.json +22 -2
- package/{cjs → types}/CamOverlayAPI.d.ts +3 -5
- package/{esm → types}/CamScripterAPI.d.ts +4 -4
- package/types/CamStreamerAPI.d.ts +48 -0
- package/{esm → types}/CamSwitcherAPI.d.ts +8 -8
- package/types/CamSwitcherEvents.d.ts +8 -0
- package/types/PlaneTrackerAPI.d.ts +43 -0
- package/{cjs → types}/VapixAPI.d.ts +11 -7
- package/{cjs → types}/index.d.ts +1 -6
- package/{esm → types}/internal/ProxyClient.d.ts +4 -4
- package/types/internal/WsEvents.d.ts +41 -0
- package/{esm → types}/internal/types.d.ts +12 -9
- package/{cjs → types}/node/DefaultClient.d.ts +6 -4
- package/{esm → types/node}/events/AxisCameraStationEvents.d.ts +4 -4
- package/{esm → types}/node/index.d.ts +2 -2
- package/{cjs → types}/types/CamOverlayAPI/CamOverlayAPI.d.ts +1071 -10
- package/{esm → types}/types/CamOverlayAPI/infotickerSchema.d.ts +2 -2
- package/types/types/CamOverlayAPI/scoreBoardSchema.d.ts +357 -0
- package/types/types/CamStreamerAPI.d.ts +274 -0
- package/types/web/DefaultClient.d.ts +6 -0
- package/cjs/CamScripterAPI.d.ts +0 -37
- package/cjs/CamStreamerAPI.d.ts +0 -19
- package/cjs/CamSwitcherAPI.d.ts +0 -54
- package/cjs/CamSwitcherEvents.d.ts +0 -18
- package/cjs/PlaneTrackerAPI.d.ts +0 -43
- package/cjs/events/AxisCameraStationEvents.d.ts +0 -12
- package/cjs/internal/ProxyClient.d.ts +0 -10
- package/cjs/internal/types.d.ts +0 -42
- package/cjs/node/index.d.ts +0 -5
- package/cjs/types/CamOverlayAPI/infotickerSchema.d.ts +0 -96
- package/cjs/types/CamStreamerAPI.d.ts +0 -150
- package/cjs/web/DefaultClient.d.ts +0 -6
- package/esm/CamOverlayAPI.d.ts +0 -41
- package/esm/CamOverlayDrawingAPI.d.ts +0 -41
- package/esm/CamOverlayPainter/Frame.d.ts +0 -67
- package/esm/CamOverlayPainter/Painter.d.ts +0 -43
- package/esm/CamOverlayPainter/ResourceManager.d.ts +0 -15
- package/esm/CamScripterAPICameraEventsGenerator.d.ts +0 -74
- package/esm/CamStreamerAPI.d.ts +0 -19
- package/esm/CamSwitcherEvents.d.ts +0 -18
- package/esm/CreatePackage.d.ts +0 -1
- package/esm/PlaneTrackerAPI.d.ts +0 -43
- package/esm/VapixAPI.d.ts +0 -80
- package/esm/VapixEvents.d.ts +0 -43
- package/esm/errors/errors.d.ts +0 -37
- package/esm/events/GenetecAgent.d.ts +0 -159
- package/esm/index.d.ts +0 -23
- package/esm/internal/Digest.d.ts +0 -4
- package/esm/internal/constants.d.ts +0 -1
- package/esm/internal/transformers.d.ts +0 -5
- package/esm/internal/utils.d.ts +0 -14
- package/esm/internal/versionCompare.d.ts +0 -6
- package/esm/node/DefaultClient.d.ts +0 -14
- package/esm/node/HttpRequestSender.d.ts +0 -29
- package/esm/node/HttpServer.d.ts +0 -21
- package/esm/node/WsClient.d.ts +0 -40
- package/esm/types/CamOverlayAPI/CamOverlayAPI.d.ts +0 -3260
- package/esm/types/CamOverlayAPI/accuweatherSchema.d.ts +0 -84
- package/esm/types/CamOverlayAPI/customGraphicsSchema.d.ts +0 -700
- package/esm/types/CamOverlayAPI/imagesSchema.d.ts +0 -95
- package/esm/types/CamOverlayAPI/index.d.ts +0 -11
- package/esm/types/CamOverlayAPI/pipSchema.d.ts +0 -125
- package/esm/types/CamOverlayAPI/ptzCompassSchema.d.ts +0 -93
- package/esm/types/CamOverlayAPI/ptzSchema.d.ts +0 -118
- package/esm/types/CamOverlayAPI/screenSharingSchema.d.ts +0 -58
- package/esm/types/CamOverlayAPI/webCameraSharingSchema.d.ts +0 -58
- package/esm/types/CamOverlayAPI/widgetCommonTypes.d.ts +0 -141
- package/esm/types/CamOverlayDrawingAPI.d.ts +0 -58
- package/esm/types/CamOverlayPainter.d.ts +0 -74
- package/esm/types/CamScripterAPI.d.ts +0 -132
- package/esm/types/CamStreamerAPI.d.ts +0 -150
- package/esm/types/CamSwitcherAPI.d.ts +0 -812
- package/esm/types/CamSwitcherEvents.d.ts +0 -568
- package/esm/types/PlaneTrackerAPI.d.ts +0 -8
- package/esm/types/VapixAPI.d.ts +0 -1819
- package/esm/types/common.d.ts +0 -46
- package/esm/web/DefaultClient.d.ts +0 -6
- package/esm/web/WsClient.d.ts +0 -13
- package/esm/web/index.d.ts +0 -2
- /package/cjs/{internal → node}/Digest.js +0 -0
- /package/esm/{internal → node}/Digest.js +0 -0
- /package/{cjs → types}/CamOverlayDrawingAPI.d.ts +0 -0
- /package/{cjs → types}/CamOverlayPainter/Frame.d.ts +0 -0
- /package/{cjs → types}/CamOverlayPainter/Painter.d.ts +0 -0
- /package/{cjs → types}/CamOverlayPainter/ResourceManager.d.ts +0 -0
- /package/{cjs → types}/CamScripterAPICameraEventsGenerator.d.ts +0 -0
- /package/{cjs → types}/CreatePackage.d.ts +0 -0
- /package/{cjs → types}/VapixEvents.d.ts +0 -0
- /package/{cjs → types}/errors/errors.d.ts +0 -0
- /package/{cjs → types}/internal/constants.d.ts +0 -0
- /package/{cjs → types}/internal/transformers.d.ts +0 -0
- /package/{cjs → types}/internal/utils.d.ts +0 -0
- /package/{cjs → types}/internal/versionCompare.d.ts +0 -0
- /package/{cjs/internal → types/node}/Digest.d.ts +0 -0
- /package/{cjs → types}/node/HttpRequestSender.d.ts +0 -0
- /package/{cjs → types}/node/HttpServer.d.ts +0 -0
- /package/{cjs → types}/node/WsClient.d.ts +0 -0
- /package/{cjs → types/node}/events/GenetecAgent.d.ts +0 -0
- /package/{cjs → types}/types/CamOverlayAPI/accuweatherSchema.d.ts +0 -0
- /package/{cjs → types}/types/CamOverlayAPI/customGraphicsSchema.d.ts +0 -0
- /package/{cjs → types}/types/CamOverlayAPI/imagesSchema.d.ts +0 -0
- /package/{cjs → types}/types/CamOverlayAPI/index.d.ts +0 -0
- /package/{cjs → types}/types/CamOverlayAPI/pipSchema.d.ts +0 -0
- /package/{cjs → types}/types/CamOverlayAPI/ptzCompassSchema.d.ts +0 -0
- /package/{cjs → types}/types/CamOverlayAPI/ptzSchema.d.ts +0 -0
- /package/{cjs → types}/types/CamOverlayAPI/screenSharingSchema.d.ts +0 -0
- /package/{cjs → types}/types/CamOverlayAPI/webCameraSharingSchema.d.ts +0 -0
- /package/{cjs → types}/types/CamOverlayAPI/widgetCommonTypes.d.ts +0 -0
- /package/{cjs → types}/types/CamOverlayDrawingAPI.d.ts +0 -0
- /package/{cjs → types}/types/CamOverlayPainter.d.ts +0 -0
- /package/{cjs → types}/types/CamScripterAPI.d.ts +0 -0
- /package/{cjs → types}/types/CamSwitcherAPI.d.ts +0 -0
- /package/{cjs → types}/types/CamSwitcherEvents.d.ts +0 -0
- /package/{cjs → types}/types/PlaneTrackerAPI.d.ts +0 -0
- /package/{cjs → types}/types/VapixAPI.d.ts +0 -0
- /package/{cjs → types}/types/common.d.ts +0 -0
- /package/{cjs → types}/web/WsClient.d.ts +0 -0
- /package/{cjs → types}/web/index.d.ts +0 -0
package/esm/PlaneTrackerAPI.js
CHANGED
|
@@ -18,49 +18,49 @@ export class PlaneTrackerAPI {
|
|
|
18
18
|
const response = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
|
|
19
19
|
return z.boolean().parse(response.state);
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
async resetPtzCalibration(options) {
|
|
22
22
|
const agent = this.getClient(options?.proxyParams);
|
|
23
23
|
return await agent.get({
|
|
24
24
|
path: `${BASE_PATH}/package/resetPtzCalibration.cgi`,
|
|
25
25
|
parameters: this.apiUser,
|
|
26
26
|
timeout: options?.timeout,
|
|
27
27
|
});
|
|
28
|
-
}
|
|
29
|
-
|
|
28
|
+
}
|
|
29
|
+
async resetFocusCalibration(options) {
|
|
30
30
|
const agent = this.getClient(options?.proxyParams);
|
|
31
31
|
return await agent.get({
|
|
32
32
|
path: `${BASE_PATH}/package/resetFocusCalibration.cgi`,
|
|
33
33
|
parameters: this.apiUser,
|
|
34
34
|
timeout: options?.timeout,
|
|
35
35
|
});
|
|
36
|
-
}
|
|
37
|
-
|
|
36
|
+
}
|
|
37
|
+
async serverRunCheck(options) {
|
|
38
38
|
const agent = this.getClient(options?.proxyParams);
|
|
39
39
|
return await agent.get({ path: `${BASE_PATH}/package/serverRunCheck.cgi`, timeout: options?.timeout });
|
|
40
|
-
}
|
|
41
|
-
|
|
40
|
+
}
|
|
41
|
+
async getLiveViewAlias(rtspUrl, options) {
|
|
42
42
|
const agent = this.getClient(options?.proxyParams);
|
|
43
43
|
return await agent.get({
|
|
44
44
|
path: `${BASE_PATH}/getLiveViewAlias.cgi`,
|
|
45
45
|
parameters: { rtsp_url: rtspUrl },
|
|
46
46
|
timeout: options?.timeout,
|
|
47
47
|
});
|
|
48
|
-
}
|
|
49
|
-
|
|
48
|
+
}
|
|
49
|
+
async fetchCameraSettings(options) {
|
|
50
50
|
return await this._getJson(`${BASE_PATH}/package_camera_settings.cgi`, { action: 'get' }, options);
|
|
51
|
-
}
|
|
52
|
-
|
|
51
|
+
}
|
|
52
|
+
async setCameraSettings(settingsJsonString, options) {
|
|
53
53
|
return await this._postJsonEncoded(`${BASE_PATH}/package_camera_settings.cgi`, settingsJsonString, {
|
|
54
54
|
action: 'set',
|
|
55
55
|
}, options);
|
|
56
|
-
}
|
|
57
|
-
|
|
56
|
+
}
|
|
57
|
+
async fetchServerSettings(options) {
|
|
58
58
|
return await this._getJson(`${BASE_PATH}/package_server_settings.cgi`, { action: 'get' }, options);
|
|
59
|
-
}
|
|
60
|
-
|
|
59
|
+
}
|
|
60
|
+
async exportAppSettings(dataType, options) {
|
|
61
61
|
return await this._getBlob(`${BASE_PATH}/package_data.cgi`, { action: 'EXPORT', dataType }, options);
|
|
62
|
-
}
|
|
63
|
-
|
|
62
|
+
}
|
|
63
|
+
async importAppSettings(dataType, formData, options) {
|
|
64
64
|
const agent = this.getClient(options?.proxyParams);
|
|
65
65
|
return await agent.post({
|
|
66
66
|
path: `${BASE_PATH}/package_data.cgi`,
|
|
@@ -68,74 +68,74 @@ export class PlaneTrackerAPI {
|
|
|
68
68
|
parameters: { action: 'IMPORT', dataType },
|
|
69
69
|
timeout: options?.timeout,
|
|
70
70
|
});
|
|
71
|
-
}
|
|
72
|
-
|
|
71
|
+
}
|
|
72
|
+
async fetchFlightInfo(icao, options) {
|
|
73
73
|
return await this._getJson(`${BASE_PATH}/package/flightInfo.cgi`, { icao: encodeURIComponent(icao) }, options);
|
|
74
|
-
}
|
|
75
|
-
|
|
74
|
+
}
|
|
75
|
+
async getTrackingMode(options) {
|
|
76
76
|
return await this._getJson(`${BASE_PATH}/package/getTrackingMode.cgi`, undefined, options);
|
|
77
|
-
}
|
|
78
|
-
|
|
77
|
+
}
|
|
78
|
+
async setTrackingMode(modeJsonString, options) {
|
|
79
79
|
return await this._postJsonEncoded(`${BASE_PATH}/package/setTrackingMode.cgi`, modeJsonString, this.apiUser, options);
|
|
80
|
-
}
|
|
81
|
-
|
|
80
|
+
}
|
|
81
|
+
async startTrackingPlane(icao, options) {
|
|
82
82
|
const agent = this.getClient(options?.proxyParams);
|
|
83
83
|
return await agent.get({
|
|
84
84
|
path: `${BASE_PATH}/package/trackIcao.cgi`,
|
|
85
85
|
parameters: { icao, ...this.apiUser },
|
|
86
86
|
timeout: options?.timeout,
|
|
87
87
|
});
|
|
88
|
-
}
|
|
89
|
-
|
|
88
|
+
}
|
|
89
|
+
async stopTrackingPlane(options) {
|
|
90
90
|
const agent = this.getClient(options?.proxyParams);
|
|
91
91
|
return await agent.get({
|
|
92
92
|
path: `${BASE_PATH}/package/resetIcao.cgi`,
|
|
93
93
|
parameters: this.apiUser,
|
|
94
94
|
timeout: options?.timeout,
|
|
95
95
|
});
|
|
96
|
-
}
|
|
97
|
-
|
|
96
|
+
}
|
|
97
|
+
async getPriorityList(options) {
|
|
98
98
|
return await this._getJson(`${BASE_PATH}/package/getPriorityList.cgi`, undefined, options);
|
|
99
|
-
}
|
|
100
|
-
|
|
99
|
+
}
|
|
100
|
+
async setPriorityList(priorityListJsonString, options) {
|
|
101
101
|
return await this._postJsonEncoded(`${BASE_PATH}/package/setPriorityList.cgi`, priorityListJsonString, this.apiUser, options);
|
|
102
|
-
}
|
|
103
|
-
|
|
102
|
+
}
|
|
103
|
+
async getWhiteList(options) {
|
|
104
104
|
return await this._getJson(`${BASE_PATH}/package/getWhiteList.cgi`, undefined, options);
|
|
105
|
-
}
|
|
106
|
-
|
|
105
|
+
}
|
|
106
|
+
async setWhiteList(whiteListJsonString, options) {
|
|
107
107
|
return await this._postJsonEncoded(`${BASE_PATH}/package/setWhiteList.cgi`, whiteListJsonString, this.apiUser, options);
|
|
108
|
-
}
|
|
109
|
-
|
|
108
|
+
}
|
|
109
|
+
async getBlackList(options) {
|
|
110
110
|
return await this._getJson(`${BASE_PATH}/package/getBlackList.cgi`, undefined, options);
|
|
111
|
-
}
|
|
112
|
-
|
|
111
|
+
}
|
|
112
|
+
async setBlackList(blackListJsonString, options) {
|
|
113
113
|
return await this._postJsonEncoded(`${BASE_PATH}/package/setBlackList.cgi`, blackListJsonString, this.apiUser, options);
|
|
114
|
-
}
|
|
115
|
-
|
|
114
|
+
}
|
|
115
|
+
async fetchMapInfo(options) {
|
|
116
116
|
return await this._getJson(`${BASE_PATH}/package/getMapInfo.cgi`, undefined, options);
|
|
117
|
-
}
|
|
118
|
-
|
|
117
|
+
}
|
|
118
|
+
async getZones(options) {
|
|
119
119
|
return await this._getJson(`${BASE_PATH}/package/getZones.cgi`, undefined, options);
|
|
120
|
-
}
|
|
121
|
-
|
|
120
|
+
}
|
|
121
|
+
async setZones(zonesJsonString, options) {
|
|
122
122
|
return await this._postJsonEncoded(`${BASE_PATH}/package/setZones.cgi`, zonesJsonString, this.apiUser, options);
|
|
123
|
-
}
|
|
124
|
-
|
|
123
|
+
}
|
|
124
|
+
async goToCoordinates(lat, lon, alt, options) {
|
|
125
125
|
const agent = this.getClient(options?.proxyParams);
|
|
126
126
|
return await agent.get({
|
|
127
127
|
path: `${BASE_PATH}/package/goToCoordinates.cgi`,
|
|
128
128
|
parameters: { lat, lon, alt, ...this.apiUser },
|
|
129
129
|
timeout: options?.timeout,
|
|
130
130
|
});
|
|
131
|
-
}
|
|
132
|
-
|
|
131
|
+
}
|
|
132
|
+
async checkGenetecConnection(params, options) {
|
|
133
133
|
return await this._postUrlEncoded(`${BASE_PATH}/package/checkGenetecConnection.cgi`, params, options);
|
|
134
|
-
}
|
|
135
|
-
|
|
134
|
+
}
|
|
135
|
+
async getGenetecCameraList(params, options) {
|
|
136
136
|
const res = await this._postUrlEncoded(`${BASE_PATH}/package/getGenetecCameraList.cgi`, params, options);
|
|
137
137
|
return await res.json();
|
|
138
|
-
}
|
|
138
|
+
}
|
|
139
139
|
async _getJson(path, parameters, options) {
|
|
140
140
|
const agent = this.getClient(options?.proxyParams);
|
|
141
141
|
const res = await agent.get({
|
package/esm/VapixAPI.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as prettifyXml from 'prettify-xml';
|
|
2
1
|
import { arrayToUrl, isNullish, paramToUrl, responseStringify } from './internal/utils';
|
|
3
2
|
import { sdCardWatchedStatuses, APP_IDS, maxFpsResponseSchema, dateTimeinfoSchema, audioDeviceRequestSchema, audioSampleRatesResponseSchema, timeZoneSchema, getPortsResponseSchema, } from './types/VapixAPI';
|
|
4
3
|
import { ApplicationAPIError, MaxFPSError, NoDeviceInfoError, PtzNotSupportedError, SDCardActionError, SDCardJobError, } from './errors/errors';
|
|
@@ -7,8 +6,10 @@ import { z } from 'zod';
|
|
|
7
6
|
import { XMLParser } from 'fast-xml-parser';
|
|
8
7
|
export class VapixAPI {
|
|
9
8
|
client;
|
|
10
|
-
|
|
9
|
+
CustomFormData;
|
|
10
|
+
constructor(client, CustomFormData = FormData) {
|
|
11
11
|
this.client = client;
|
|
12
|
+
this.CustomFormData = CustomFormData;
|
|
12
13
|
}
|
|
13
14
|
getClient(proxyParams) {
|
|
14
15
|
return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
|
|
@@ -35,7 +36,11 @@ export class VapixAPI {
|
|
|
35
36
|
}
|
|
36
37
|
async getCameraImage(parameters, options) {
|
|
37
38
|
const agent = this.getClient(options?.proxyParams);
|
|
38
|
-
return await agent.get({
|
|
39
|
+
return (await agent.get({
|
|
40
|
+
path: '/axis-cgi/jpg/image.cgi',
|
|
41
|
+
parameters,
|
|
42
|
+
timeout: options?.timeout,
|
|
43
|
+
}));
|
|
39
44
|
}
|
|
40
45
|
async getEventDeclarations(options) {
|
|
41
46
|
const data = '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">' +
|
|
@@ -53,8 +58,7 @@ export class VapixAPI {
|
|
|
53
58
|
if (!res.ok) {
|
|
54
59
|
throw new Error(await responseStringify(res));
|
|
55
60
|
}
|
|
56
|
-
|
|
57
|
-
return prettifyXml(declarations);
|
|
61
|
+
return await res.text();
|
|
58
62
|
}
|
|
59
63
|
async getSupportedAudioSampleRate(options) {
|
|
60
64
|
const path = '/axis-cgi/audio/streamingcapabilities.cgi';
|
|
@@ -250,7 +254,6 @@ export class VapixAPI {
|
|
|
250
254
|
if (responseText.startsWith('# Error')) {
|
|
251
255
|
throw new Error(responseText);
|
|
252
256
|
}
|
|
253
|
-
return true;
|
|
254
257
|
}
|
|
255
258
|
async getGuardTourList(options) {
|
|
256
259
|
const gTourList = new Array();
|
|
@@ -455,7 +458,7 @@ export class VapixAPI {
|
|
|
455
458
|
}
|
|
456
459
|
}
|
|
457
460
|
async installApplication(data, fileName, options) {
|
|
458
|
-
const formData = new
|
|
461
|
+
const formData = new this.CustomFormData();
|
|
459
462
|
formData.append('packfil', data, fileName);
|
|
460
463
|
const agent = this.getClient(options?.proxyParams);
|
|
461
464
|
const res = await agent.post({
|
package/esm/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export * from './internal/types';
|
|
|
2
2
|
export * from './internal/constants';
|
|
3
3
|
export * from './internal/utils';
|
|
4
4
|
export * from './internal/versionCompare';
|
|
5
|
+
export * from './internal/ProxyClient';
|
|
5
6
|
export * from './types/common';
|
|
6
7
|
export { CamSwitcherAPI } from './CamSwitcherAPI';
|
|
7
8
|
export { CamSwitcherEvents } from './CamSwitcherEvents';
|
|
@@ -15,9 +16,3 @@ export * from './types/CamSwitcherAPI';
|
|
|
15
16
|
export * from './types/VapixAPI';
|
|
16
17
|
export * from './types/CamOverlayAPI';
|
|
17
18
|
export * from './types/PlaneTrackerAPI';
|
|
18
|
-
export { Frame } from './CamOverlayPainter/Frame';
|
|
19
|
-
export { Painter } from './CamOverlayPainter/Painter';
|
|
20
|
-
export { ResourceManager } from './CamOverlayPainter/ResourceManager';
|
|
21
|
-
export * from './types/CamOverlayPainter';
|
|
22
|
-
export { CamOverlayDrawingAPI } from './CamOverlayDrawingAPI';
|
|
23
|
-
export * from './types/CamOverlayDrawingAPI';
|
|
@@ -6,19 +6,19 @@ export class ProxyClient {
|
|
|
6
6
|
this.client = client;
|
|
7
7
|
this.proxyParams = proxyParams;
|
|
8
8
|
}
|
|
9
|
-
get
|
|
9
|
+
get(params) {
|
|
10
10
|
const { path, parameters, headers, timeout } = params;
|
|
11
11
|
const targetPath = addParametersToPath(path, parameters);
|
|
12
12
|
const { realPath, realHeaders } = this.getReal(targetPath, headers);
|
|
13
13
|
return this.client.get({ path: realPath, headers: realHeaders, timeout });
|
|
14
|
-
}
|
|
15
|
-
post
|
|
14
|
+
}
|
|
15
|
+
post(params) {
|
|
16
16
|
const { path, data, parameters, headers, timeout } = params;
|
|
17
17
|
const targetPath = addParametersToPath(path, parameters);
|
|
18
18
|
const { realPath, realHeaders } = this.getReal(targetPath, headers);
|
|
19
19
|
return this.client.post({ path: realPath, data, headers: realHeaders, timeout });
|
|
20
|
-
}
|
|
21
|
-
getReal
|
|
20
|
+
}
|
|
21
|
+
getReal(targetPath, headers) {
|
|
22
22
|
return {
|
|
23
23
|
realPath: this.proxyParams.path,
|
|
24
24
|
realHeaders: {
|
|
@@ -32,5 +32,5 @@ export class ProxyClient {
|
|
|
32
32
|
'x-target-camera-user': this.proxyParams.target.user,
|
|
33
33
|
},
|
|
34
34
|
};
|
|
35
|
-
}
|
|
35
|
+
}
|
|
36
36
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export class WsEvents {
|
|
2
|
+
zodSchema;
|
|
3
|
+
ws;
|
|
4
|
+
_isDestroyed = false;
|
|
5
|
+
listeners = {};
|
|
6
|
+
constructor(zodSchema, ws) {
|
|
7
|
+
this.zodSchema = zodSchema;
|
|
8
|
+
this.ws = ws;
|
|
9
|
+
this.ws.onmessage = (e) => this.onMessage(e);
|
|
10
|
+
}
|
|
11
|
+
get isDestroyed() {
|
|
12
|
+
return this._isDestroyed;
|
|
13
|
+
}
|
|
14
|
+
resendInitData() {
|
|
15
|
+
const request = {
|
|
16
|
+
command: 'sendInitData',
|
|
17
|
+
};
|
|
18
|
+
this.ws.send(JSON.stringify(request));
|
|
19
|
+
}
|
|
20
|
+
addListener(type, listener, id) {
|
|
21
|
+
const typeList = this.listeners[type];
|
|
22
|
+
if (typeList === undefined) {
|
|
23
|
+
this.listeners[type] = { [id]: listener };
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
typeList[id] = listener;
|
|
27
|
+
}
|
|
28
|
+
removeListener(type, id) {
|
|
29
|
+
const typeList = this.listeners[type];
|
|
30
|
+
if (typeList) {
|
|
31
|
+
delete typeList[id];
|
|
32
|
+
if (Object.keys(typeList).length === 0) {
|
|
33
|
+
delete this.listeners[type];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
onMessage(evt) {
|
|
38
|
+
if (this.isDestroyed) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
const eventData = JSON.parse(evt.data);
|
|
43
|
+
const data = this.zodSchema.parse(eventData);
|
|
44
|
+
if (isInitEvent(data)) {
|
|
45
|
+
this.processMessage(data.data, true);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
this.processMessage(data, false);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error('Error parsing event data:', evt.data, error);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
processMessage(event, isInit) {
|
|
55
|
+
const listeners = this.listeners[event.type];
|
|
56
|
+
const list = Object.values(listeners ?? {});
|
|
57
|
+
list.forEach((listener) => listener(event, isInit));
|
|
58
|
+
}
|
|
59
|
+
destroy() {
|
|
60
|
+
this._isDestroyed = true;
|
|
61
|
+
this.ws.onmessage = () => { };
|
|
62
|
+
this.ws.destroy();
|
|
63
|
+
this.listeners = {};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const isInitEvent = (event) => {
|
|
67
|
+
return event.type === 'init';
|
|
68
|
+
};
|
|
@@ -22,16 +22,16 @@ export class DefaultClient {
|
|
|
22
22
|
}
|
|
23
23
|
this.httpRequestSender = new HttpRequestSender(agentOptions);
|
|
24
24
|
}
|
|
25
|
-
get
|
|
25
|
+
get(params) {
|
|
26
26
|
const { path, parameters, headers, timeout } = params;
|
|
27
27
|
const options = this.getBaseConnectionParams('GET', path, parameters, headers, timeout);
|
|
28
28
|
return this.httpRequestSender.sendRequest(options);
|
|
29
|
-
}
|
|
30
|
-
post
|
|
29
|
+
}
|
|
30
|
+
post(params) {
|
|
31
31
|
const { path, data, parameters, headers, timeout } = params;
|
|
32
32
|
const options = this.getBaseConnectionParams('POST', path, parameters, headers, timeout);
|
|
33
33
|
return this.httpRequestSender.sendRequest(options, data);
|
|
34
|
-
}
|
|
34
|
+
}
|
|
35
35
|
getBaseConnectionParams(method, path, params, headers, timeout) {
|
|
36
36
|
return {
|
|
37
37
|
method: method,
|
package/esm/node/WsClient.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { pad } from '
|
|
2
|
-
import { ProxyClient } from '
|
|
3
|
-
import { DefaultClient } from '../
|
|
1
|
+
import { pad } from '../../internal/utils';
|
|
2
|
+
import { ProxyClient } from '../../internal/ProxyClient';
|
|
3
|
+
import { DefaultClient } from '../DefaultClient';
|
|
4
4
|
export class AxisCameraStationEvents {
|
|
5
5
|
sourceKey;
|
|
6
6
|
client;
|
package/esm/node/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './DefaultClient';
|
|
2
2
|
export * from './WsClient';
|
|
3
3
|
export * from './HttpServer';
|
|
4
|
-
export * from '
|
|
5
|
-
export * from '
|
|
4
|
+
export * from './events/AxisCameraStationEvents';
|
|
5
|
+
export * from './events/GenetecAgent';
|
|
@@ -8,10 +8,10 @@ import { pipSchema } from './pipSchema';
|
|
|
8
8
|
import { customGraphicsSchema } from './customGraphicsSchema';
|
|
9
9
|
import { screenSharingSchema } from './screenSharingSchema';
|
|
10
10
|
import { webCameraSharingSchema } from './webCameraSharingSchema';
|
|
11
|
+
import { baseballScoreBoardAutomaticSchema, baseballScoreBoardSchema, scoreBoardSchema, scoreOverviewSchema, } from './scoreBoardSchema';
|
|
11
12
|
export const WSResponseSchema = z.object({
|
|
12
13
|
status: z.number(),
|
|
13
14
|
message: z.string(),
|
|
14
|
-
data: z.string(),
|
|
15
15
|
});
|
|
16
16
|
export const widgetsSchema = z.discriminatedUnion('name', [
|
|
17
17
|
infoTickerSchema,
|
|
@@ -23,6 +23,10 @@ export const widgetsSchema = z.discriminatedUnion('name', [
|
|
|
23
23
|
customGraphicsSchema,
|
|
24
24
|
screenSharingSchema,
|
|
25
25
|
webCameraSharingSchema,
|
|
26
|
+
scoreBoardSchema,
|
|
27
|
+
baseballScoreBoardSchema,
|
|
28
|
+
baseballScoreBoardAutomaticSchema,
|
|
29
|
+
scoreOverviewSchema,
|
|
26
30
|
]);
|
|
27
31
|
export const widgetListSchema = z.object({
|
|
28
32
|
services: z.array(widgetsSchema),
|
|
@@ -36,6 +40,10 @@ export const isPtzCompass = (widget) => widget.name === 'ptzCompass';
|
|
|
36
40
|
export const isPtz = (widget) => widget.name === 'ptz';
|
|
37
41
|
export const isScreenSharing = (widget) => widget.name === 'screenSharing';
|
|
38
42
|
export const isWebCameraSharing = (widget) => widget.name === 'web_camera';
|
|
43
|
+
export const isScoreBoard = (widget) => widget.name === 'scoreBoard';
|
|
44
|
+
export const isBaseballScoreBoard = (widget) => widget.name === 'baseballScoreBoard';
|
|
45
|
+
export const isBaseballScoreBoardAutomatic = (widget) => widget.name === 'myBallBaseballWidgets';
|
|
46
|
+
export const isScoreOverview = (widget) => widget.name === 'scoreOverview';
|
|
39
47
|
export var ImageType;
|
|
40
48
|
(function (ImageType) {
|
|
41
49
|
ImageType[ImageType["PNG"] = 0] = "PNG";
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { coordinateSystemSchema } from './widgetCommonTypes';
|
|
3
|
+
export const sportFontSchema = z.union([z.literal('classic'), z.intersection(z.string(), z.object({}))]);
|
|
4
|
+
export const scoreBoardSchema = z.object({
|
|
5
|
+
id: z.number().nonnegative(),
|
|
6
|
+
enabled: z.union([z.literal(0), z.literal(1)]),
|
|
7
|
+
schedule: z.string().optional(),
|
|
8
|
+
cameraList: z.array(z.number()),
|
|
9
|
+
zIndex: z.number().nonnegative(),
|
|
10
|
+
name: z.literal('scoreBoard'),
|
|
11
|
+
pos_x: z.number(),
|
|
12
|
+
pos_y: z.number(),
|
|
13
|
+
coordSystem: coordinateSystemSchema,
|
|
14
|
+
width: z.number(),
|
|
15
|
+
height: z.number(),
|
|
16
|
+
scale: z.number(),
|
|
17
|
+
teamHomeShortname: z.string(),
|
|
18
|
+
teamGuestShortname: z.string(),
|
|
19
|
+
teamHomeBackgroundColor: z.string(),
|
|
20
|
+
teamGuestBackgroundColor: z.string(),
|
|
21
|
+
teamHomeTextColor: z.string(),
|
|
22
|
+
teamGuestTextColor: z.string(),
|
|
23
|
+
teamHomeImgPath: z.string(),
|
|
24
|
+
teamGuestImgPath: z.string(),
|
|
25
|
+
teamHomeCurrentScore: z.number(),
|
|
26
|
+
teamGuestCurrentScore: z.number(),
|
|
27
|
+
baseTimeTimestamp: z.number(),
|
|
28
|
+
baseTimePlaytime: z.number(),
|
|
29
|
+
currentPeriodPlaytime: z.number(),
|
|
30
|
+
timeIsRunning: z.boolean(),
|
|
31
|
+
currentPeriodLength: z.number(),
|
|
32
|
+
currentPeriod: z.number(),
|
|
33
|
+
font: sportFontSchema.default('classic'),
|
|
34
|
+
});
|
|
35
|
+
export const baseballScoreBoardSchema = z.object({
|
|
36
|
+
id: z.number().nonnegative(),
|
|
37
|
+
enabled: z.union([z.literal(0), z.literal(1)]),
|
|
38
|
+
schedule: z.string().optional(),
|
|
39
|
+
cameraList: z.array(z.number()),
|
|
40
|
+
zIndex: z.number().nonnegative(),
|
|
41
|
+
name: z.literal('baseballScoreBoard'),
|
|
42
|
+
pos_x: z.number(),
|
|
43
|
+
pos_y: z.number(),
|
|
44
|
+
coordSystem: coordinateSystemSchema,
|
|
45
|
+
width: z.number(),
|
|
46
|
+
height: z.number(),
|
|
47
|
+
scale: z.number(),
|
|
48
|
+
matchFinished: z.boolean(),
|
|
49
|
+
bases: z.tuple([z.boolean(), z.boolean(), z.boolean()]),
|
|
50
|
+
homeInning: z.boolean(),
|
|
51
|
+
inning: z.number().nonnegative(),
|
|
52
|
+
outs: z.number().nonnegative(),
|
|
53
|
+
balls: z.number().nonnegative(),
|
|
54
|
+
strikes: z.number().nonnegative(),
|
|
55
|
+
baseTimeTimestamp: z.number(),
|
|
56
|
+
baseTimePlaytime: z.number(),
|
|
57
|
+
timeIsRunning: z.boolean(),
|
|
58
|
+
teamHomeShortname: z.string(),
|
|
59
|
+
teamGuestShortname: z.string(),
|
|
60
|
+
teamHomeBackgroundColor: z.string(),
|
|
61
|
+
teamGuestBackgroundColor: z.string(),
|
|
62
|
+
teamHomeTextColor: z.string(),
|
|
63
|
+
teamGuestTextColor: z.string(),
|
|
64
|
+
teamHomeCurrentScore: z.number(),
|
|
65
|
+
teamGuestCurrentScore: z.number(),
|
|
66
|
+
footerImgPath: z.string().optional(),
|
|
67
|
+
footerText: z.string().optional(),
|
|
68
|
+
footerBackgroundColor: z.string().optional(),
|
|
69
|
+
footerTextColor: z.string().optional(),
|
|
70
|
+
font: sportFontSchema.default('classic'),
|
|
71
|
+
});
|
|
72
|
+
export const baseballScoreBoardAutomaticSchema = z.object({
|
|
73
|
+
id: z.number().nonnegative(),
|
|
74
|
+
enabled: z.union([z.literal(0), z.literal(1)]),
|
|
75
|
+
schedule: z.string().optional(),
|
|
76
|
+
cameraList: z.array(z.number()),
|
|
77
|
+
zIndex: z.number().nonnegative(),
|
|
78
|
+
name: z.literal('myBallBaseballWidgets'),
|
|
79
|
+
width: z.number(),
|
|
80
|
+
height: z.number(),
|
|
81
|
+
scale: z.number(),
|
|
82
|
+
matchDetailLink: z.string(),
|
|
83
|
+
matchListLink: z.string(),
|
|
84
|
+
mirrored: z.boolean(),
|
|
85
|
+
pregameWidgetText: z.string(),
|
|
86
|
+
teamHomeBackgroundColor: z.string(),
|
|
87
|
+
teamGuestBackgroundColor: z.string(),
|
|
88
|
+
teamHomeTextColor: z.string(),
|
|
89
|
+
teamGuestTextColor: z.string(),
|
|
90
|
+
homeLogoPath: z.string(),
|
|
91
|
+
guestLogoPath: z.string(),
|
|
92
|
+
footerImgPath: z.string().optional(),
|
|
93
|
+
footerText: z.string().optional(),
|
|
94
|
+
footerBackgroundColor: z.string().optional(),
|
|
95
|
+
footerTextColor: z.string().optional(),
|
|
96
|
+
font: sportFontSchema.default('classic'),
|
|
97
|
+
});
|
|
98
|
+
export const scoreOverviewSchema = z.object({
|
|
99
|
+
id: z.number().nonnegative(),
|
|
100
|
+
enabled: z.union([z.literal(0), z.literal(1)]),
|
|
101
|
+
cameraList: z.array(z.number()),
|
|
102
|
+
zIndex: z.number().nonnegative(),
|
|
103
|
+
name: z.literal('scoreOverview'),
|
|
104
|
+
pos_x: z.number(),
|
|
105
|
+
pos_y: z.number(),
|
|
106
|
+
coordSystem: coordinateSystemSchema,
|
|
107
|
+
width: z.number(),
|
|
108
|
+
height: z.number(),
|
|
109
|
+
scale: z.number(),
|
|
110
|
+
teamHomeName: z.string(),
|
|
111
|
+
teamGuestName: z.string(),
|
|
112
|
+
teamHomeBackgroundColor: z.string(),
|
|
113
|
+
teamGuestBackgroundColor: z.string(),
|
|
114
|
+
teamHomeTextColor: z.string(),
|
|
115
|
+
teamGuestTextColor: z.string(),
|
|
116
|
+
teamHomeImgPath: z.string(),
|
|
117
|
+
teamGuestImgPath: z.string(),
|
|
118
|
+
teamHomeCurrentScore: z.number(),
|
|
119
|
+
teamGuestCurrentScore: z.number(),
|
|
120
|
+
scoreVisible: z.boolean(),
|
|
121
|
+
description: z.string(),
|
|
122
|
+
textFont: sportFontSchema.default('classic'),
|
|
123
|
+
scoreFont: z.literal('classic'),
|
|
124
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export const
|
|
2
|
+
export const cameraStreamSchema = z.object({
|
|
3
3
|
enabled: z.string(),
|
|
4
4
|
active: z.string(),
|
|
5
5
|
audioSource: z.string(),
|
|
@@ -22,7 +22,34 @@ export const streamAttributesSchema = z.object({
|
|
|
22
22
|
startTime: z.string(),
|
|
23
23
|
stopTime: z.string(),
|
|
24
24
|
});
|
|
25
|
-
export const
|
|
25
|
+
export const streamSchema = z.object({
|
|
26
|
+
enabled: z.union([z.literal(0), z.literal(1)]),
|
|
27
|
+
active: z.union([z.literal(0), z.literal(1)]),
|
|
28
|
+
audioSource: z.string(),
|
|
29
|
+
avSyncMsec: z.number().int(),
|
|
30
|
+
internalVapixParameters: z.string(),
|
|
31
|
+
userVapixParameters: z.string(),
|
|
32
|
+
outputParameters: z.string(),
|
|
33
|
+
outputType: z.union([z.literal('video'), z.literal('images'), z.literal('none')]),
|
|
34
|
+
mediaServerUrl: z.string(),
|
|
35
|
+
inputType: z.union([z.literal('CSw'), z.literal('CRS'), z.literal('RTSP_URL')]),
|
|
36
|
+
inputUrl: z.string(),
|
|
37
|
+
forceStereo: z.union([z.literal(0), z.literal(1)]),
|
|
38
|
+
streamDelay: z.number().nullable(),
|
|
39
|
+
statusLed: z.number(),
|
|
40
|
+
statusPort: z.string(),
|
|
41
|
+
callApi: z.number().int(),
|
|
42
|
+
trigger: z.string(),
|
|
43
|
+
schedule: z.string(),
|
|
44
|
+
prepareAhead: z.number().int(),
|
|
45
|
+
startTime: z.number().nullable(),
|
|
46
|
+
stopTime: z.number().nullable(),
|
|
47
|
+
});
|
|
48
|
+
export const cameraStreamResponseSchema = z.object({
|
|
49
|
+
data: cameraStreamSchema,
|
|
50
|
+
code: z.number(),
|
|
51
|
+
message: z.string(),
|
|
52
|
+
});
|
|
26
53
|
export const camstreamerServerResponseSchema = z.object({
|
|
27
54
|
code: z.number(),
|
|
28
55
|
message: z.string(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "camstreamerlib",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.35",
|
|
4
4
|
"description": "Helper library for CamStreamer ACAP applications.",
|
|
5
5
|
"prettier": "@camstreamer/prettier-config",
|
|
6
6
|
"engine": {
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"eventemitter2": "^5.0.1",
|
|
12
12
|
"fast-xml-parser": "^5.2.5",
|
|
13
13
|
"lodash": "^4.17.21",
|
|
14
|
-
"prettify-xml": "^1.2.0",
|
|
15
14
|
"type-fest": "^4.41.0",
|
|
16
15
|
"undici": "^6.21.3",
|
|
17
16
|
"ws": "^8.18.0",
|
|
@@ -55,6 +54,27 @@
|
|
|
55
54
|
"/**/*.js",
|
|
56
55
|
"/**/*.ts"
|
|
57
56
|
],
|
|
57
|
+
"type": "module",
|
|
58
|
+
"main": "./cjs/index.js",
|
|
59
|
+
"module": "./esm/index.js",
|
|
60
|
+
"types": "types/index.d.ts",
|
|
61
|
+
"exports": {
|
|
62
|
+
".": {
|
|
63
|
+
"import": "./esm/index.js",
|
|
64
|
+
"require": "./cjs/index.js",
|
|
65
|
+
"types": "./types/index.d.ts"
|
|
66
|
+
},
|
|
67
|
+
"./web": {
|
|
68
|
+
"import": "./esm/web/index.js",
|
|
69
|
+
"require": "./cjs/web/index.js",
|
|
70
|
+
"types": "./types/web/index.d.ts"
|
|
71
|
+
},
|
|
72
|
+
"./node": {
|
|
73
|
+
"import": "./esm/node/index.js",
|
|
74
|
+
"require": "./cjs/node/index.js",
|
|
75
|
+
"types": "./types/node/index.d.ts"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
58
78
|
"repository": {
|
|
59
79
|
"type": "git",
|
|
60
80
|
"url": "git+https://github.com/CamStreamer/CamStreamerLib.git"
|