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.
Files changed (218) hide show
  1. package/README.md +44 -15
  2. package/cjs/CamOverlayAPI.d.ts +145 -107
  3. package/cjs/CamOverlayAPI.js +14 -63
  4. package/cjs/CamScripterAPI.d.ts +5 -8
  5. package/cjs/CamScripterAPI.js +11 -29
  6. package/cjs/CamStreamerAPI.d.ts +2362 -806
  7. package/cjs/CamStreamerAPI.js +68 -76
  8. package/cjs/CamSwitcherAPI.d.ts +23 -22
  9. package/cjs/CamSwitcherAPI.js +30 -88
  10. package/cjs/PlaneTrackerAPI.d.ts +28 -30
  11. package/cjs/PlaneTrackerAPI.js +20 -75
  12. package/cjs/VapixAPI.d.ts +36 -23
  13. package/cjs/VapixAPI.js +227 -106
  14. package/cjs/errors/errors.d.ts +11 -5
  15. package/cjs/errors/errors.js +5 -1
  16. package/cjs/index.d.ts +1 -0
  17. package/cjs/index.js +1 -0
  18. package/cjs/internal/BasicAPI.d.ts +15 -0
  19. package/cjs/internal/BasicAPI.js +93 -0
  20. package/cjs/internal/WsEvents.d.ts +1 -0
  21. package/cjs/internal/WsEvents.js +5 -0
  22. package/cjs/internal/constants.d.ts +1 -0
  23. package/cjs/internal/constants.js +2 -1
  24. package/cjs/internal/convertors.d.ts +6 -0
  25. package/cjs/internal/convertors.js +115 -0
  26. package/cjs/internal/transformers.js +8 -8
  27. package/cjs/internal/types.d.ts +3 -0
  28. package/cjs/internal/versionCompare.d.ts +2 -2
  29. package/cjs/types/CamOverlayAPI/CamOverlayAPI.d.ts +878 -358
  30. package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +54 -11
  31. package/cjs/types/CamOverlayAPI/accuweatherSchema.d.ts +10 -10
  32. package/cjs/types/CamOverlayAPI/customGraphicsSchema.d.ts +28 -28
  33. package/cjs/types/CamOverlayAPI/htmlOverlaySchema.d.ts +81 -0
  34. package/cjs/types/CamOverlayAPI/htmlOverlaySchema.js +21 -0
  35. package/cjs/types/CamOverlayAPI/imagesSchema.d.ts +10 -10
  36. package/cjs/types/CamOverlayAPI/index.d.ts +1 -0
  37. package/cjs/types/CamOverlayAPI/index.js +1 -0
  38. package/cjs/types/CamOverlayAPI/infotickerSchema.d.ts +8 -8
  39. package/cjs/types/CamOverlayAPI/pipSchema.d.ts +8 -8
  40. package/cjs/types/CamOverlayAPI/ptzCompassSchema.d.ts +10 -10
  41. package/cjs/types/CamOverlayAPI/ptzSchema.d.ts +13 -13
  42. package/cjs/types/CamOverlayAPI/scoreBoardSchema.d.ts +18 -18
  43. package/cjs/types/CamOverlayAPI/screenSharingSchema.d.ts +8 -8
  44. package/cjs/types/CamOverlayAPI/serviceCommonTypes.d.ts +17 -16
  45. package/cjs/types/CamOverlayAPI/serviceCommonTypes.js +6 -3
  46. package/cjs/types/CamOverlayAPI/webCameraSharingSchema.d.ts +8 -8
  47. package/cjs/types/CamScripterAPI.d.ts +0 -11
  48. package/cjs/types/CamScripterAPI.js +1 -5
  49. package/cjs/types/CamStreamerAPI/CamStreamerAPI.d.ts +17745 -4940
  50. package/cjs/types/CamStreamerAPI/CamStreamerAPI.js +126 -57
  51. package/cjs/types/CamStreamerAPI/facebookSchema.d.ts +395 -86
  52. package/cjs/types/CamStreamerAPI/facebookSchema.js +13 -1
  53. package/cjs/types/CamStreamerAPI/index.d.ts +1 -3
  54. package/cjs/types/CamStreamerAPI/index.js +1 -3
  55. package/cjs/types/CamStreamerAPI/oldStreamSchema.d.ts +47 -47
  56. package/cjs/types/CamStreamerAPI/oldStreamSchema.js +1 -1
  57. package/cjs/types/CamStreamerAPI/streamCommonTypes.d.ts +392 -304
  58. package/cjs/types/CamStreamerAPI/streamCommonTypes.js +116 -76
  59. package/cjs/types/CamStreamerAPI/streamsSchema.d.ts +8812 -0
  60. package/cjs/types/CamStreamerAPI/streamsSchema.js +81 -0
  61. package/cjs/types/CamStreamerAPI/windySchema.d.ts +356 -87
  62. package/cjs/types/CamStreamerAPI/windySchema.js +9 -1
  63. package/cjs/types/CamStreamerAPI/youtubeSchema.d.ts +351 -119
  64. package/cjs/types/CamStreamerAPI/youtubeSchema.js +5 -9
  65. package/cjs/types/CamSwitcherAPI.d.ts +96 -91
  66. package/cjs/types/CamSwitcherAPI.js +9 -9
  67. package/cjs/types/GenetecAgent.d.ts +2 -2
  68. package/cjs/types/PlaneTrackerAPI.d.ts +60 -47
  69. package/cjs/types/PlaneTrackerAPI.js +5 -2
  70. package/cjs/types/VapixAPI.d.ts +51 -32
  71. package/cjs/types/VapixAPI.js +10 -3
  72. package/cjs/types/common.d.ts +27 -0
  73. package/cjs/types/common.js +13 -1
  74. package/cjs/types/ws/CamStreamerEvents.d.ts +110 -77
  75. package/cjs/types/ws/CamStreamerEvents.js +11 -7
  76. package/cjs/types/ws/CamSwitcherEvents.d.ts +8 -8
  77. package/cjs/types/ws/PlaneTrackerEvents.d.ts +3 -3
  78. package/esm/CamOverlayAPI.js +16 -65
  79. package/esm/CamScripterAPI.js +9 -30
  80. package/esm/CamStreamerAPI.js +70 -78
  81. package/esm/CamSwitcherAPI.js +31 -89
  82. package/esm/PlaneTrackerAPI.js +21 -76
  83. package/esm/VapixAPI.js +228 -107
  84. package/esm/errors/errors.js +5 -1
  85. package/esm/index.js +1 -0
  86. package/esm/internal/BasicAPI.js +89 -0
  87. package/esm/internal/WsEvents.js +5 -0
  88. package/esm/internal/constants.js +1 -0
  89. package/esm/internal/convertors.js +108 -0
  90. package/esm/internal/transformers.js +1 -1
  91. package/esm/types/CamOverlayAPI/CamOverlayAPI.js +47 -10
  92. package/esm/types/CamOverlayAPI/htmlOverlaySchema.js +18 -0
  93. package/esm/types/CamOverlayAPI/index.js +1 -0
  94. package/esm/types/CamOverlayAPI/serviceCommonTypes.js +6 -3
  95. package/esm/types/CamScripterAPI.js +0 -4
  96. package/esm/types/CamStreamerAPI/CamStreamerAPI.js +109 -41
  97. package/esm/types/CamStreamerAPI/facebookSchema.js +13 -1
  98. package/esm/types/CamStreamerAPI/index.js +1 -3
  99. package/esm/types/CamStreamerAPI/oldStreamSchema.js +1 -1
  100. package/esm/types/CamStreamerAPI/streamCommonTypes.js +116 -76
  101. package/esm/types/CamStreamerAPI/streamsSchema.js +75 -0
  102. package/esm/types/CamStreamerAPI/windySchema.js +9 -1
  103. package/esm/types/CamStreamerAPI/youtubeSchema.js +5 -9
  104. package/esm/types/CamSwitcherAPI.js +8 -8
  105. package/esm/types/PlaneTrackerAPI.js +5 -2
  106. package/esm/types/VapixAPI.js +9 -2
  107. package/esm/types/common.js +12 -0
  108. package/esm/types/ws/CamStreamerEvents.js +11 -7
  109. package/package.json +4 -4
  110. package/types/CamOverlayAPI.d.ts +145 -107
  111. package/types/CamScripterAPI.d.ts +5 -8
  112. package/types/CamStreamerAPI.d.ts +2362 -806
  113. package/types/CamSwitcherAPI.d.ts +23 -22
  114. package/types/PlaneTrackerAPI.d.ts +28 -30
  115. package/types/VapixAPI.d.ts +36 -23
  116. package/types/errors/errors.d.ts +11 -5
  117. package/types/index.d.ts +1 -0
  118. package/types/internal/BasicAPI.d.ts +15 -0
  119. package/types/internal/WsEvents.d.ts +1 -0
  120. package/types/internal/constants.d.ts +1 -0
  121. package/types/internal/convertors.d.ts +6 -0
  122. package/types/internal/types.d.ts +3 -0
  123. package/types/internal/versionCompare.d.ts +2 -2
  124. package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +878 -358
  125. package/types/types/CamOverlayAPI/accuweatherSchema.d.ts +10 -10
  126. package/types/types/CamOverlayAPI/customGraphicsSchema.d.ts +28 -28
  127. package/types/types/CamOverlayAPI/htmlOverlaySchema.d.ts +81 -0
  128. package/types/types/CamOverlayAPI/imagesSchema.d.ts +10 -10
  129. package/types/types/CamOverlayAPI/index.d.ts +1 -0
  130. package/types/types/CamOverlayAPI/infotickerSchema.d.ts +8 -8
  131. package/types/types/CamOverlayAPI/pipSchema.d.ts +8 -8
  132. package/types/types/CamOverlayAPI/ptzCompassSchema.d.ts +10 -10
  133. package/types/types/CamOverlayAPI/ptzSchema.d.ts +13 -13
  134. package/types/types/CamOverlayAPI/scoreBoardSchema.d.ts +18 -18
  135. package/types/types/CamOverlayAPI/screenSharingSchema.d.ts +8 -8
  136. package/types/types/CamOverlayAPI/serviceCommonTypes.d.ts +17 -16
  137. package/types/types/CamOverlayAPI/webCameraSharingSchema.d.ts +8 -8
  138. package/types/types/CamScripterAPI.d.ts +0 -11
  139. package/types/types/CamStreamerAPI/CamStreamerAPI.d.ts +17745 -4940
  140. package/types/types/CamStreamerAPI/facebookSchema.d.ts +395 -86
  141. package/types/types/CamStreamerAPI/index.d.ts +1 -3
  142. package/types/types/CamStreamerAPI/oldStreamSchema.d.ts +47 -47
  143. package/types/types/CamStreamerAPI/streamCommonTypes.d.ts +392 -304
  144. package/types/types/CamStreamerAPI/streamsSchema.d.ts +8812 -0
  145. package/types/types/CamStreamerAPI/windySchema.d.ts +356 -87
  146. package/types/types/CamStreamerAPI/youtubeSchema.d.ts +351 -119
  147. package/types/types/CamSwitcherAPI.d.ts +96 -91
  148. package/types/types/GenetecAgent.d.ts +2 -2
  149. package/types/types/PlaneTrackerAPI.d.ts +60 -47
  150. package/types/types/VapixAPI.d.ts +51 -32
  151. package/types/types/common.d.ts +27 -0
  152. package/types/types/ws/CamStreamerEvents.d.ts +110 -77
  153. package/types/types/ws/CamSwitcherEvents.d.ts +8 -8
  154. package/types/types/ws/PlaneTrackerEvents.d.ts +3 -3
  155. package/cjs/types/CamStreamerAPI/churchSchema.d.ts +0 -275
  156. package/cjs/types/CamStreamerAPI/churchSchema.js +0 -11
  157. package/cjs/types/CamStreamerAPI/daCastSchema.d.ts +0 -275
  158. package/cjs/types/CamStreamerAPI/daCastSchema.js +0 -11
  159. package/cjs/types/CamStreamerAPI/dailymotionSchema.d.ts +0 -275
  160. package/cjs/types/CamStreamerAPI/dailymotionSchema.js +0 -11
  161. package/cjs/types/CamStreamerAPI/gameChangerSchema.d.ts +0 -275
  162. package/cjs/types/CamStreamerAPI/gameChangerSchema.js +0 -11
  163. package/cjs/types/CamStreamerAPI/hlsPullSchema.d.ts +0 -275
  164. package/cjs/types/CamStreamerAPI/hlsPullSchema.js +0 -11
  165. package/cjs/types/CamStreamerAPI/hlsPushSchema.d.ts +0 -275
  166. package/cjs/types/CamStreamerAPI/hlsPushSchema.js +0 -11
  167. package/cjs/types/CamStreamerAPI/ibmSchema.d.ts +0 -275
  168. package/cjs/types/CamStreamerAPI/ibmSchema.js +0 -11
  169. package/cjs/types/CamStreamerAPI/microsoftAzureSchema.d.ts +0 -275
  170. package/cjs/types/CamStreamerAPI/microsoftAzureSchema.js +0 -11
  171. package/cjs/types/CamStreamerAPI/microsoftStreamSchema.d.ts +0 -275
  172. package/cjs/types/CamStreamerAPI/microsoftStreamSchema.js +0 -11
  173. package/cjs/types/CamStreamerAPI/mpegDvbSchema.d.ts +0 -323
  174. package/cjs/types/CamStreamerAPI/mpegDvbSchema.js +0 -27
  175. package/cjs/types/CamStreamerAPI/rtmpSchema.d.ts +0 -284
  176. package/cjs/types/CamStreamerAPI/rtmpSchema.js +0 -14
  177. package/cjs/types/CamStreamerAPI/sdCardSchema.d.ts +0 -275
  178. package/cjs/types/CamStreamerAPI/sdCardSchema.js +0 -11
  179. package/cjs/types/CamStreamerAPI/srtSchema.d.ts +0 -275
  180. package/cjs/types/CamStreamerAPI/srtSchema.js +0 -11
  181. package/cjs/types/CamStreamerAPI/twitchSchema.d.ts +0 -275
  182. package/cjs/types/CamStreamerAPI/twitchSchema.js +0 -11
  183. package/cjs/types/CamStreamerAPI/vimeoSchema.d.ts +0 -275
  184. package/cjs/types/CamStreamerAPI/vimeoSchema.js +0 -11
  185. package/cjs/types/CamStreamerAPI/wowzaSchema.d.ts +0 -275
  186. package/cjs/types/CamStreamerAPI/wowzaSchema.js +0 -11
  187. package/esm/types/CamStreamerAPI/churchSchema.js +0 -5
  188. package/esm/types/CamStreamerAPI/daCastSchema.js +0 -5
  189. package/esm/types/CamStreamerAPI/dailymotionSchema.js +0 -5
  190. package/esm/types/CamStreamerAPI/gameChangerSchema.js +0 -5
  191. package/esm/types/CamStreamerAPI/hlsPullSchema.js +0 -5
  192. package/esm/types/CamStreamerAPI/hlsPushSchema.js +0 -5
  193. package/esm/types/CamStreamerAPI/ibmSchema.js +0 -5
  194. package/esm/types/CamStreamerAPI/microsoftAzureSchema.js +0 -5
  195. package/esm/types/CamStreamerAPI/microsoftStreamSchema.js +0 -5
  196. package/esm/types/CamStreamerAPI/mpegDvbSchema.js +0 -21
  197. package/esm/types/CamStreamerAPI/rtmpSchema.js +0 -8
  198. package/esm/types/CamStreamerAPI/sdCardSchema.js +0 -5
  199. package/esm/types/CamStreamerAPI/srtSchema.js +0 -5
  200. package/esm/types/CamStreamerAPI/twitchSchema.js +0 -5
  201. package/esm/types/CamStreamerAPI/vimeoSchema.js +0 -5
  202. package/esm/types/CamStreamerAPI/wowzaSchema.js +0 -5
  203. package/types/types/CamStreamerAPI/churchSchema.d.ts +0 -275
  204. package/types/types/CamStreamerAPI/daCastSchema.d.ts +0 -275
  205. package/types/types/CamStreamerAPI/dailymotionSchema.d.ts +0 -275
  206. package/types/types/CamStreamerAPI/gameChangerSchema.d.ts +0 -275
  207. package/types/types/CamStreamerAPI/hlsPullSchema.d.ts +0 -275
  208. package/types/types/CamStreamerAPI/hlsPushSchema.d.ts +0 -275
  209. package/types/types/CamStreamerAPI/ibmSchema.d.ts +0 -275
  210. package/types/types/CamStreamerAPI/microsoftAzureSchema.d.ts +0 -275
  211. package/types/types/CamStreamerAPI/microsoftStreamSchema.d.ts +0 -275
  212. package/types/types/CamStreamerAPI/mpegDvbSchema.d.ts +0 -323
  213. package/types/types/CamStreamerAPI/rtmpSchema.d.ts +0 -284
  214. package/types/types/CamStreamerAPI/sdCardSchema.d.ts +0 -275
  215. package/types/types/CamStreamerAPI/srtSchema.d.ts +0 -275
  216. package/types/types/CamStreamerAPI/twitchSchema.d.ts +0 -275
  217. package/types/types/CamStreamerAPI/vimeoSchema.d.ts +0 -275
  218. package/types/types/CamStreamerAPI/wowzaSchema.d.ts +0 -275
