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,108 @@
|
|
|
1
|
+
import { FIRMWARE_WITH_BITRATE_MODES_SUPPORT, FIRMWARE_WITH_OVERLAYS_SUPPORT } from './constants';
|
|
2
|
+
import { isFirmwareVersionAtLeast } from './versionCompare';
|
|
3
|
+
export const parseBitrateOptionsToVapixParams = (firmWareVersion, bitrateMode, cameraOptions) => {
|
|
4
|
+
if (!isFirmwareVersionAtLeast(firmWareVersion, FIRMWARE_WITH_BITRATE_MODES_SUPPORT)) {
|
|
5
|
+
return `videomaxbitrate=${cameraOptions.maximumBitRate}`;
|
|
6
|
+
}
|
|
7
|
+
if (bitrateMode === undefined) {
|
|
8
|
+
return '';
|
|
9
|
+
}
|
|
10
|
+
const data = {
|
|
11
|
+
VBR: 'videobitratemode=vbr',
|
|
12
|
+
MBR: `videobitratemode=mbr&videomaxbitrate=${cameraOptions.maximumBitRate}&videobitratepriority=framerate`,
|
|
13
|
+
ABR: `videobitratemode=abr&videoabrtargetbitrate=${cameraOptions.maximumBitRate}&videoabrretentiontime=${cameraOptions.retentionTime}&videoabrmaxbitrate=${cameraOptions.bitRateLimit}`,
|
|
14
|
+
};
|
|
15
|
+
return data[bitrateMode];
|
|
16
|
+
};
|
|
17
|
+
export const parseVapixParamsToBitrateOptions = (bitrateVapixParams) => {
|
|
18
|
+
const params = {};
|
|
19
|
+
const searchParams = new URLSearchParams(bitrateVapixParams);
|
|
20
|
+
searchParams.forEach((value, key) => {
|
|
21
|
+
params[key] = value;
|
|
22
|
+
});
|
|
23
|
+
const bitrateMode = params['videobitratemode'] !== undefined ? params['videobitratemode'].toUpperCase() : undefined;
|
|
24
|
+
const hasLowerFw = bitrateMode === undefined && params['videomaxbitrate'] !== undefined;
|
|
25
|
+
if (hasLowerFw) {
|
|
26
|
+
const maximumBitRate = parseInt(params['videomaxbitrate'] ?? '0', 10);
|
|
27
|
+
return {
|
|
28
|
+
bitrateMode: 'MBR',
|
|
29
|
+
maximumBitRate: maximumBitRate,
|
|
30
|
+
retentionTime: 1,
|
|
31
|
+
bitRateLimit: Math.floor(maximumBitRate * 1.1),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (bitrateMode === 'ABR') {
|
|
35
|
+
const maximumBitRate = parseInt(params['videoabrtargetbitrate'] ?? '0', 10);
|
|
36
|
+
const retentionTime = parseInt(params['videoabrretentiontime'] ?? '0', 10);
|
|
37
|
+
const bitRateLimit = parseInt(params['videoabrmaxbitrate'] ?? '0', 10);
|
|
38
|
+
return {
|
|
39
|
+
bitrateMode,
|
|
40
|
+
maximumBitRate,
|
|
41
|
+
retentionTime,
|
|
42
|
+
bitRateLimit,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
else if (bitrateMode === 'MBR') {
|
|
46
|
+
const maximumBitRate = params['videomaxbitrate'] !== undefined ? parseInt(params['videomaxbitrate'], 10) : null;
|
|
47
|
+
const oldMaximumBitrateParamValue = parseInt(params['videombrmaxbitrate'] ?? '0', 10);
|
|
48
|
+
return {
|
|
49
|
+
bitrateMode: bitrateMode,
|
|
50
|
+
maximumBitRate: maximumBitRate ?? oldMaximumBitrateParamValue,
|
|
51
|
+
retentionTime: 1,
|
|
52
|
+
bitRateLimit: Math.floor(maximumBitRate ?? oldMaximumBitrateParamValue * 1.1),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
bitrateMode: bitrateMode,
|
|
57
|
+
retentionTime: 1,
|
|
58
|
+
maximumBitRate: 0,
|
|
59
|
+
bitRateLimit: 0,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
export const parseVideoOptionsToVapixParams = (firmWareVersion, video) => {
|
|
63
|
+
const bitrateParams = parseBitrateOptionsToVapixParams(firmWareVersion, video.bitrateMode, {
|
|
64
|
+
maximumBitRate: video.maximumBitRate,
|
|
65
|
+
retentionTime: video.retentionTime,
|
|
66
|
+
bitRateLimit: video.bitRateLimit,
|
|
67
|
+
});
|
|
68
|
+
let overlaysParams = '';
|
|
69
|
+
if (isFirmwareVersionAtLeast(firmWareVersion, FIRMWARE_WITH_OVERLAYS_SUPPORT) && video.overlays !== undefined) {
|
|
70
|
+
overlaysParams = `&overlays=${video.overlays}`;
|
|
71
|
+
}
|
|
72
|
+
const nbrOfChannels = video.nbrOfChannels ? (video.audio === 1 ? `&nbrOfChannels=${video.nbrOfChannels}` : '') : '';
|
|
73
|
+
const audioParams = `audio=${video.audio}${nbrOfChannels}`;
|
|
74
|
+
const videoCodecParams = video.videoCodec === 'h264'
|
|
75
|
+
? `videoCodec=${video.videoCodec}&h264Profile=${video.h264Profile}`
|
|
76
|
+
: `videoCodec=${video.videoCodec}`;
|
|
77
|
+
const videoParams = `camera=${video.camera}&resolution=${video.resolution}&fps=${video.fps}&compression=${video.compression}&videokeyframeinterval=${video.govLength}&${videoCodecParams}${overlaysParams}`;
|
|
78
|
+
return [videoParams, bitrateParams, audioParams].join('&');
|
|
79
|
+
};
|
|
80
|
+
export const parseVapixParamsToVideoOptions = (internalVapixParams) => {
|
|
81
|
+
const bitrateOptions = parseVapixParamsToBitrateOptions(internalVapixParams);
|
|
82
|
+
const params = {};
|
|
83
|
+
const searchParams = new URLSearchParams(internalVapixParams);
|
|
84
|
+
searchParams.forEach((value, key) => {
|
|
85
|
+
params[key] = value;
|
|
86
|
+
});
|
|
87
|
+
let h264Profile = undefined;
|
|
88
|
+
if (params['videoCodec'] === 'h264') {
|
|
89
|
+
h264Profile = (params['h264Profile'] ?? 'high');
|
|
90
|
+
}
|
|
91
|
+
let nbrOfChannels = undefined;
|
|
92
|
+
if (params['audio'] === '1') {
|
|
93
|
+
nbrOfChannels = parseInt(params['nbrOfChannels'] ?? '1');
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
...bitrateOptions,
|
|
97
|
+
camera: params['camera'] ?? '1',
|
|
98
|
+
resolution: params['resolution'] ?? '',
|
|
99
|
+
fps: parseInt(params['fps'] ?? '0', 10),
|
|
100
|
+
compression: parseInt(params['compression'] ?? '0', 10),
|
|
101
|
+
govLength: parseInt(params['videokeyframeinterval'] ?? '0', 10),
|
|
102
|
+
videoCodec: (params['videoCodec'] ?? 'h264'),
|
|
103
|
+
h264Profile,
|
|
104
|
+
audio: parseInt(params['audio'] ?? '0'),
|
|
105
|
+
nbrOfChannels,
|
|
106
|
+
overlays: params['overlays'],
|
|
107
|
+
};
|
|
108
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { camelCase, snakeCase, isPlainObject, mapKeys, mapValues } from 'lodash';
|
|
1
|
+
import { camelCase, snakeCase, isPlainObject, mapKeys, mapValues } from 'lodash-es';
|
|
2
2
|
export const toCamelCase = (o) => mapKeys(o, camelCaseKey);
|
|
3
3
|
export const toCamelCaseDeep = (o) => {
|
|
4
4
|
return mapKeysDeep(o, camelCaseKey);
|
|
@@ -9,6 +9,7 @@ import { customGraphicsSchema } from './customGraphicsSchema';
|
|
|
9
9
|
import { screenSharingSchema } from './screenSharingSchema';
|
|
10
10
|
import { webCameraSharingSchema } from './webCameraSharingSchema';
|
|
11
11
|
import { baseballScoreBoardAutomaticSchema, baseballScoreBoardSchema, scoreBoardSchema, scoreOverviewSchema, } from './scoreBoardSchema';
|
|
12
|
+
import { htmlOverlaySchema } from './htmlOverlaySchema';
|
|
12
13
|
export const wsResponseSchema = z.object({
|
|
13
14
|
status: z.number(),
|
|
14
15
|
message: z.string(),
|
|
@@ -27,6 +28,7 @@ export const servicesSchema = z.discriminatedUnion('name', [
|
|
|
27
28
|
baseballScoreBoardSchema,
|
|
28
29
|
baseballScoreBoardAutomaticSchema,
|
|
29
30
|
scoreOverviewSchema,
|
|
31
|
+
htmlOverlaySchema,
|
|
30
32
|
]);
|
|
31
33
|
export const serviceListSchema = z.object({
|
|
32
34
|
services: z.array(servicesSchema),
|
|
@@ -44,33 +46,68 @@ export const isScoreBoard = (service) => service.name === 'scoreBoard';
|
|
|
44
46
|
export const isBaseballScoreBoard = (service) => service.name === 'baseballScoreBoard';
|
|
45
47
|
export const isBaseballScoreBoardAutomatic = (service) => service.name === 'myBallBaseballWidgets';
|
|
46
48
|
export const isScoreOverview = (service) => service.name === 'scoreOverview';
|
|
49
|
+
export const isHtmlOverlay = (service) => service.name === 'htmlOverlay';
|
|
47
50
|
export var ImageType;
|
|
48
51
|
(function (ImageType) {
|
|
49
52
|
ImageType[ImageType["PNG"] = 0] = "PNG";
|
|
50
53
|
ImageType[ImageType["JPEG"] = 1] = "JPEG";
|
|
51
54
|
})(ImageType || (ImageType = {}));
|
|
52
|
-
export const
|
|
55
|
+
export const imageFileStorageTypeSchema = z.union([
|
|
53
56
|
z.literal('flash'),
|
|
54
57
|
z.literal('SD0'),
|
|
55
58
|
z.literal('ftp'),
|
|
56
59
|
z.literal('samba'),
|
|
57
60
|
z.literal('url'),
|
|
58
61
|
]);
|
|
59
|
-
export const
|
|
60
|
-
|
|
62
|
+
export const fontFileStorageTypeSchema = z.union([z.literal('flash'), z.literal('SD0')]);
|
|
63
|
+
export const imageFilestorageDataListSchema = z.array(z.object({
|
|
64
|
+
type: imageFileStorageTypeSchema,
|
|
61
65
|
state: z.string(),
|
|
62
66
|
}));
|
|
63
|
-
export const
|
|
67
|
+
export const fontStorageDataListSchema = z.array(z.object({
|
|
68
|
+
type: fontFileStorageTypeSchema,
|
|
69
|
+
state: z.string(),
|
|
70
|
+
}));
|
|
71
|
+
export const getStorageDataListSchema = (fileType) => {
|
|
72
|
+
return fileType === 'image' ? imageFilestorageDataListSchema : fontStorageDataListSchema;
|
|
73
|
+
};
|
|
74
|
+
export const imageStorageResponseSchema = z.object({
|
|
64
75
|
code: z.number(),
|
|
65
|
-
list:
|
|
76
|
+
list: imageFilestorageDataListSchema,
|
|
66
77
|
});
|
|
67
|
-
export const
|
|
78
|
+
export const fontStorageResponseSchema = z.object({
|
|
79
|
+
code: z.number(),
|
|
80
|
+
list: fontStorageDataListSchema,
|
|
81
|
+
});
|
|
82
|
+
export const getStorageResponseSchema = (fileType) => {
|
|
83
|
+
return fileType === 'image' ? imageStorageResponseSchema : fontStorageResponseSchema;
|
|
84
|
+
};
|
|
85
|
+
export const imageFileSchema = z.object({
|
|
68
86
|
name: z.string(),
|
|
69
87
|
path: z.string().url(),
|
|
70
|
-
storage:
|
|
88
|
+
storage: imageFileStorageTypeSchema,
|
|
89
|
+
});
|
|
90
|
+
export const fontFileSchema = z.object({
|
|
91
|
+
name: z.string(),
|
|
92
|
+
path: z.string().url(),
|
|
93
|
+
storage: fontFileStorageTypeSchema,
|
|
94
|
+
});
|
|
95
|
+
export const getFileSchema = (fileType) => {
|
|
96
|
+
return fileType === 'image' ? imageFileSchema : fontFileSchema;
|
|
97
|
+
};
|
|
98
|
+
export const imageFileListSchema = z.array(imageFileSchema);
|
|
99
|
+
export const fontFileListSchema = z.array(fontFileSchema);
|
|
100
|
+
export const getFileListSchema = (fileType) => {
|
|
101
|
+
return fileType === 'image' ? imageFileListSchema : fontFileListSchema;
|
|
102
|
+
};
|
|
103
|
+
export const imageFileDataSchema = z.object({
|
|
104
|
+
code: z.number(),
|
|
105
|
+
list: imageFileListSchema,
|
|
71
106
|
});
|
|
72
|
-
export const
|
|
73
|
-
export const fileDataSchema = z.object({
|
|
107
|
+
export const fontFileDataSchema = z.object({
|
|
74
108
|
code: z.number(),
|
|
75
|
-
list:
|
|
109
|
+
list: fontFileListSchema,
|
|
76
110
|
});
|
|
111
|
+
export const getFileDataSchema = (fileType) => {
|
|
112
|
+
return fileType === 'image' ? imageFileDataSchema : fontFileDataSchema;
|
|
113
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { serviceNames, serviceCommonSchema, coordinateSystemSchema } from './serviceCommonTypes';
|
|
3
|
+
export const htmlOverlaySchema = serviceCommonSchema.extend({
|
|
4
|
+
name: z.literal(serviceNames.htmlOverlay),
|
|
5
|
+
pos_x: z.number().nonnegative(),
|
|
6
|
+
pos_y: z.number().nonnegative(),
|
|
7
|
+
coordSystem: coordinateSystemSchema,
|
|
8
|
+
url: z.string().url().or(z.literal('')).default(''),
|
|
9
|
+
pageWidth: z.number().nonnegative(),
|
|
10
|
+
pageHeight: z.number().nonnegative(),
|
|
11
|
+
fps: z.number().nonnegative(),
|
|
12
|
+
scale: z.number(),
|
|
13
|
+
cropEnabled: z.boolean(),
|
|
14
|
+
cropLeft: z.number().nonnegative(),
|
|
15
|
+
cropTop: z.number().nonnegative(),
|
|
16
|
+
cropWidth: z.number().nonnegative(),
|
|
17
|
+
cropHeight: z.number().nonnegative(),
|
|
18
|
+
});
|
|
@@ -13,6 +13,7 @@ export const serviceNames = {
|
|
|
13
13
|
baseballScoreBoard: 'baseballScoreBoard',
|
|
14
14
|
myBallBaseballWidgets: 'myBallBaseballWidgets',
|
|
15
15
|
scoreOverview: 'scoreOverview',
|
|
16
|
+
htmlOverlay: 'htmlOverlay',
|
|
16
17
|
};
|
|
17
18
|
export const coordinateSystemSchema = z.union([
|
|
18
19
|
z.literal('top_left'),
|
|
@@ -51,16 +52,18 @@ export const weatherUnitSchema = z.union([z.literal('Metric'), z.literal('Imperi
|
|
|
51
52
|
export const serviceCommonSchema = z.object({
|
|
52
53
|
id: z.number().nonnegative(),
|
|
53
54
|
enabled: z.union([z.literal(0), z.literal(1)]),
|
|
54
|
-
automationType: z
|
|
55
|
+
automationType: z
|
|
56
|
+
.union([
|
|
55
57
|
z.literal('time'),
|
|
56
58
|
z.literal('manual'),
|
|
57
59
|
z.literal('schedule'),
|
|
58
60
|
z.custom((val) => {
|
|
59
61
|
return typeof val === 'string' ? /^input\d+$/.test(val) : false;
|
|
60
62
|
}),
|
|
61
|
-
])
|
|
63
|
+
])
|
|
64
|
+
.default('manual'),
|
|
62
65
|
invertInput: z.boolean().optional(),
|
|
63
|
-
cameraList: z.array(z.number()),
|
|
66
|
+
cameraList: z.array(z.number()).default([0]),
|
|
64
67
|
camera: z.number().nonnegative().optional(),
|
|
65
68
|
schedule: z.string().optional(),
|
|
66
69
|
customName: z.string().default(''),
|
|
@@ -1,25 +1,12 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
1
|
+
import { boolean, z } from 'zod';
|
|
2
2
|
import { facebookSchema } from './facebookSchema';
|
|
3
|
-
import { mpegDvbSchema } from './mpegDvbSchema';
|
|
4
|
-
import { rtmpSchema } from './rtmpSchema';
|
|
5
|
-
import { sdCardSchema } from './sdCardSchema';
|
|
6
3
|
import { windySchema } from './windySchema';
|
|
7
4
|
import { youtubeSchema } from './youtubeSchema';
|
|
8
|
-
import { vimeoSchema } from './
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import { srtSchema } from './srtSchema';
|
|
12
|
-
import { daCastSchema } from './daCastSchema';
|
|
13
|
-
import { hlsPullSchema } from './hlsPullSchema';
|
|
14
|
-
import { hlsPushSchema } from './hlsPushSchema';
|
|
15
|
-
import { wowzaSchema } from './wowzaSchema';
|
|
16
|
-
import { dailymotionSchema } from './dailymotionSchema';
|
|
17
|
-
import { ibmSchema } from './ibmSchema';
|
|
18
|
-
import { microsoftAzureSchema } from './microsoftAzureSchema';
|
|
19
|
-
import { microsoftStreamSchema } from './microsoftStreamSchema';
|
|
20
|
-
import { gameChangerSchema } from './gameChangerSchema';
|
|
21
|
-
export const streamSchema = z.discriminatedUnion('type', [
|
|
5
|
+
import { daCastSchema, dailymotionSchema, facebookRtmpSchema, gameChangerSchema, hlsPullSchema, hlsPushSchema, ibmSchema, microsoftAzureSchema, microsoftStreamSchema, mpegDvbSchema, rtmpSchema, sdCardSchema, srtSchema, streamPlatforms, twitchSchema, vimeoSchema, wowzaSchema, youtubeRtmpSchema, } from './streamsSchema';
|
|
6
|
+
import { fileSchema } from '../common';
|
|
7
|
+
export const streamSchema = z.discriminatedUnion('platform', [
|
|
22
8
|
facebookSchema,
|
|
9
|
+
facebookRtmpSchema,
|
|
23
10
|
mpegDvbSchema,
|
|
24
11
|
rtmpSchema,
|
|
25
12
|
sdCardSchema,
|
|
@@ -27,7 +14,6 @@ export const streamSchema = z.discriminatedUnion('type', [
|
|
|
27
14
|
youtubeSchema,
|
|
28
15
|
vimeoSchema,
|
|
29
16
|
twitchSchema,
|
|
30
|
-
churchSchema,
|
|
31
17
|
srtSchema,
|
|
32
18
|
daCastSchema,
|
|
33
19
|
hlsPullSchema,
|
|
@@ -38,64 +24,68 @@ export const streamSchema = z.discriminatedUnion('type', [
|
|
|
38
24
|
microsoftAzureSchema,
|
|
39
25
|
microsoftStreamSchema,
|
|
40
26
|
gameChangerSchema,
|
|
27
|
+
youtubeRtmpSchema,
|
|
41
28
|
]);
|
|
42
29
|
export const streamListSchema = z.object({ streamList: z.array(streamSchema) });
|
|
43
30
|
export const isFacebookStream = (stream) => {
|
|
44
|
-
return stream.
|
|
31
|
+
return stream.platform === streamPlatforms.facebook;
|
|
32
|
+
};
|
|
33
|
+
export const isFacebookRtmpStream = (stream) => {
|
|
34
|
+
return stream.platform === streamPlatforms.facebook_rtmp;
|
|
45
35
|
};
|
|
46
36
|
export const isMpegDvbStream = (stream) => {
|
|
47
|
-
return stream.
|
|
37
|
+
return stream.platform === streamPlatforms.mpeg_dvb;
|
|
48
38
|
};
|
|
49
39
|
export const isRtmpStream = (stream) => {
|
|
50
|
-
return stream.
|
|
40
|
+
return stream.platform === streamPlatforms.rtmp;
|
|
51
41
|
};
|
|
52
42
|
export const isSdCardStream = (stream) => {
|
|
53
|
-
return stream.
|
|
43
|
+
return stream.platform === streamPlatforms.sd_card;
|
|
54
44
|
};
|
|
55
45
|
export const isWindyStream = (stream) => {
|
|
56
|
-
return stream.
|
|
46
|
+
return stream.platform === streamPlatforms.windy;
|
|
57
47
|
};
|
|
58
48
|
export const isYouTubeStream = (stream) => {
|
|
59
|
-
return stream.
|
|
49
|
+
return stream.platform === streamPlatforms.youtube;
|
|
60
50
|
};
|
|
61
51
|
export const isVimeoStream = (stream) => {
|
|
62
|
-
return stream.
|
|
52
|
+
return stream.platform === streamPlatforms.vimeo;
|
|
63
53
|
};
|
|
64
54
|
export const isTwitchStream = (stream) => {
|
|
65
|
-
return stream.
|
|
66
|
-
};
|
|
67
|
-
export const isChurchStream = (stream) => {
|
|
68
|
-
return stream.type === 'church';
|
|
55
|
+
return stream.platform === streamPlatforms.twitch;
|
|
69
56
|
};
|
|
70
57
|
export const isSrtStream = (stream) => {
|
|
71
|
-
return stream.
|
|
58
|
+
return stream.platform === streamPlatforms.srt;
|
|
72
59
|
};
|
|
73
60
|
export const isDaCastStream = (stream) => {
|
|
74
|
-
return stream.
|
|
61
|
+
return stream.platform === streamPlatforms.da_cast;
|
|
75
62
|
};
|
|
76
63
|
export const isHlsPullStream = (stream) => {
|
|
77
|
-
return stream.
|
|
64
|
+
return stream.platform === streamPlatforms.hls_pull;
|
|
78
65
|
};
|
|
79
66
|
export const isHlsPushStream = (stream) => {
|
|
80
|
-
return stream.
|
|
67
|
+
return stream.platform === streamPlatforms.hls_push;
|
|
81
68
|
};
|
|
82
69
|
export const isWowzaStream = (stream) => {
|
|
83
|
-
return stream.
|
|
70
|
+
return stream.platform === streamPlatforms.wowza;
|
|
84
71
|
};
|
|
85
72
|
export const isDailymotionStream = (stream) => {
|
|
86
|
-
return stream.
|
|
73
|
+
return stream.platform === streamPlatforms.dailymotion;
|
|
87
74
|
};
|
|
88
75
|
export const isIbmStream = (stream) => {
|
|
89
|
-
return stream.
|
|
76
|
+
return stream.platform === streamPlatforms.ibm;
|
|
90
77
|
};
|
|
91
78
|
export const isMicrosoftAzureStream = (stream) => {
|
|
92
|
-
return stream.
|
|
79
|
+
return stream.platform === streamPlatforms.microsoft_azure;
|
|
93
80
|
};
|
|
94
81
|
export const isMicrosoftStream = (stream) => {
|
|
95
|
-
return stream.
|
|
82
|
+
return stream.platform === streamPlatforms.microsoft_stream;
|
|
96
83
|
};
|
|
97
84
|
export const isGameChangerStream = (stream) => {
|
|
98
|
-
return stream.
|
|
85
|
+
return stream.platform === streamPlatforms.game_changer;
|
|
86
|
+
};
|
|
87
|
+
export const isYoutubeRtmpStream = (stream) => {
|
|
88
|
+
return stream.platform === streamPlatforms.youtube_rtmp;
|
|
99
89
|
};
|
|
100
90
|
export var AudioType;
|
|
101
91
|
(function (AudioType) {
|
|
@@ -125,7 +115,85 @@ export const audioUrlSchema = z.object({
|
|
|
125
115
|
storage: z.literal('url'),
|
|
126
116
|
});
|
|
127
117
|
export const audioLocalSchema = z.object({
|
|
128
|
-
file:
|
|
118
|
+
file: fileSchema,
|
|
129
119
|
name: z.string(),
|
|
130
120
|
storage: z.enum(['flash', 'SD0']),
|
|
131
121
|
});
|
|
122
|
+
export const streamStatsSchema = z.object({
|
|
123
|
+
net_stats: z.string(),
|
|
124
|
+
stream_bytes_time_ms: z.number().nonnegative(),
|
|
125
|
+
stream_bytes: z.number().nonnegative(),
|
|
126
|
+
start_count: z.number().nonnegative(),
|
|
127
|
+
is_streaming: z.literal(0).or(z.literal(1)),
|
|
128
|
+
});
|
|
129
|
+
export const srtStreamStatisticsSchema = z.object({
|
|
130
|
+
msTimeStamp: z.number().nonnegative(),
|
|
131
|
+
pktSentTotal: z.number().nonnegative(),
|
|
132
|
+
byteSentTotal: z.number().nonnegative(),
|
|
133
|
+
pktRetransTotal: z.number().nonnegative(),
|
|
134
|
+
byteRetransTotal: z.number().nonnegative(),
|
|
135
|
+
pktSndDropTotal: z.number().nonnegative(),
|
|
136
|
+
byteSndDropTotal: z.number().nonnegative(),
|
|
137
|
+
mbpsSendRate: z.number().nonnegative(),
|
|
138
|
+
mbpsBandwidth: z.number().nonnegative(),
|
|
139
|
+
mbpsMaxBW: z.number().nonnegative(),
|
|
140
|
+
msRTT: z.number().nonnegative(),
|
|
141
|
+
msSndBuf: z.number().nonnegative(),
|
|
142
|
+
});
|
|
143
|
+
export const diagnosticsParamsSchema = z.object({
|
|
144
|
+
camerainfo: boolean().optional(),
|
|
145
|
+
checkserver: boolean().optional(),
|
|
146
|
+
checkservertime: boolean().optional(),
|
|
147
|
+
speedtest: boolean().optional(),
|
|
148
|
+
pingtest: boolean().optional(),
|
|
149
|
+
videoHostPort: z.string().optional(),
|
|
150
|
+
audioHostPort: z.string().optional(),
|
|
151
|
+
});
|
|
152
|
+
export const diagnosticsSchema = z.object({
|
|
153
|
+
status: z.number(),
|
|
154
|
+
message: z.string(),
|
|
155
|
+
data: z.object({
|
|
156
|
+
audioHostPort: z
|
|
157
|
+
.object({
|
|
158
|
+
code: z.number(),
|
|
159
|
+
message: z.string(),
|
|
160
|
+
})
|
|
161
|
+
.optional(),
|
|
162
|
+
cameraInfo: z
|
|
163
|
+
.object({
|
|
164
|
+
uptime: z.string(),
|
|
165
|
+
availableRAM: z.number(),
|
|
166
|
+
availableInternal: z.number(),
|
|
167
|
+
})
|
|
168
|
+
.optional(),
|
|
169
|
+
checkServer: z
|
|
170
|
+
.object({
|
|
171
|
+
state: z.string(),
|
|
172
|
+
message: z.string(),
|
|
173
|
+
})
|
|
174
|
+
.optional(),
|
|
175
|
+
checkServerTime: z
|
|
176
|
+
.object({
|
|
177
|
+
code: z.number(),
|
|
178
|
+
message: z.string(),
|
|
179
|
+
})
|
|
180
|
+
.optional(),
|
|
181
|
+
videoHostPort: z
|
|
182
|
+
.object({
|
|
183
|
+
code: z.number(),
|
|
184
|
+
message: z.string(),
|
|
185
|
+
})
|
|
186
|
+
.optional(),
|
|
187
|
+
speedTest: z
|
|
188
|
+
.object({
|
|
189
|
+
code: z.string(),
|
|
190
|
+
data: z.array(z.object({ timestamp: z.number(), speed: z.number() })),
|
|
191
|
+
})
|
|
192
|
+
.optional(),
|
|
193
|
+
pingTest: z
|
|
194
|
+
.object({
|
|
195
|
+
output: z.string(),
|
|
196
|
+
})
|
|
197
|
+
.optional(),
|
|
198
|
+
}),
|
|
199
|
+
});
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
2
|
import { streamCommonSchema } from './streamCommonTypes';
|
|
3
|
+
const timelinePostSchema = z.object({
|
|
4
|
+
postLocation: z.literal('timeline'),
|
|
5
|
+
streamPrivacy: z.union([z.literal('public'), z.literal('friends'), z.literal('only_me')]),
|
|
6
|
+
});
|
|
7
|
+
const pagePostSchema = z.object({
|
|
8
|
+
postLocation: z.literal('page'),
|
|
9
|
+
page: z.string(),
|
|
10
|
+
});
|
|
3
11
|
export const facebookSchema = streamCommonSchema.extend({
|
|
4
|
-
|
|
12
|
+
platform: z.literal('facebook'),
|
|
13
|
+
description: z.string().optional(),
|
|
14
|
+
deleteAfterEnd: z.boolean(),
|
|
15
|
+
countdown: z.boolean(),
|
|
16
|
+
post: z.discriminatedUnion('postLocation', [timelinePostSchema, pagePostSchema]),
|
|
5
17
|
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export * from './CamStreamerAPI';
|
|
2
2
|
export * from './streamCommonTypes';
|
|
3
3
|
export * from './facebookSchema';
|
|
4
|
-
export * from './mpegDvbSchema';
|
|
5
|
-
export * from './rtmpSchema';
|
|
6
|
-
export * from './sdCardSchema';
|
|
7
4
|
export * from './windySchema';
|
|
8
5
|
export * from './youtubeSchema';
|
|
6
|
+
export * from './streamsSchema';
|
|
@@ -23,7 +23,7 @@ export const oldStringStreamSchema = z.object({
|
|
|
23
23
|
stopTime: z.string(),
|
|
24
24
|
});
|
|
25
25
|
export const oldStringStreamSchemaWithId = oldStringStreamSchema.extend({
|
|
26
|
-
|
|
26
|
+
streamId: z.string(),
|
|
27
27
|
});
|
|
28
28
|
export const oldStreamSchema = z.object({
|
|
29
29
|
enabled: z.union([z.literal(0), z.literal(1)]),
|