camstreamerlib 4.0.0-beta.97 → 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 +147 -109
- package/cjs/CamOverlayAPI.js +14 -63
- package/cjs/CamScripterAPI.d.ts +5 -8
- package/cjs/CamScripterAPI.js +11 -29
- package/cjs/CamStreamerAPI.d.ts +2745 -589
- 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 +894 -374
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +54 -11
- package/cjs/types/CamOverlayAPI/accuweatherSchema.d.ts +10 -10
- package/cjs/types/CamOverlayAPI/customGraphicsSchema.d.ts +40 -40
- 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 +19642 -3073
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.js +126 -57
- package/cjs/types/CamStreamerAPI/facebookSchema.d.ts +434 -52
- 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 +430 -219
- package/cjs/types/CamStreamerAPI/streamCommonTypes.js +116 -58
- package/cjs/types/CamStreamerAPI/streamsSchema.d.ts +8812 -0
- package/cjs/types/CamStreamerAPI/streamsSchema.js +81 -0
- package/cjs/types/CamStreamerAPI/windySchema.d.ts +394 -52
- package/cjs/types/CamStreamerAPI/windySchema.js +9 -1
- package/cjs/types/CamStreamerAPI/youtubeSchema.d.ts +402 -52
- package/cjs/types/CamStreamerAPI/youtubeSchema.js +12 -1
- 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 -58
- package/esm/types/CamStreamerAPI/streamsSchema.js +75 -0
- package/esm/types/CamStreamerAPI/windySchema.js +9 -1
- package/esm/types/CamStreamerAPI/youtubeSchema.js +12 -1
- 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 +147 -109
- package/types/CamScripterAPI.d.ts +5 -8
- package/types/CamStreamerAPI.d.ts +2745 -589
- 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 +894 -374
- package/types/types/CamOverlayAPI/accuweatherSchema.d.ts +10 -10
- package/types/types/CamOverlayAPI/customGraphicsSchema.d.ts +40 -40
- 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 +19642 -3073
- package/types/types/CamStreamerAPI/facebookSchema.d.ts +434 -52
- 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 +430 -219
- package/types/types/CamStreamerAPI/streamsSchema.d.ts +8812 -0
- package/types/types/CamStreamerAPI/windySchema.d.ts +394 -52
- package/types/types/CamStreamerAPI/youtubeSchema.d.ts +402 -52
- 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 -202
- package/cjs/types/CamStreamerAPI/churchSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/daCastSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/daCastSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/dailymotionSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/dailymotionSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/gameChangerSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/gameChangerSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/hlsPullSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/hlsPullSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/hlsPushSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/hlsPushSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/ibmSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/ibmSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/microsoftAzureSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/microsoftAzureSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/microsoftStreamSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/microsoftStreamSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/mpegDvbSchema.d.ts +0 -250
- package/cjs/types/CamStreamerAPI/mpegDvbSchema.js +0 -27
- package/cjs/types/CamStreamerAPI/rtmpSchema.d.ts +0 -211
- package/cjs/types/CamStreamerAPI/rtmpSchema.js +0 -14
- package/cjs/types/CamStreamerAPI/sdCardSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/sdCardSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/srtSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/srtSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/twitchSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/twitchSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/vimeoSchema.d.ts +0 -202
- package/cjs/types/CamStreamerAPI/vimeoSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/wowzaSchema.d.ts +0 -202
- 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 -202
- package/types/types/CamStreamerAPI/daCastSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/dailymotionSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/gameChangerSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/hlsPullSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/hlsPushSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/ibmSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/microsoftAzureSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/microsoftStreamSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/mpegDvbSchema.d.ts +0 -250
- package/types/types/CamStreamerAPI/rtmpSchema.d.ts +0 -211
- package/types/types/CamStreamerAPI/sdCardSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/srtSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/twitchSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/vimeoSchema.d.ts +0 -202
- package/types/types/CamStreamerAPI/wowzaSchema.d.ts +0 -202
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BasicAPI = void 0;
|
|
4
|
+
const errors_1 = require("../errors/errors");
|
|
5
|
+
const ProxyClient_1 = require("./ProxyClient");
|
|
6
|
+
const utils_1 = require("./utils");
|
|
7
|
+
class BasicAPI {
|
|
8
|
+
client;
|
|
9
|
+
constructor(client) {
|
|
10
|
+
this.client = client;
|
|
11
|
+
}
|
|
12
|
+
getClient(proxyParams) {
|
|
13
|
+
return proxyParams ? new ProxyClient_1.ProxyClient(this.client, proxyParams) : this.client;
|
|
14
|
+
}
|
|
15
|
+
async _getJson(path, parameters, options) {
|
|
16
|
+
const agent = this.getClient(options?.proxyParams);
|
|
17
|
+
const res = await agent.get({ path, parameters, timeout: options?.timeout });
|
|
18
|
+
if (res.ok) {
|
|
19
|
+
return await res.json();
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
throw new errors_1.ErrorWithResponse(res);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async _getText(path, parameters, options) {
|
|
26
|
+
const agent = this.getClient(options?.proxyParams);
|
|
27
|
+
const res = await agent.get({ path, parameters, timeout: options?.timeout });
|
|
28
|
+
if (res.ok) {
|
|
29
|
+
return await res.text();
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
throw new errors_1.ErrorWithResponse(res);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async _getBlob(path, parameters, options) {
|
|
36
|
+
const agent = this.getClient(options?.proxyParams);
|
|
37
|
+
const res = await agent.get({ path, parameters, timeout: options?.timeout });
|
|
38
|
+
if (res.ok) {
|
|
39
|
+
return await this.parseBlobResponse(res);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
throw new errors_1.ErrorWithResponse(res);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async parseBlobResponse(response) {
|
|
46
|
+
try {
|
|
47
|
+
return (await response.blob());
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
throw new errors_1.ParsingBlobError(err);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async _post(path, data, parameters, options, headers) {
|
|
54
|
+
const agent = this.getClient(options?.proxyParams);
|
|
55
|
+
const res = await agent.post({ path, data, parameters, headers, timeout: options?.timeout });
|
|
56
|
+
if (res.ok) {
|
|
57
|
+
return await res.json();
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
throw new errors_1.ErrorWithResponse(res);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async _postJsonEncoded(path, data, parameters, options) {
|
|
64
|
+
const agent = this.getClient(options?.proxyParams);
|
|
65
|
+
const jsonData = JSON.stringify(data);
|
|
66
|
+
const res = await agent.post({
|
|
67
|
+
path,
|
|
68
|
+
data: jsonData,
|
|
69
|
+
parameters,
|
|
70
|
+
headers: { 'Content-Type': 'application/json' },
|
|
71
|
+
timeout: options?.timeout,
|
|
72
|
+
});
|
|
73
|
+
if (!res.ok) {
|
|
74
|
+
throw new errors_1.ErrorWithResponse(res);
|
|
75
|
+
}
|
|
76
|
+
return res;
|
|
77
|
+
}
|
|
78
|
+
async _postUrlEncoded(path, data, options) {
|
|
79
|
+
const encodedData = (0, utils_1.paramToUrl)(data);
|
|
80
|
+
const agent = this.getClient(options?.proxyParams);
|
|
81
|
+
const res = await agent.post({
|
|
82
|
+
path,
|
|
83
|
+
data: encodedData,
|
|
84
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
85
|
+
timeout: options?.timeout,
|
|
86
|
+
});
|
|
87
|
+
if (!res.ok) {
|
|
88
|
+
throw new errors_1.ErrorWithResponse(res);
|
|
89
|
+
}
|
|
90
|
+
return res;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.BasicAPI = BasicAPI;
|
|
@@ -30,6 +30,7 @@ export declare class WsEvents<T extends {
|
|
|
30
30
|
resendInitData(): void;
|
|
31
31
|
addListener<Type extends TEventType<T>>(type: Type, listener: TListenerFunction<T, Type>, id: string): void;
|
|
32
32
|
removeListener<Type extends TEventType<T>>(type: Type, id: string): void;
|
|
33
|
+
removeAllListenersForId(id: string): void;
|
|
33
34
|
private onMessage;
|
|
34
35
|
private processMessage;
|
|
35
36
|
destroy(): void;
|
package/cjs/internal/WsEvents.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FIRMWARE_WITH_BITRATE_MODES_SUPPORT = void 0;
|
|
3
|
+
exports.FIRMWARE_WITH_OVERLAYS_SUPPORT = exports.FIRMWARE_WITH_BITRATE_MODES_SUPPORT = void 0;
|
|
4
4
|
exports.FIRMWARE_WITH_BITRATE_MODES_SUPPORT = '11.11.73';
|
|
5
|
+
exports.FIRMWARE_WITH_OVERLAYS_SUPPORT = '10.7.0';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TInternalVapixParameters } from '../types/CamStreamerAPI';
|
|
2
|
+
import { TBitrateMode, TBitrateVapixParams } from '../types/common';
|
|
3
|
+
export declare const parseBitrateOptionsToVapixParams: (firmWareVersion: string, bitrateMode: TBitrateMode | undefined, cameraOptions: Partial<TBitrateVapixParams>) => string;
|
|
4
|
+
export declare const parseVapixParamsToBitrateOptions: (bitrateVapixParams: string) => TBitrateVapixParams;
|
|
5
|
+
export declare const parseVideoOptionsToVapixParams: (firmWareVersion: string, video: TInternalVapixParameters) => string;
|
|
6
|
+
export declare const parseVapixParamsToVideoOptions: (internalVapixParams: string) => TInternalVapixParameters;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseVapixParamsToVideoOptions = exports.parseVideoOptionsToVapixParams = exports.parseVapixParamsToBitrateOptions = exports.parseBitrateOptionsToVapixParams = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const versionCompare_1 = require("./versionCompare");
|
|
6
|
+
const parseBitrateOptionsToVapixParams = (firmWareVersion, bitrateMode, cameraOptions) => {
|
|
7
|
+
if (!(0, versionCompare_1.isFirmwareVersionAtLeast)(firmWareVersion, constants_1.FIRMWARE_WITH_BITRATE_MODES_SUPPORT)) {
|
|
8
|
+
return `videomaxbitrate=${cameraOptions.maximumBitRate}`;
|
|
9
|
+
}
|
|
10
|
+
if (bitrateMode === undefined) {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
const data = {
|
|
14
|
+
VBR: 'videobitratemode=vbr',
|
|
15
|
+
MBR: `videobitratemode=mbr&videomaxbitrate=${cameraOptions.maximumBitRate}&videobitratepriority=framerate`,
|
|
16
|
+
ABR: `videobitratemode=abr&videoabrtargetbitrate=${cameraOptions.maximumBitRate}&videoabrretentiontime=${cameraOptions.retentionTime}&videoabrmaxbitrate=${cameraOptions.bitRateLimit}`,
|
|
17
|
+
};
|
|
18
|
+
return data[bitrateMode];
|
|
19
|
+
};
|
|
20
|
+
exports.parseBitrateOptionsToVapixParams = parseBitrateOptionsToVapixParams;
|
|
21
|
+
const parseVapixParamsToBitrateOptions = (bitrateVapixParams) => {
|
|
22
|
+
const params = {};
|
|
23
|
+
const searchParams = new URLSearchParams(bitrateVapixParams);
|
|
24
|
+
searchParams.forEach((value, key) => {
|
|
25
|
+
params[key] = value;
|
|
26
|
+
});
|
|
27
|
+
const bitrateMode = params['videobitratemode'] !== undefined ? params['videobitratemode'].toUpperCase() : undefined;
|
|
28
|
+
const hasLowerFw = bitrateMode === undefined && params['videomaxbitrate'] !== undefined;
|
|
29
|
+
if (hasLowerFw) {
|
|
30
|
+
const maximumBitRate = parseInt(params['videomaxbitrate'] ?? '0', 10);
|
|
31
|
+
return {
|
|
32
|
+
bitrateMode: 'MBR',
|
|
33
|
+
maximumBitRate: maximumBitRate,
|
|
34
|
+
retentionTime: 1,
|
|
35
|
+
bitRateLimit: Math.floor(maximumBitRate * 1.1),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (bitrateMode === 'ABR') {
|
|
39
|
+
const maximumBitRate = parseInt(params['videoabrtargetbitrate'] ?? '0', 10);
|
|
40
|
+
const retentionTime = parseInt(params['videoabrretentiontime'] ?? '0', 10);
|
|
41
|
+
const bitRateLimit = parseInt(params['videoabrmaxbitrate'] ?? '0', 10);
|
|
42
|
+
return {
|
|
43
|
+
bitrateMode,
|
|
44
|
+
maximumBitRate,
|
|
45
|
+
retentionTime,
|
|
46
|
+
bitRateLimit,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
else if (bitrateMode === 'MBR') {
|
|
50
|
+
const maximumBitRate = params['videomaxbitrate'] !== undefined ? parseInt(params['videomaxbitrate'], 10) : null;
|
|
51
|
+
const oldMaximumBitrateParamValue = parseInt(params['videombrmaxbitrate'] ?? '0', 10);
|
|
52
|
+
return {
|
|
53
|
+
bitrateMode: bitrateMode,
|
|
54
|
+
maximumBitRate: maximumBitRate ?? oldMaximumBitrateParamValue,
|
|
55
|
+
retentionTime: 1,
|
|
56
|
+
bitRateLimit: Math.floor(maximumBitRate ?? oldMaximumBitrateParamValue * 1.1),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
bitrateMode: bitrateMode,
|
|
61
|
+
retentionTime: 1,
|
|
62
|
+
maximumBitRate: 0,
|
|
63
|
+
bitRateLimit: 0,
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
exports.parseVapixParamsToBitrateOptions = parseVapixParamsToBitrateOptions;
|
|
67
|
+
const parseVideoOptionsToVapixParams = (firmWareVersion, video) => {
|
|
68
|
+
const bitrateParams = (0, exports.parseBitrateOptionsToVapixParams)(firmWareVersion, video.bitrateMode, {
|
|
69
|
+
maximumBitRate: video.maximumBitRate,
|
|
70
|
+
retentionTime: video.retentionTime,
|
|
71
|
+
bitRateLimit: video.bitRateLimit,
|
|
72
|
+
});
|
|
73
|
+
let overlaysParams = '';
|
|
74
|
+
if ((0, versionCompare_1.isFirmwareVersionAtLeast)(firmWareVersion, constants_1.FIRMWARE_WITH_OVERLAYS_SUPPORT) && video.overlays !== undefined) {
|
|
75
|
+
overlaysParams = `&overlays=${video.overlays}`;
|
|
76
|
+
}
|
|
77
|
+
const nbrOfChannels = video.nbrOfChannels ? (video.audio === 1 ? `&nbrOfChannels=${video.nbrOfChannels}` : '') : '';
|
|
78
|
+
const audioParams = `audio=${video.audio}${nbrOfChannels}`;
|
|
79
|
+
const videoCodecParams = video.videoCodec === 'h264'
|
|
80
|
+
? `videoCodec=${video.videoCodec}&h264Profile=${video.h264Profile}`
|
|
81
|
+
: `videoCodec=${video.videoCodec}`;
|
|
82
|
+
const videoParams = `camera=${video.camera}&resolution=${video.resolution}&fps=${video.fps}&compression=${video.compression}&videokeyframeinterval=${video.govLength}&${videoCodecParams}${overlaysParams}`;
|
|
83
|
+
return [videoParams, bitrateParams, audioParams].join('&');
|
|
84
|
+
};
|
|
85
|
+
exports.parseVideoOptionsToVapixParams = parseVideoOptionsToVapixParams;
|
|
86
|
+
const parseVapixParamsToVideoOptions = (internalVapixParams) => {
|
|
87
|
+
const bitrateOptions = (0, exports.parseVapixParamsToBitrateOptions)(internalVapixParams);
|
|
88
|
+
const params = {};
|
|
89
|
+
const searchParams = new URLSearchParams(internalVapixParams);
|
|
90
|
+
searchParams.forEach((value, key) => {
|
|
91
|
+
params[key] = value;
|
|
92
|
+
});
|
|
93
|
+
let h264Profile = undefined;
|
|
94
|
+
if (params['videoCodec'] === 'h264') {
|
|
95
|
+
h264Profile = (params['h264Profile'] ?? 'high');
|
|
96
|
+
}
|
|
97
|
+
let nbrOfChannels = undefined;
|
|
98
|
+
if (params['audio'] === '1') {
|
|
99
|
+
nbrOfChannels = parseInt(params['nbrOfChannels'] ?? '1');
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
...bitrateOptions,
|
|
103
|
+
camera: params['camera'] ?? '1',
|
|
104
|
+
resolution: params['resolution'] ?? '',
|
|
105
|
+
fps: parseInt(params['fps'] ?? '0', 10),
|
|
106
|
+
compression: parseInt(params['compression'] ?? '0', 10),
|
|
107
|
+
govLength: parseInt(params['videokeyframeinterval'] ?? '0', 10),
|
|
108
|
+
videoCodec: (params['videoCodec'] ?? 'h264'),
|
|
109
|
+
h264Profile,
|
|
110
|
+
audio: parseInt(params['audio'] ?? '0'),
|
|
111
|
+
nbrOfChannels,
|
|
112
|
+
overlays: params['overlays'],
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
exports.parseVapixParamsToVideoOptions = parseVapixParamsToVideoOptions;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toSnakeCaseDeep = exports.toSnakeCase = exports.toCamelCaseDeep = exports.toCamelCase = void 0;
|
|
4
|
-
const
|
|
5
|
-
const toCamelCase = (o) => (0,
|
|
4
|
+
const lodash_es_1 = require("lodash-es");
|
|
5
|
+
const toCamelCase = (o) => (0, lodash_es_1.mapKeys)(o, camelCaseKey);
|
|
6
6
|
exports.toCamelCase = toCamelCase;
|
|
7
7
|
const toCamelCaseDeep = (o) => {
|
|
8
8
|
return mapKeysDeep(o, camelCaseKey);
|
|
9
9
|
};
|
|
10
10
|
exports.toCamelCaseDeep = toCamelCaseDeep;
|
|
11
|
-
const toSnakeCase = (o) => (0,
|
|
11
|
+
const toSnakeCase = (o) => (0, lodash_es_1.mapKeys)(o, snakeCaseKey);
|
|
12
12
|
exports.toSnakeCase = toSnakeCase;
|
|
13
13
|
const toSnakeCaseDeep = (o) => {
|
|
14
14
|
return mapKeysDeep(o, snakeCaseKey);
|
|
15
15
|
};
|
|
16
16
|
exports.toSnakeCaseDeep = toSnakeCaseDeep;
|
|
17
|
-
const camelCaseKey = (_, key) => (0,
|
|
18
|
-
const snakeCaseKey = (_, key) => (0,
|
|
17
|
+
const camelCaseKey = (_, key) => (0, lodash_es_1.camelCase)(key);
|
|
18
|
+
const snakeCaseKey = (_, key) => (0, lodash_es_1.snakeCase)(key);
|
|
19
19
|
const mapKeysDeep = (obj, cb) => {
|
|
20
20
|
if (Array.isArray(obj)) {
|
|
21
21
|
return obj.map((item) => {
|
|
22
22
|
return mapKeysDeep(item, cb);
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
if (typeof obj !== 'object' || (0,
|
|
25
|
+
if (typeof obj !== 'object' || (0, lodash_es_1.isPlainObject)(obj) === false) {
|
|
26
26
|
return obj;
|
|
27
27
|
}
|
|
28
|
-
const result = (0,
|
|
29
|
-
return (0,
|
|
28
|
+
const result = (0, lodash_es_1.mapKeys)(obj, cb);
|
|
29
|
+
return (0, lodash_es_1.mapValues)(result, (value) => {
|
|
30
30
|
return mapKeysDeep(value, cb);
|
|
31
31
|
});
|
|
32
32
|
};
|
package/cjs/internal/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const assertVersionString: (s: string, msg?: string) => void;
|
|
2
2
|
export declare const isFirmwareVersionAtLeast: (version: string, compareVersion: string) => boolean;
|
|
3
3
|
export declare const isVersionAtLeast: (version: string, compareVersion: string) => boolean;
|
|
4
|
-
export declare const firmwareVersionCompare: (a: string, b: string) =>
|
|
5
|
-
export declare const versionCompare: (a: string, b: string) =>
|
|
4
|
+
export declare const firmwareVersionCompare: (a: string, b: string) => 1 | 0 | -1;
|
|
5
|
+
export declare const versionCompare: (a: string, b: string) => 1 | 0 | -1;
|
|
6
6
|
export declare const fixVersionToDots: (version: string) => string;
|