@@ -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 fileStorageTypeSchema = z.union([
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 storageDataListSchema = z.array(z.object({
60
- type: fileStorageTypeSchema,
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 storageResponseSchema = z.object({
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: storageDataListSchema,
76
+ list: imageFilestorageDataListSchema,
66
77
  });
67
- export const fileSchema = z.object({
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: fileStorageTypeSchema,
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 fileListSchema = z.array(fileSchema);
73
- export const fileDataSchema = z.object({
107
+ export const fontFileDataSchema = z.object({
74
108
  code: z.number(),
75
- list: fileListSchema,
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
+ });
@@ -9,3 +9,4 @@ export * from './ptzCompassSchema';
9
9
  export * from './ptzSchema';
10
10
  export * from './screenSharingSchema';
11
11
  export * from './webCameraSharingSchema';
12
+ export * from './htmlOverlaySchema';
@@ -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.union([
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(''),
@@ -27,7 +27,3 @@ export const camscripterApiResponseSchema = z.object({
27
27
  status: z.number(),
28
28
  message: z.string(),
29
29
  });
30
- export const cameraTimeResponseSchema = z.object({
31
- state: z.boolean(),
32
- code: z.number(),
33
- });
@@ -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 './vimeoSchema';
9
- import { twitchSchema } from './twitchSchema';
10
- import { churchSchema } from './churchSchema';
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.type === 'facebook';
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.type === 'mpeg_dvb';
37
+ return stream.platform === streamPlatforms.mpeg_dvb;
48
38
  };
49
39
  export const isRtmpStream = (stream) => {
50
- return stream.type === 'rtmp';
40
+ return stream.platform === streamPlatforms.rtmp;
51
41
  };
52
42
  export const isSdCardStream = (stream) => {
53
- return stream.type === 'sd_card';
43
+ return stream.platform === streamPlatforms.sd_card;
54
44
  };
55
45
  export const isWindyStream = (stream) => {
56
- return stream.type === 'windy';
46
+ return stream.platform === streamPlatforms.windy;
57
47
  };
58
48
  export const isYouTubeStream = (stream) => {
59
- return stream.type === 'youtube';
49
+ return stream.platform === streamPlatforms.youtube;
60
50
  };
61
51
  export const isVimeoStream = (stream) => {
62
- return stream.type === 'vimeo';
52
+ return stream.platform === streamPlatforms.vimeo;
63
53
  };
64
54
  export const isTwitchStream = (stream) => {
65
- return stream.type === 'twitch';
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.type === 'srt';
58
+ return stream.platform === streamPlatforms.srt;
72
59
  };
73
60
  export const isDaCastStream = (stream) => {
74
- return stream.type === 'da_cast';
61
+ return stream.platform === streamPlatforms.da_cast;
75
62
  };
76
63
  export const isHlsPullStream = (stream) => {
77
- return stream.type === 'hls_pull';
64
+ return stream.platform === streamPlatforms.hls_pull;
78
65
  };
79
66
  export const isHlsPushStream = (stream) => {
80
- return stream.type === 'hls_push';
67
+ return stream.platform === streamPlatforms.hls_push;
81
68
  };
82
69
  export const isWowzaStream = (stream) => {
83
- return stream.type === 'wowza';
70
+ return stream.platform === streamPlatforms.wowza;
84
71
  };
85
72
  export const isDailymotionStream = (stream) => {
86
- return stream.type === 'dailymotion';
73
+ return stream.platform === streamPlatforms.dailymotion;
87
74
  };
88
75
  export const isIbmStream = (stream) => {
89
- return stream.type === 'ibm';
76
+ return stream.platform === streamPlatforms.ibm;
90
77
  };
91
78
  export const isMicrosoftAzureStream = (stream) => {
92
- return stream.type === 'microsoft_azure';
79
+ return stream.platform === streamPlatforms.microsoft_azure;
93
80
  };
94
81
  export const isMicrosoftStream = (stream) => {
95
- return stream.type === 'microsoft_stream';
82
+ return stream.platform === streamPlatforms.microsoft_stream;
96
83
  };
97
84
  export const isGameChangerStream = (stream) => {
98
- return stream.type === 'game_changer';
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: z.instanceof(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
- type: z.literal('facebook'),
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
- id: z.string(),
26
+ streamId: z.string(),
27
27
  });
28
28
  export const oldStreamSchema = z.object({
29
29
  enabled: z.union([z.literal(0), z.literal(1)]),