camstreamerlib 4.0.0-beta.99 → 4.0.1
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/README.md +44 -15
- package/cjs/CamOverlayAPI.d.ts +145 -107
- package/cjs/CamOverlayAPI.js +14 -63
- package/cjs/CamScripterAPI.d.ts +5 -8
- package/cjs/CamScripterAPI.js +11 -29
- package/cjs/CamStreamerAPI.d.ts +2362 -806
- package/cjs/CamStreamerAPI.js +68 -76
- package/cjs/CamSwitcherAPI.d.ts +23 -22
- package/cjs/CamSwitcherAPI.js +30 -88
- package/cjs/PlaneTrackerAPI.d.ts +28 -30
- package/cjs/PlaneTrackerAPI.js +20 -75
- package/cjs/VapixAPI.d.ts +36 -23
- package/cjs/VapixAPI.js +227 -106
- package/cjs/errors/errors.d.ts +11 -5
- package/cjs/errors/errors.js +5 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +1 -0
- package/cjs/internal/BasicAPI.d.ts +15 -0
- package/cjs/internal/BasicAPI.js +93 -0
- package/cjs/internal/WsEvents.d.ts +1 -0
- package/cjs/internal/WsEvents.js +5 -0
- package/cjs/internal/constants.d.ts +1 -0
- package/cjs/internal/constants.js +2 -1
- package/cjs/internal/convertors.d.ts +6 -0
- package/cjs/internal/convertors.js +115 -0
- package/cjs/internal/transformers.js +8 -8
- package/cjs/internal/types.d.ts +3 -0
- package/cjs/internal/versionCompare.d.ts +2 -2
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.d.ts +878 -358
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +54 -11
- package/cjs/types/CamOverlayAPI/accuweatherSchema.d.ts +10 -10
- package/cjs/types/CamOverlayAPI/customGraphicsSchema.d.ts +28 -28
- package/cjs/types/CamOverlayAPI/htmlOverlaySchema.d.ts +81 -0
- package/cjs/types/CamOverlayAPI/htmlOverlaySchema.js +21 -0
- package/cjs/types/CamOverlayAPI/imagesSchema.d.ts +10 -10
- package/cjs/types/CamOverlayAPI/index.d.ts +1 -0
- package/cjs/types/CamOverlayAPI/index.js +1 -0
- package/cjs/types/CamOverlayAPI/infotickerSchema.d.ts +8 -8
- package/cjs/types/CamOverlayAPI/pipSchema.d.ts +8 -8
- package/cjs/types/CamOverlayAPI/ptzCompassSchema.d.ts +10 -10
- package/cjs/types/CamOverlayAPI/ptzSchema.d.ts +13 -13
- package/cjs/types/CamOverlayAPI/scoreBoardSchema.d.ts +18 -18
- package/cjs/types/CamOverlayAPI/screenSharingSchema.d.ts +8 -8
- package/cjs/types/CamOverlayAPI/serviceCommonTypes.d.ts +17 -16
- package/cjs/types/CamOverlayAPI/serviceCommonTypes.js +6 -3
- package/cjs/types/CamOverlayAPI/webCameraSharingSchema.d.ts +8 -8
- package/cjs/types/CamScripterAPI.d.ts +0 -11
- package/cjs/types/CamScripterAPI.js +1 -5
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.d.ts +17745 -4940
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.js +126 -57
- package/cjs/types/CamStreamerAPI/facebookSchema.d.ts +395 -86
- package/cjs/types/CamStreamerAPI/facebookSchema.js +13 -1
- package/cjs/types/CamStreamerAPI/index.d.ts +1 -3
- package/cjs/types/CamStreamerAPI/index.js +1 -3
- package/cjs/types/CamStreamerAPI/oldStreamSchema.d.ts +47 -47
- package/cjs/types/CamStreamerAPI/oldStreamSchema.js +1 -1
- package/cjs/types/CamStreamerAPI/streamCommonTypes.d.ts +392 -304
- package/cjs/types/CamStreamerAPI/streamCommonTypes.js +116 -76
- package/cjs/types/CamStreamerAPI/streamsSchema.d.ts +8812 -0
- package/cjs/types/CamStreamerAPI/streamsSchema.js +81 -0
- package/cjs/types/CamStreamerAPI/windySchema.d.ts +356 -87
- package/cjs/types/CamStreamerAPI/windySchema.js +9 -1
- package/cjs/types/CamStreamerAPI/youtubeSchema.d.ts +351 -119
- package/cjs/types/CamStreamerAPI/youtubeSchema.js +5 -9
- package/cjs/types/CamSwitcherAPI.d.ts +96 -91
- package/cjs/types/CamSwitcherAPI.js +9 -9
- package/cjs/types/GenetecAgent.d.ts +2 -2
- package/cjs/types/PlaneTrackerAPI.d.ts +60 -47
- package/cjs/types/PlaneTrackerAPI.js +5 -2
- package/cjs/types/VapixAPI.d.ts +51 -32
- package/cjs/types/VapixAPI.js +10 -3
- package/cjs/types/common.d.ts +27 -0
- package/cjs/types/common.js +13 -1
- package/cjs/types/ws/CamStreamerEvents.d.ts +110 -77
- package/cjs/types/ws/CamStreamerEvents.js +11 -7
- package/cjs/types/ws/CamSwitcherEvents.d.ts +8 -8
- package/cjs/types/ws/PlaneTrackerEvents.d.ts +3 -3
- package/esm/CamOverlayAPI.js +16 -65
- package/esm/CamScripterAPI.js +9 -30
- package/esm/CamStreamerAPI.js +70 -78
- package/esm/CamSwitcherAPI.js +31 -89
- package/esm/PlaneTrackerAPI.js +21 -76
- package/esm/VapixAPI.js +228 -107
- package/esm/errors/errors.js +5 -1
- package/esm/index.js +1 -0
- package/esm/internal/BasicAPI.js +89 -0
- package/esm/internal/WsEvents.js +5 -0
- package/esm/internal/constants.js +1 -0
- package/esm/internal/convertors.js +108 -0
- package/esm/internal/transformers.js +1 -1
- package/esm/types/CamOverlayAPI/CamOverlayAPI.js +47 -10
- package/esm/types/CamOverlayAPI/htmlOverlaySchema.js +18 -0
- package/esm/types/CamOverlayAPI/index.js +1 -0
- package/esm/types/CamOverlayAPI/serviceCommonTypes.js +6 -3
- package/esm/types/CamScripterAPI.js +0 -4
- package/esm/types/CamStreamerAPI/CamStreamerAPI.js +109 -41
- package/esm/types/CamStreamerAPI/facebookSchema.js +13 -1
- package/esm/types/CamStreamerAPI/index.js +1 -3
- package/esm/types/CamStreamerAPI/oldStreamSchema.js +1 -1
- package/esm/types/CamStreamerAPI/streamCommonTypes.js +116 -76
- package/esm/types/CamStreamerAPI/streamsSchema.js +75 -0
- package/esm/types/CamStreamerAPI/windySchema.js +9 -1
- package/esm/types/CamStreamerAPI/youtubeSchema.js +5 -9
- package/esm/types/CamSwitcherAPI.js +8 -8
- package/esm/types/PlaneTrackerAPI.js +5 -2
- package/esm/types/VapixAPI.js +9 -2
- package/esm/types/common.js +12 -0
- package/esm/types/ws/CamStreamerEvents.js +11 -7
- package/package.json +4 -4
- package/types/CamOverlayAPI.d.ts +145 -107
- package/types/CamScripterAPI.d.ts +5 -8
- package/types/CamStreamerAPI.d.ts +2362 -806
- package/types/CamSwitcherAPI.d.ts +23 -22
- package/types/PlaneTrackerAPI.d.ts +28 -30
- package/types/VapixAPI.d.ts +36 -23
- package/types/errors/errors.d.ts +11 -5
- package/types/index.d.ts +1 -0
- package/types/internal/BasicAPI.d.ts +15 -0
- package/types/internal/WsEvents.d.ts +1 -0
- package/types/internal/constants.d.ts +1 -0
- package/types/internal/convertors.d.ts +6 -0
- package/types/internal/types.d.ts +3 -0
- package/types/internal/versionCompare.d.ts +2 -2
- package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +878 -358
- package/types/types/CamOverlayAPI/accuweatherSchema.d.ts +10 -10
- package/types/types/CamOverlayAPI/customGraphicsSchema.d.ts +28 -28
- package/types/types/CamOverlayAPI/htmlOverlaySchema.d.ts +81 -0
- package/types/types/CamOverlayAPI/imagesSchema.d.ts +10 -10
- package/types/types/CamOverlayAPI/index.d.ts +1 -0
- package/types/types/CamOverlayAPI/infotickerSchema.d.ts +8 -8
- package/types/types/CamOverlayAPI/pipSchema.d.ts +8 -8
- package/types/types/CamOverlayAPI/ptzCompassSchema.d.ts +10 -10
- package/types/types/CamOverlayAPI/ptzSchema.d.ts +13 -13
- package/types/types/CamOverlayAPI/scoreBoardSchema.d.ts +18 -18
- package/types/types/CamOverlayAPI/screenSharingSchema.d.ts +8 -8
- package/types/types/CamOverlayAPI/serviceCommonTypes.d.ts +17 -16
- package/types/types/CamOverlayAPI/webCameraSharingSchema.d.ts +8 -8
- package/types/types/CamScripterAPI.d.ts +0 -11
- package/types/types/CamStreamerAPI/CamStreamerAPI.d.ts +17745 -4940
- package/types/types/CamStreamerAPI/facebookSchema.d.ts +395 -86
- package/types/types/CamStreamerAPI/index.d.ts +1 -3
- package/types/types/CamStreamerAPI/oldStreamSchema.d.ts +47 -47
- package/types/types/CamStreamerAPI/streamCommonTypes.d.ts +392 -304
- package/types/types/CamStreamerAPI/streamsSchema.d.ts +8812 -0
- package/types/types/CamStreamerAPI/windySchema.d.ts +356 -87
- package/types/types/CamStreamerAPI/youtubeSchema.d.ts +351 -119
- package/types/types/CamSwitcherAPI.d.ts +96 -91
- package/types/types/GenetecAgent.d.ts +2 -2
- package/types/types/PlaneTrackerAPI.d.ts +60 -47
- package/types/types/VapixAPI.d.ts +51 -32
- package/types/types/common.d.ts +27 -0
- package/types/types/ws/CamStreamerEvents.d.ts +110 -77
- package/types/types/ws/CamSwitcherEvents.d.ts +8 -8
- package/types/types/ws/PlaneTrackerEvents.d.ts +3 -3
- package/cjs/types/CamStreamerAPI/churchSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/churchSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/daCastSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/daCastSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/dailymotionSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/dailymotionSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/gameChangerSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/gameChangerSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/hlsPullSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/hlsPullSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/hlsPushSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/hlsPushSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/ibmSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/ibmSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/microsoftAzureSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/microsoftAzureSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/microsoftStreamSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/microsoftStreamSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/mpegDvbSchema.d.ts +0 -323
- package/cjs/types/CamStreamerAPI/mpegDvbSchema.js +0 -27
- package/cjs/types/CamStreamerAPI/rtmpSchema.d.ts +0 -284
- package/cjs/types/CamStreamerAPI/rtmpSchema.js +0 -14
- package/cjs/types/CamStreamerAPI/sdCardSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/sdCardSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/srtSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/srtSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/twitchSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/twitchSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/vimeoSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/vimeoSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/wowzaSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/wowzaSchema.js +0 -11
- package/esm/types/CamStreamerAPI/churchSchema.js +0 -5
- package/esm/types/CamStreamerAPI/daCastSchema.js +0 -5
- package/esm/types/CamStreamerAPI/dailymotionSchema.js +0 -5
- package/esm/types/CamStreamerAPI/gameChangerSchema.js +0 -5
- package/esm/types/CamStreamerAPI/hlsPullSchema.js +0 -5
- package/esm/types/CamStreamerAPI/hlsPushSchema.js +0 -5
- package/esm/types/CamStreamerAPI/ibmSchema.js +0 -5
- package/esm/types/CamStreamerAPI/microsoftAzureSchema.js +0 -5
- package/esm/types/CamStreamerAPI/microsoftStreamSchema.js +0 -5
- package/esm/types/CamStreamerAPI/mpegDvbSchema.js +0 -21
- package/esm/types/CamStreamerAPI/rtmpSchema.js +0 -8
- package/esm/types/CamStreamerAPI/sdCardSchema.js +0 -5
- package/esm/types/CamStreamerAPI/srtSchema.js +0 -5
- package/esm/types/CamStreamerAPI/twitchSchema.js +0 -5
- package/esm/types/CamStreamerAPI/vimeoSchema.js +0 -5
- package/esm/types/CamStreamerAPI/wowzaSchema.js +0 -5
- package/types/types/CamStreamerAPI/churchSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/daCastSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/dailymotionSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/gameChangerSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/hlsPullSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/hlsPushSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/ibmSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/microsoftAzureSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/microsoftStreamSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/mpegDvbSchema.d.ts +0 -323
- package/types/types/CamStreamerAPI/rtmpSchema.d.ts +0 -284
- package/types/types/CamStreamerAPI/sdCardSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/srtSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/twitchSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/vimeoSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/wowzaSchema.d.ts +0 -275
package/cjs/CamStreamerAPI.js
CHANGED
|
@@ -2,20 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseCameraStreamResponse = exports.CamStreamerAPI = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const ProxyClient_1 = require("./internal/ProxyClient");
|
|
6
5
|
const CamStreamerAPI_1 = require("./types/CamStreamerAPI/CamStreamerAPI");
|
|
7
6
|
const errors_1 = require("./errors/errors");
|
|
8
7
|
const oldStreamSchema_1 = require("./types/CamStreamerAPI/oldStreamSchema");
|
|
9
|
-
const
|
|
8
|
+
const BasicAPI_1 = require("./internal/BasicAPI");
|
|
9
|
+
const CamStreamerAPI_2 = require("./types/CamStreamerAPI");
|
|
10
10
|
const BASE_PATH = '/local/camstreamer';
|
|
11
|
-
class CamStreamerAPI {
|
|
12
|
-
client;
|
|
13
|
-
constructor(client) {
|
|
14
|
-
this.client = client;
|
|
15
|
-
}
|
|
11
|
+
class CamStreamerAPI extends BasicAPI_1.BasicAPI {
|
|
16
12
|
static getProxyPath = () => `${BASE_PATH}/proxy.cgi`;
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
static getWsEventsPath = () => `${BASE_PATH}/events`;
|
|
14
|
+
async checkAPIAvailable(options) {
|
|
15
|
+
await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
|
|
16
|
+
}
|
|
17
|
+
async checkCameraTime(options) {
|
|
18
|
+
const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
|
|
19
|
+
return zod_1.z.boolean().parse(res.data?.state);
|
|
19
20
|
}
|
|
20
21
|
async wsAuthorization(options) {
|
|
21
22
|
const res = await this._getJson(`${BASE_PATH}/ws_authorization.cgi`, undefined, options);
|
|
@@ -31,19 +32,35 @@ class CamStreamerAPI {
|
|
|
31
32
|
}
|
|
32
33
|
return zod_1.z.number().parse(res.data);
|
|
33
34
|
}
|
|
35
|
+
async getMaxFps(source = 0, options) {
|
|
36
|
+
return await this._getJson(`${BASE_PATH}/get_max_framerate.cgi`, { video_source: source.toString() }, options);
|
|
37
|
+
}
|
|
38
|
+
async isCSPassValid(pass, options) {
|
|
39
|
+
const res = await this._getJson(`${BASE_PATH}/check_pass.cgi`, { pass }, options);
|
|
40
|
+
return res.data === '1';
|
|
41
|
+
}
|
|
42
|
+
async getCamStreamerAppLog(options) {
|
|
43
|
+
return await this._getText(`${BASE_PATH}/view_log.cgi`, undefined, options);
|
|
44
|
+
}
|
|
34
45
|
async getStreamList(options) {
|
|
35
46
|
const res = await this._getJson(`${BASE_PATH}/stream_list.cgi`, { action: 'get' }, options);
|
|
36
47
|
const oldStreamListRecord = zod_1.z.record(zod_1.z.string(), oldStreamSchema_1.oldStringStreamSchema).safeParse(res.data);
|
|
37
48
|
if (oldStreamListRecord.success) {
|
|
38
|
-
const data = Object.entries(oldStreamListRecord.data).map(([
|
|
39
|
-
|
|
49
|
+
const data = Object.entries(oldStreamListRecord.data).map(([streamId, streamData]) => ({
|
|
50
|
+
streamId,
|
|
40
51
|
...(0, exports.parseCameraStreamResponse)(streamData),
|
|
41
52
|
}));
|
|
42
|
-
throw new errors_1.MigrationError([], data);
|
|
53
|
+
throw new errors_1.MigrationError([], data, [], []);
|
|
43
54
|
}
|
|
44
55
|
const newStreamData = [];
|
|
56
|
+
const unknownStreamData = [];
|
|
45
57
|
const oldStreamData = [];
|
|
58
|
+
const invalidStreamData = [];
|
|
46
59
|
for (const streamData of res.data.streamList) {
|
|
60
|
+
if (streamData.platform !== undefined && !Object.values(CamStreamerAPI_2.streamPlatforms).includes(streamData.platform)) {
|
|
61
|
+
unknownStreamData.push(streamData);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
47
64
|
const newStreamParse = CamStreamerAPI_1.streamSchema.safeParse(streamData);
|
|
48
65
|
if (newStreamParse.success) {
|
|
49
66
|
newStreamData.push(newStreamParse.data);
|
|
@@ -52,20 +69,20 @@ class CamStreamerAPI {
|
|
|
52
69
|
const oldStreamParse = oldStreamSchema_1.oldStringStreamSchemaWithId.safeParse(streamData);
|
|
53
70
|
if (oldStreamParse.success) {
|
|
54
71
|
oldStreamData.push({
|
|
55
|
-
|
|
72
|
+
streamId: oldStreamParse.data.streamId,
|
|
56
73
|
...(0, exports.parseCameraStreamResponse)(oldStreamParse.data),
|
|
57
74
|
});
|
|
58
75
|
continue;
|
|
59
76
|
}
|
|
60
|
-
|
|
77
|
+
invalidStreamData.push(streamData);
|
|
61
78
|
}
|
|
62
|
-
if (oldStreamData.length > 0) {
|
|
63
|
-
throw new errors_1.MigrationError(newStreamData, oldStreamData);
|
|
79
|
+
if (oldStreamData.length > 0 || invalidStreamData.length > 0) {
|
|
80
|
+
throw new errors_1.MigrationError(newStreamData, oldStreamData, invalidStreamData, unknownStreamData);
|
|
64
81
|
}
|
|
65
|
-
return newStreamData;
|
|
82
|
+
return [...newStreamData, ...unknownStreamData];
|
|
66
83
|
}
|
|
67
84
|
async setStreamList(streamList, options) {
|
|
68
|
-
await this._postJsonEncoded(`${BASE_PATH}/stream_list.cgi`,
|
|
85
|
+
await this._postJsonEncoded(`${BASE_PATH}/stream_list.cgi`, { streamList }, {
|
|
69
86
|
action: 'set',
|
|
70
87
|
}, options);
|
|
71
88
|
}
|
|
@@ -76,17 +93,30 @@ class CamStreamerAPI {
|
|
|
76
93
|
return newStream.data;
|
|
77
94
|
}
|
|
78
95
|
const oldStream = oldStreamSchema_1.oldStringStreamSchema.passthrough().parse(res.data);
|
|
79
|
-
throw new errors_1.MigrationError([], [{
|
|
96
|
+
throw new errors_1.MigrationError([], [{ streamId, ...(0, exports.parseCameraStreamResponse)(oldStream) }], [], []);
|
|
80
97
|
}
|
|
81
98
|
async setStream(streamId, streamData, options) {
|
|
82
|
-
await this._postJsonEncoded(`${BASE_PATH}/stream_list.cgi`,
|
|
99
|
+
await this._postJsonEncoded(`${BASE_PATH}/stream_list.cgi`, streamData, {
|
|
83
100
|
action: 'set',
|
|
84
101
|
stream_id: streamId,
|
|
85
102
|
}, options);
|
|
86
103
|
}
|
|
87
|
-
async
|
|
104
|
+
async getStreamNetworkStatistics(streamId, options) {
|
|
88
105
|
const res = await this._getJson(`${BASE_PATH}/get_streamstat.cgi`, { stream_id: streamId }, options);
|
|
89
|
-
return res.data
|
|
106
|
+
return CamStreamerAPI_1.streamStatsSchema.parse(res.data);
|
|
107
|
+
}
|
|
108
|
+
async getSrtStreamStatistics(streamId, options) {
|
|
109
|
+
const res = await this._getJson(`${BASE_PATH}/srt_statistics.cgi`, { stream_id: streamId }, options);
|
|
110
|
+
return CamStreamerAPI_1.srtStreamStatisticsSchema.parse(res.data);
|
|
111
|
+
}
|
|
112
|
+
async setStreamEnabled(streamId, enabled, options) {
|
|
113
|
+
await this._postUrlEncoded(`${BASE_PATH}/set_stream_enabled.cgi`, { stream_id: streamId, enabled: enabled ? 1 : 0 }, options);
|
|
114
|
+
}
|
|
115
|
+
async setStreamActive(streamId, active, options) {
|
|
116
|
+
await this._postUrlEncoded(`${BASE_PATH}/set_stream_active.cgi`, { stream_id: streamId, active: active ? 1 : 0 }, options);
|
|
117
|
+
}
|
|
118
|
+
async deleteStream(streamId, options) {
|
|
119
|
+
await this._postUrlEncoded(`${BASE_PATH}/remove.cgi`, { stream_id: streamId }, options);
|
|
90
120
|
}
|
|
91
121
|
async listFiles(options) {
|
|
92
122
|
const res = await this._getJson(`${BASE_PATH}/upload_audio.cgi`, { action: 'list' }, options);
|
|
@@ -99,7 +129,7 @@ class CamStreamerAPI {
|
|
|
99
129
|
}, options);
|
|
100
130
|
}
|
|
101
131
|
async removeFile(fileParams, options) {
|
|
102
|
-
await this._postUrlEncoded(`${BASE_PATH}/upload_audio.cgi`, { action: 'remove', ...fileParams }, options
|
|
132
|
+
await this._postUrlEncoded(`${BASE_PATH}/upload_audio.cgi`, { action: 'remove', ...fileParams }, options);
|
|
103
133
|
}
|
|
104
134
|
async getFileStorage(options) {
|
|
105
135
|
const res = await this._getJson(`${BASE_PATH}/upload_audio.cgi`, { action: 'get_storage' }, options);
|
|
@@ -108,59 +138,21 @@ class CamStreamerAPI {
|
|
|
108
138
|
async getFileFromCamera(path, options) {
|
|
109
139
|
return await this._getBlob(`${BASE_PATH}/audio.cgi`, { path }, options);
|
|
110
140
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
throw new errors_1.ErrorWithResponse(res);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
async parseBlobResponse(response) {
|
|
132
|
-
try {
|
|
133
|
-
return (await response.blob());
|
|
134
|
-
}
|
|
135
|
-
catch (err) {
|
|
136
|
-
throw new errors_1.ParsingBlobError(err);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
async _postUrlEncoded(path, parameters, options, headers) {
|
|
140
|
-
const data = (0, utils_1.paramToUrl)(parameters);
|
|
141
|
-
const baseHeaders = { 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
142
|
-
return this._post(path, data, undefined, options, { ...baseHeaders, ...headers });
|
|
143
|
-
}
|
|
144
|
-
async _postJsonEncoded(path, data, parameters, options, headers) {
|
|
145
|
-
const agent = this.getClient(options?.proxyParams);
|
|
146
|
-
const baseHeaders = { 'Accept': 'application/json', 'Content-Type': 'application/json' };
|
|
147
|
-
return agent.post({
|
|
148
|
-
path,
|
|
149
|
-
data,
|
|
150
|
-
parameters,
|
|
151
|
-
timeout: options?.timeout,
|
|
152
|
-
headers: { ...baseHeaders, ...headers },
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
async _post(path, data, parameters, options, headers) {
|
|
156
|
-
const agent = this.getClient(options?.proxyParams);
|
|
157
|
-
const res = await agent.post({ path, data, parameters, headers, timeout: options?.timeout });
|
|
158
|
-
if (res.ok) {
|
|
159
|
-
return await res.json();
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
throw new errors_1.ErrorWithResponse(res);
|
|
163
|
-
}
|
|
141
|
+
downloadReport(options) {
|
|
142
|
+
return this._getText(`${BASE_PATH}/report.cgi`, undefined, options);
|
|
143
|
+
}
|
|
144
|
+
async getDiagnostics(params, options) {
|
|
145
|
+
const convertedParams = {
|
|
146
|
+
camerainfo: params.camerainfo ? '1' : '0',
|
|
147
|
+
checkserver: params.checkserver ? '1' : '0',
|
|
148
|
+
checkservertime: params.checkservertime ? '1' : '0',
|
|
149
|
+
speedtest: params.speedtest ? '1' : '0',
|
|
150
|
+
pingtest: params.pingtest ? '1' : '0',
|
|
151
|
+
videoHostPort: params.videoHostPort,
|
|
152
|
+
audioHostPort: params.audioHostPort,
|
|
153
|
+
};
|
|
154
|
+
const res = await this._getJson(`${BASE_PATH}/diagnostics.cgi`, convertedParams, options);
|
|
155
|
+
return CamStreamerAPI_1.diagnosticsSchema.parse(res);
|
|
164
156
|
}
|
|
165
157
|
}
|
|
166
158
|
exports.CamStreamerAPI = CamStreamerAPI;
|
package/cjs/CamSwitcherAPI.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { IClient, TResponse } from './internal/types';
|
|
2
2
|
import { TStreamSaveList, TTrackerSaveList, TClipSaveList, TPlaylistSaveList, TCameraOptions, TGlobalAudioSettings, TSecondaryAudioSettings } from './types/CamSwitcherAPI';
|
|
3
|
-
import { TAudioChannel, THttpRequestOptions,
|
|
4
|
-
import {
|
|
5
|
-
export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> {
|
|
6
|
-
private client;
|
|
3
|
+
import { TAudioChannel, THttpRequestOptions, TStorageType } from './types/common';
|
|
4
|
+
import { BasicAPI } from './internal/BasicAPI';
|
|
5
|
+
export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> extends BasicAPI<Client> {
|
|
7
6
|
private CustomFormData;
|
|
8
7
|
private vapixAgent;
|
|
9
8
|
constructor(client: Client, CustomFormData?: {
|
|
@@ -13,7 +12,7 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> {
|
|
|
13
12
|
static getProxyPath: () => string;
|
|
14
13
|
static getWsEventsPath: () => string;
|
|
15
14
|
static getClipPreviewPath: (clipId: string, storage: TStorageType) => string;
|
|
16
|
-
|
|
15
|
+
checkAPIAvailable(options?: THttpRequestOptions): Promise<void>;
|
|
17
16
|
checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
|
|
18
17
|
getNetworkCameraList(options?: THttpRequestOptions): Promise<{
|
|
19
18
|
name: string;
|
|
@@ -22,9 +21,9 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> {
|
|
|
22
21
|
generateSilence(sampleRate: number, channels: TAudioChannel, options?: THttpRequestOptions): Promise<void>;
|
|
23
22
|
getMaxFps(source: number, options?: THttpRequestOptions): Promise<number>;
|
|
24
23
|
getStorageInfo(options?: THttpRequestOptions): Promise<{
|
|
24
|
+
size: number;
|
|
25
25
|
storage: "FLASH" | "SD_DISK";
|
|
26
26
|
writable: boolean;
|
|
27
|
-
size: number;
|
|
28
27
|
available: number;
|
|
29
28
|
}[]>;
|
|
30
29
|
wsAuthorization(options?: THttpRequestOptions): Promise<string>;
|
|
@@ -39,26 +38,26 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> {
|
|
|
39
38
|
}>;
|
|
40
39
|
getStreamSaveList(options?: THttpRequestOptions): Promise<Record<string, {
|
|
41
40
|
ip?: string | undefined;
|
|
41
|
+
enabled?: boolean | undefined;
|
|
42
|
+
port?: number | undefined;
|
|
42
43
|
niceName?: string | undefined;
|
|
43
44
|
mdnsName?: string | undefined;
|
|
44
|
-
port?: number | undefined;
|
|
45
|
-
enabled?: boolean | undefined;
|
|
46
45
|
auth?: string | undefined;
|
|
47
46
|
query?: string | undefined;
|
|
48
|
-
channel?: "
|
|
47
|
+
channel?: "video" | "audio" | "av" | undefined;
|
|
49
48
|
keyboard?: Record<string, string | null> | undefined;
|
|
50
49
|
sortIndexOverview?: number | undefined;
|
|
51
50
|
viewNumber?: number | undefined;
|
|
52
51
|
}>>;
|
|
53
52
|
getClipSaveList(options?: THttpRequestOptions): Promise<Record<string, {
|
|
54
53
|
niceName?: string | undefined;
|
|
55
|
-
channel?: "
|
|
54
|
+
channel?: "video" | "audio" | "av" | undefined;
|
|
56
55
|
keyboard?: Record<string, string | null> | undefined;
|
|
57
56
|
sortIndexOverview?: number | undefined;
|
|
58
57
|
}>>;
|
|
59
58
|
getPlaylistSaveList(options?: THttpRequestOptions): Promise<Record<string, {
|
|
60
59
|
niceName?: string | undefined;
|
|
61
|
-
channel?: "
|
|
60
|
+
channel?: "video" | "audio" | "av" | undefined;
|
|
62
61
|
keyboard?: Record<string, string | null> | undefined;
|
|
63
62
|
sortIndexOverview?: number | undefined;
|
|
64
63
|
isFavourite?: boolean | undefined;
|
|
@@ -87,16 +86,16 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> {
|
|
|
87
86
|
}>>;
|
|
88
87
|
getTrackerSaveList(options?: THttpRequestOptions): Promise<Record<string, {
|
|
89
88
|
name?: string | undefined;
|
|
90
|
-
|
|
89
|
+
fps?: number | undefined;
|
|
90
|
+
id?: string | undefined;
|
|
91
|
+
width?: number | undefined;
|
|
92
|
+
height?: number | undefined;
|
|
93
|
+
duration?: number | undefined;
|
|
94
|
+
channel?: "video" | "audio" | "av" | undefined;
|
|
91
95
|
keyboard?: Record<string, string | null> | undefined;
|
|
92
96
|
sortIndexOverview?: number | undefined;
|
|
93
97
|
viewNumber?: number | undefined;
|
|
94
|
-
id?: string | undefined;
|
|
95
98
|
previewId?: string | undefined;
|
|
96
|
-
duration?: number | undefined;
|
|
97
|
-
width?: number | undefined;
|
|
98
|
-
height?: number | undefined;
|
|
99
|
-
fps?: number | undefined;
|
|
100
99
|
motion_history_frames?: number | undefined;
|
|
101
100
|
include_zone?: number[][] | undefined;
|
|
102
101
|
include_node_ids?: string[] | undefined;
|
|
@@ -123,11 +122,12 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> {
|
|
|
123
122
|
removeClip(clipId: string, storage: TStorageType, options?: THttpRequestOptions): Promise<void>;
|
|
124
123
|
getClipList(options?: THttpRequestOptions): Promise<Record<string, {
|
|
125
124
|
storage: "FLASH" | "SD_DISK";
|
|
125
|
+
duration: number;
|
|
126
126
|
stream_list: ({
|
|
127
127
|
type: "video";
|
|
128
|
+
fps: number;
|
|
128
129
|
width: number;
|
|
129
130
|
height: number;
|
|
130
|
-
fps: number;
|
|
131
131
|
sample_rate: number;
|
|
132
132
|
h264_profile: "high" | "main" | "baseline";
|
|
133
133
|
h264_level: "4.1";
|
|
@@ -138,7 +138,6 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> {
|
|
|
138
138
|
sample_rate: number;
|
|
139
139
|
channel_count: 1 | 2;
|
|
140
140
|
})[];
|
|
141
|
-
duration: number;
|
|
142
141
|
}>>;
|
|
143
142
|
setCamSwitchOptions(data: TCameraOptions, cameraFWVersion: string, options?: THttpRequestOptions): Promise<void>;
|
|
144
143
|
setGlobalAudioSettings(settings: TGlobalAudioSettings, options?: THttpRequestOptions): Promise<void>;
|
|
@@ -147,7 +146,7 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> {
|
|
|
147
146
|
setPermanentRtspUrlToken(token: string, options?: THttpRequestOptions): Promise<void>;
|
|
148
147
|
getCamSwitchOptions(options?: THttpRequestOptions): Promise<any>;
|
|
149
148
|
getGlobalAudioSettings(options?: THttpRequestOptions): Promise<{
|
|
150
|
-
type: "
|
|
149
|
+
type: "source" | "fromSource";
|
|
151
150
|
source: string;
|
|
152
151
|
storage?: string | undefined;
|
|
153
152
|
}>;
|
|
@@ -160,8 +159,10 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> {
|
|
|
160
159
|
clipName?: string | undefined;
|
|
161
160
|
}>;
|
|
162
161
|
getPermanentRtspUrlToken(options?: THttpRequestOptions): Promise<string>;
|
|
163
|
-
|
|
164
|
-
private _post;
|
|
162
|
+
downloadReport(options?: THttpRequestOptions): Promise<string>;
|
|
165
163
|
private setParamFromCameraJSON;
|
|
166
164
|
private getParamFromCameraAndJSONParse;
|
|
165
|
+
getUploadedFileList(clipName: string, storage: TStorageType, options?: THttpRequestOptions): Promise<string[]>;
|
|
166
|
+
downloadClipFile(fileName: string, storage: TStorageType, options?: THttpRequestOptions): Promise<ReturnType<Awaited<ReturnType<Client["get"]>>["blob"]>>;
|
|
167
|
+
uploadClipFiles(files: File[], storage: TStorageType, options?: THttpRequestOptions): Promise<void>;
|
|
167
168
|
}
|
package/cjs/CamSwitcherAPI.js
CHANGED
|
@@ -3,28 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CamSwitcherAPI = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const errors_1 = require("./errors/errors");
|
|
6
|
+
const convertors_1 = require("./internal/convertors");
|
|
6
7
|
const utils_1 = require("./internal/utils");
|
|
7
8
|
const CamSwitcherAPI_1 = require("./types/CamSwitcherAPI");
|
|
8
9
|
const common_1 = require("./types/common");
|
|
9
10
|
const VapixAPI_1 = require("./VapixAPI");
|
|
10
|
-
const
|
|
11
|
-
const constants_1 = require("./internal/constants");
|
|
12
|
-
const ProxyClient_1 = require("./internal/ProxyClient");
|
|
11
|
+
const BasicAPI_1 = require("./internal/BasicAPI");
|
|
13
12
|
const BASE_PATH = '/local/camswitcher/api';
|
|
14
|
-
class CamSwitcherAPI {
|
|
15
|
-
client;
|
|
13
|
+
class CamSwitcherAPI extends BasicAPI_1.BasicAPI {
|
|
16
14
|
CustomFormData;
|
|
17
15
|
vapixAgent;
|
|
18
16
|
constructor(client, CustomFormData = FormData) {
|
|
19
|
-
|
|
17
|
+
super(client);
|
|
20
18
|
this.CustomFormData = CustomFormData;
|
|
21
19
|
this.vapixAgent = new VapixAPI_1.VapixAPI(client);
|
|
22
20
|
}
|
|
23
21
|
static getProxyPath = () => `${BASE_PATH}/proxy.cgi`;
|
|
24
22
|
static getWsEventsPath = () => `/local/camswitcher/events`;
|
|
25
23
|
static getClipPreviewPath = (clipId, storage) => `${BASE_PATH}/clip_preview.cgi?clip_name=${clipId}&storage=${storage}`;
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
async checkAPIAvailable(options) {
|
|
25
|
+
await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
|
|
28
26
|
}
|
|
29
27
|
async checkCameraTime(options) {
|
|
30
28
|
const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
|
|
@@ -139,7 +137,13 @@ class CamSwitcherAPI {
|
|
|
139
137
|
return CamSwitcherAPI_1.clipListSchema.parse(res.data).clip_list;
|
|
140
138
|
}
|
|
141
139
|
setCamSwitchOptions(data, cameraFWVersion, options) {
|
|
142
|
-
const
|
|
140
|
+
const bitrateData = {
|
|
141
|
+
bitrateMode: data.bitrateMode,
|
|
142
|
+
maximumBitRate: data.maximumBitRate,
|
|
143
|
+
retentionTime: data.retentionTime,
|
|
144
|
+
bitRateLimit: data.bitRateLimit,
|
|
145
|
+
};
|
|
146
|
+
const bitrateVapixParams = (0, convertors_1.parseBitrateOptionsToVapixParams)(cameraFWVersion, data.bitrateMode, bitrateData);
|
|
143
147
|
const saveData = {
|
|
144
148
|
video: {
|
|
145
149
|
resolution: data.resolution,
|
|
@@ -202,7 +206,7 @@ class CamSwitcherAPI {
|
|
|
202
206
|
return saveData;
|
|
203
207
|
}
|
|
204
208
|
if (!(0, utils_1.isNullish)(saveData.video?.bitrateVapixParams)) {
|
|
205
|
-
const bitrateOptions = parseVapixParamsToBitrateOptions(saveData.video.bitrateVapixParams);
|
|
209
|
+
const bitrateOptions = (0, convertors_1.parseVapixParamsToBitrateOptions)(saveData.video.bitrateVapixParams);
|
|
206
210
|
saveData.video.bitrateMode = bitrateOptions.bitrateMode;
|
|
207
211
|
saveData.video.maximumBitRate = bitrateOptions.maximumBitRate;
|
|
208
212
|
saveData.video.retentionTime = bitrateOptions.retentionTime;
|
|
@@ -256,25 +260,8 @@ class CamSwitcherAPI {
|
|
|
256
260
|
const res = await this.vapixAgent.getParameter([paramName], options);
|
|
257
261
|
return zod_1.z.string().parse(res[paramName] ?? '');
|
|
258
262
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
const res = await agent.get({ path, parameters, timeout: options?.timeout });
|
|
262
|
-
if (res.ok) {
|
|
263
|
-
return await res.json();
|
|
264
|
-
}
|
|
265
|
-
else {
|
|
266
|
-
throw new errors_1.ErrorWithResponse(res);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
async _post(path, data, parameters, options, headers) {
|
|
270
|
-
const agent = this.getClient(options?.proxyParams);
|
|
271
|
-
const res = await agent.post({ path, data, parameters, timeout: options?.timeout, headers });
|
|
272
|
-
if (res.ok) {
|
|
273
|
-
return await res.json();
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
throw new errors_1.ErrorWithResponse(res);
|
|
277
|
-
}
|
|
263
|
+
downloadReport(options) {
|
|
264
|
+
return this._getText(`${BASE_PATH}/report.cgi`, undefined, options);
|
|
278
265
|
}
|
|
279
266
|
setParamFromCameraJSON(paramName, data, options) {
|
|
280
267
|
const params = {};
|
|
@@ -298,6 +285,20 @@ class CamSwitcherAPI {
|
|
|
298
285
|
}
|
|
299
286
|
throw new errors_1.ParameterNotFoundError(paramName);
|
|
300
287
|
}
|
|
288
|
+
async getUploadedFileList(clipName, storage, options) {
|
|
289
|
+
const res = await this._getJson(`${BASE_PATH}/clip_files.cgi`, { clip_name: clipName, storage }, options);
|
|
290
|
+
return CamSwitcherAPI_1.clipFilesListSchema.parse(res).data.files;
|
|
291
|
+
}
|
|
292
|
+
async downloadClipFile(fileName, storage, options) {
|
|
293
|
+
return await this._getBlob(`${BASE_PATH}/clip_download_file.cgi`, { file_name: fileName, storage }, options);
|
|
294
|
+
}
|
|
295
|
+
async uploadClipFiles(files, storage, options) {
|
|
296
|
+
const formData = new FormData();
|
|
297
|
+
for (const file of files) {
|
|
298
|
+
formData.append(file.name, file);
|
|
299
|
+
}
|
|
300
|
+
await this._post(`${BASE_PATH}/clip_upload_file.cgi`, formData, { storage }, options);
|
|
301
|
+
}
|
|
301
302
|
}
|
|
302
303
|
exports.CamSwitcherAPI = CamSwitcherAPI;
|
|
303
304
|
const CSW_PARAM_NAMES = {
|
|
@@ -307,62 +308,3 @@ const CSW_PARAM_NAMES = {
|
|
|
307
308
|
RTSP_TOKEN: 'Camswitcher.RTSPAccessToken',
|
|
308
309
|
DEFAULT_PLAYLIST: 'Camswitcher.DefaultPlaylist',
|
|
309
310
|
};
|
|
310
|
-
const parseBitrateOptionsToBitrateVapixParams = (firmWareVersion, bitrateMode, cameraOptions) => {
|
|
311
|
-
if (!(0, versionCompare_1.isFirmwareVersionAtLeast)(firmWareVersion, constants_1.FIRMWARE_WITH_BITRATE_MODES_SUPPORT)) {
|
|
312
|
-
return `videomaxbitrate=${cameraOptions.maximumBitRate}`;
|
|
313
|
-
}
|
|
314
|
-
if (bitrateMode === undefined) {
|
|
315
|
-
return '';
|
|
316
|
-
}
|
|
317
|
-
const data = {
|
|
318
|
-
VBR: 'videobitratemode=vbr',
|
|
319
|
-
MBR: `videobitratemode=mbr&videomaxbitrate=${cameraOptions.maximumBitRate}`,
|
|
320
|
-
ABR: `videobitratemode=abr&videoabrtargetbitrate=${cameraOptions.maximumBitRate}&videoabrretentiontime=${cameraOptions.retentionTime}&videoabrmaxbitrate=${cameraOptions.bitRateLimit}`,
|
|
321
|
-
};
|
|
322
|
-
return data[bitrateMode];
|
|
323
|
-
};
|
|
324
|
-
const parseVapixParamsToBitrateOptions = (bitrateVapixParams) => {
|
|
325
|
-
const params = {};
|
|
326
|
-
const searchParams = new URLSearchParams(bitrateVapixParams);
|
|
327
|
-
searchParams.forEach((value, key) => {
|
|
328
|
-
params[key] = value;
|
|
329
|
-
});
|
|
330
|
-
const bitrateMode = params['videobitratemode'] !== undefined ? params['videobitratemode'].toUpperCase() : undefined;
|
|
331
|
-
const hasLowerFw = bitrateMode === undefined && params['videomaxbitrate'] !== undefined;
|
|
332
|
-
if (hasLowerFw) {
|
|
333
|
-
const maximumBitRate = parseInt(params['videomaxbitrate'] ?? '0', 10);
|
|
334
|
-
return {
|
|
335
|
-
bitrateMode: 'MBR',
|
|
336
|
-
maximumBitRate: maximumBitRate,
|
|
337
|
-
retentionTime: 1,
|
|
338
|
-
bitRateLimit: Math.floor(maximumBitRate * 1.1),
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
if (bitrateMode === 'ABR') {
|
|
342
|
-
const maximumBitRate = parseInt(params['videoabrtargetbitrate'] ?? '0', 10);
|
|
343
|
-
const retentionTime = parseInt(params['videoabrretentiontime'] ?? '0', 10);
|
|
344
|
-
const bitRateLimit = parseInt(params['videoabrmaxbitrate'] ?? '0', 10);
|
|
345
|
-
return {
|
|
346
|
-
bitrateMode,
|
|
347
|
-
maximumBitRate,
|
|
348
|
-
retentionTime,
|
|
349
|
-
bitRateLimit,
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
else if (bitrateMode === 'MBR') {
|
|
353
|
-
const maximumBitRate = params['videomaxbitrate'] !== undefined ? parseInt(params['videomaxbitrate'], 10) : null;
|
|
354
|
-
const oldMaximumBitrateParamValue = parseInt(params['videombrmaxbitrate'] ?? '0', 10);
|
|
355
|
-
return {
|
|
356
|
-
bitrateMode: bitrateMode,
|
|
357
|
-
maximumBitRate: maximumBitRate ?? oldMaximumBitrateParamValue,
|
|
358
|
-
retentionTime: 1,
|
|
359
|
-
bitRateLimit: Math.floor(maximumBitRate ?? oldMaximumBitrateParamValue * 1.1),
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
return {
|
|
363
|
-
bitrateMode: bitrateMode,
|
|
364
|
-
retentionTime: 1,
|
|
365
|
-
maximumBitRate: 0,
|
|
366
|
-
bitRateLimit: 0,
|
|
367
|
-
};
|
|
368
|
-
};
|
package/cjs/PlaneTrackerAPI.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { IClient,
|
|
1
|
+
import { IClient, TParameters, TResponse } from './internal/types';
|
|
2
2
|
import { ICAO, TApiUser, TBlackList, TCameraSettings, TExportDataType, TGetIcaoByOption, TImportDataType, TPriorityList, TTrackingMode, TTypePriorityList, TWhiteList, TZones } from './types/PlaneTrackerAPI';
|
|
3
|
-
import { THttpRequestOptions
|
|
4
|
-
import {
|
|
5
|
-
export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
|
|
6
|
-
private client;
|
|
3
|
+
import { THttpRequestOptions } from './types/common';
|
|
4
|
+
import { BasicAPI } from './internal/BasicAPI';
|
|
5
|
+
export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> extends BasicAPI<Client> {
|
|
7
6
|
private apiUser;
|
|
8
7
|
constructor(client: Client, apiUser: TApiUser);
|
|
9
8
|
static getProxyPath: () => string;
|
|
10
9
|
static getWsEventsPath: () => string;
|
|
11
|
-
|
|
10
|
+
checkAPIAvailable(options?: THttpRequestOptions): Promise<void>;
|
|
12
11
|
checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
|
|
13
|
-
serverRunCheck(options?: THttpRequestOptions): Promise<
|
|
12
|
+
serverRunCheck(options?: THttpRequestOptions): Promise<boolean>;
|
|
14
13
|
getLiveViewAlias(rtspUrl: string, options?: THttpRequestOptions): Promise<{
|
|
15
14
|
ws: string;
|
|
16
15
|
ws_initial_message: string;
|
|
@@ -22,11 +21,12 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
|
|
|
22
21
|
camera: {
|
|
23
22
|
ip: string;
|
|
24
23
|
port: number;
|
|
25
|
-
protocol: "https" | "http" | "https_insecure";
|
|
26
|
-
user: string;
|
|
27
24
|
pass: string;
|
|
25
|
+
user: string;
|
|
26
|
+
protocol: "https" | "http" | "https_insecure";
|
|
28
27
|
};
|
|
29
28
|
units: "metric" | "imperial";
|
|
29
|
+
trackingDomain: "adsb" | "dronetag";
|
|
30
30
|
adsbSource: {
|
|
31
31
|
ip: string;
|
|
32
32
|
port: number;
|
|
@@ -84,8 +84,8 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
|
|
|
84
84
|
};
|
|
85
85
|
radarcapeFlightInfoSource: {
|
|
86
86
|
ip: string;
|
|
87
|
-
port: number;
|
|
88
87
|
enabled: boolean;
|
|
88
|
+
port: number;
|
|
89
89
|
priority: number;
|
|
90
90
|
};
|
|
91
91
|
identificationLabel: {
|
|
@@ -97,22 +97,22 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
|
|
|
97
97
|
};
|
|
98
98
|
acs: {
|
|
99
99
|
ip: string;
|
|
100
|
-
port: number;
|
|
101
100
|
enabled: boolean;
|
|
102
|
-
|
|
103
|
-
user: string;
|
|
101
|
+
port: number;
|
|
104
102
|
pass: string;
|
|
103
|
+
user: string;
|
|
104
|
+
protocol: "https" | "http" | "https_insecure";
|
|
105
105
|
sourceKey: string;
|
|
106
106
|
};
|
|
107
107
|
genetec: {
|
|
108
108
|
ip: string;
|
|
109
|
-
port: number;
|
|
110
109
|
enabled: boolean;
|
|
110
|
+
port: number;
|
|
111
111
|
cameraList: string[];
|
|
112
|
+
pass: string;
|
|
112
113
|
appId: string;
|
|
113
|
-
protocol: "https" | "http" | "https_insecure";
|
|
114
114
|
user: string;
|
|
115
|
-
|
|
115
|
+
protocol: "https" | "http" | "https_insecure";
|
|
116
116
|
baseUri: string;
|
|
117
117
|
};
|
|
118
118
|
camstreamerIntegration: {
|
|
@@ -132,18 +132,20 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
|
|
|
132
132
|
displayPTError?: boolean | undefined;
|
|
133
133
|
displayPTZSpeed?: boolean | undefined;
|
|
134
134
|
displayVelocityData?: boolean | undefined;
|
|
135
|
+
displayAdsbVelocityData?: boolean | undefined;
|
|
135
136
|
displaySignalQuality?: boolean | undefined;
|
|
136
137
|
displayAutoTrackingInfo?: boolean | undefined;
|
|
137
138
|
displayGPSCoords?: boolean | undefined;
|
|
138
139
|
displayVapixQuery?: boolean | undefined;
|
|
139
140
|
displayFocus?: boolean | undefined;
|
|
140
141
|
displayAperture?: boolean | undefined;
|
|
142
|
+
displayAircraftInfo?: boolean | undefined;
|
|
141
143
|
displaySunDistance?: boolean | undefined;
|
|
142
144
|
displayTickTime?: boolean | undefined;
|
|
143
|
-
|
|
145
|
+
displaySystemInfo?: boolean | undefined;
|
|
144
146
|
} | undefined;
|
|
145
147
|
}>;
|
|
146
|
-
setCameraSettings(settings: TCameraSettings, options?: THttpRequestOptions): Promise<
|
|
148
|
+
setCameraSettings(settings: TCameraSettings, options?: THttpRequestOptions): Promise<void>;
|
|
147
149
|
fetchServerSettings(options?: THttpRequestOptions): Promise<{
|
|
148
150
|
cameraCalibration: {
|
|
149
151
|
posLat: number;
|
|
@@ -162,7 +164,7 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
|
|
|
162
164
|
}[];
|
|
163
165
|
};
|
|
164
166
|
}>;
|
|
165
|
-
exportAppSettings(dataType: TExportDataType, options?: THttpRequestOptions): Promise<
|
|
167
|
+
exportAppSettings(dataType: TExportDataType, options?: THttpRequestOptions): Promise<ReturnType<Awaited<ReturnType<Client["get"]>>["blob"]>>;
|
|
166
168
|
importAppSettings(dataType: TImportDataType, formData: Parameters<Client['post']>[0]['data'], options?: THttpRequestOptions): Promise<void>;
|
|
167
169
|
fetchFlightInfo(icao: ICAO, options?: THttpRequestOptions): Promise<{
|
|
168
170
|
destinationAirport: {
|
|
@@ -193,13 +195,13 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
|
|
|
193
195
|
stopTrackingPlane(options?: THttpRequestOptions): Promise<void>;
|
|
194
196
|
getIcao(by: TGetIcaoByOption, value: string, options?: THttpRequestOptions): Promise<string>;
|
|
195
197
|
getPriorityList(options?: THttpRequestOptions): Promise<string[]>;
|
|
196
|
-
setPriorityList(priorityList: TPriorityList['priorityList'], options?: THttpRequestOptions): Promise<
|
|
198
|
+
setPriorityList(priorityList: TPriorityList['priorityList'], options?: THttpRequestOptions): Promise<void>;
|
|
197
199
|
getTypePriorityList(options?: THttpRequestOptions): Promise<string[]>;
|
|
198
|
-
setTypePriorityList(typePriorityList: TTypePriorityList['typePriorityList'], options?: THttpRequestOptions): Promise<
|
|
200
|
+
setTypePriorityList(typePriorityList: TTypePriorityList['typePriorityList'], options?: THttpRequestOptions): Promise<void>;
|
|
199
201
|
getWhiteList(options?: THttpRequestOptions): Promise<string[]>;
|
|
200
|
-
setWhiteList(whiteList: TWhiteList['whiteList'], options?: THttpRequestOptions): Promise<
|
|
202
|
+
setWhiteList(whiteList: TWhiteList['whiteList'], options?: THttpRequestOptions): Promise<void>;
|
|
201
203
|
getBlackList(options?: THttpRequestOptions): Promise<string[]>;
|
|
202
|
-
setBlackList(blackList: TBlackList['blackList'], options?: THttpRequestOptions): Promise<
|
|
204
|
+
setBlackList(blackList: TBlackList['blackList'], options?: THttpRequestOptions): Promise<void>;
|
|
203
205
|
fetchMapInfo(options?: THttpRequestOptions): Promise<{
|
|
204
206
|
minZoom: number;
|
|
205
207
|
maxZoom: number;
|
|
@@ -227,15 +229,11 @@ export declare class PlaneTrackerAPI<Client extends IClient<TResponse, any>> {
|
|
|
227
229
|
}>;
|
|
228
230
|
setZones(zones: TZones, options?: THttpRequestOptions): Promise<void>;
|
|
229
231
|
goToCoordinates(lat: number, lon: number, alt?: number, options?: THttpRequestOptions): Promise<void>;
|
|
230
|
-
|
|
232
|
+
downloadReport(options?: THttpRequestOptions): Promise<string>;
|
|
233
|
+
checkGenetecConnection(params: TParameters, options?: THttpRequestOptions): Promise<boolean>;
|
|
231
234
|
getGenetecCameraList(params: TParameters, options?: THttpRequestOptions): Promise<{
|
|
232
235
|
value: string;
|
|
233
|
-
index: number;
|
|
234
236
|
label: string;
|
|
237
|
+
index: number;
|
|
235
238
|
}[]>;
|
|
236
|
-
private _getJson;
|
|
237
|
-
private _getBlob;
|
|
238
|
-
private parseBlobResponse;
|
|
239
|
-
private _postJsonEncoded;
|
|
240
|
-
private _postUrlEncoded;
|
|
241
239
|
}
|