camstreamerlib 4.0.0-beta.33 → 4.0.0-beta.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/cjs/CamOverlayAPI.js +3 -3
  2. package/cjs/CamStreamerAPI.js +54 -11
  3. package/cjs/CamSwitcherAPI.js +7 -7
  4. package/cjs/CamSwitcherEvents.js +4 -60
  5. package/cjs/PlaneTrackerAPI.js +52 -52
  6. package/cjs/VapixAPI.js +10 -7
  7. package/cjs/index.js +2 -11
  8. package/cjs/internal/ProxyClient.js +6 -6
  9. package/cjs/internal/WsEvents.js +72 -0
  10. package/cjs/node/DefaultClient.js +4 -4
  11. package/cjs/node/HttpRequestSender.js +1 -1
  12. package/cjs/node/WsClient.js +1 -1
  13. package/cjs/{events → node/events}/AxisCameraStationEvents.js +4 -4
  14. package/cjs/{events → node/events}/GenetecAgent.js +1 -1
  15. package/cjs/node/index.js +2 -2
  16. package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +14 -2
  17. package/cjs/types/CamOverlayAPI/scoreBoardSchema.js +127 -0
  18. package/cjs/types/CamStreamerAPI.js +30 -3
  19. package/esm/CamOverlayAPI.js +3 -3
  20. package/esm/CamStreamerAPI.js +53 -11
  21. package/esm/CamSwitcherAPI.js +7 -7
  22. package/esm/CamSwitcherEvents.js +5 -61
  23. package/esm/PlaneTrackerAPI.js +52 -52
  24. package/esm/VapixAPI.js +10 -7
  25. package/esm/index.js +1 -6
  26. package/esm/internal/ProxyClient.js +6 -6
  27. package/esm/internal/WsEvents.js +68 -0
  28. package/esm/node/DefaultClient.js +4 -4
  29. package/esm/node/HttpRequestSender.js +1 -1
  30. package/esm/node/WsClient.js +1 -1
  31. package/esm/{events → node/events}/AxisCameraStationEvents.js +3 -3
  32. package/esm/{events → node/events}/GenetecAgent.js +1 -1
  33. package/esm/node/index.js +2 -2
  34. package/esm/types/CamOverlayAPI/CamOverlayAPI.js +9 -1
  35. package/esm/types/CamOverlayAPI/scoreBoardSchema.js +124 -0
  36. package/esm/types/CamStreamerAPI.js +29 -2
  37. package/package.json +22 -2
  38. package/{cjs → types}/CamOverlayAPI.d.ts +3 -5
  39. package/{esm → types}/CamScripterAPI.d.ts +4 -4
  40. package/types/CamStreamerAPI.d.ts +48 -0
  41. package/{esm → types}/CamSwitcherAPI.d.ts +8 -8
  42. package/types/CamSwitcherEvents.d.ts +8 -0
  43. package/types/PlaneTrackerAPI.d.ts +43 -0
  44. package/{cjs → types}/VapixAPI.d.ts +11 -7
  45. package/{cjs → types}/index.d.ts +1 -6
  46. package/{esm → types}/internal/ProxyClient.d.ts +4 -4
  47. package/types/internal/WsEvents.d.ts +41 -0
  48. package/{esm → types}/internal/types.d.ts +12 -9
  49. package/{cjs → types}/node/DefaultClient.d.ts +6 -4
  50. package/{esm → types/node}/events/AxisCameraStationEvents.d.ts +4 -4
  51. package/{esm → types}/node/index.d.ts +2 -2
  52. package/{cjs → types}/types/CamOverlayAPI/CamOverlayAPI.d.ts +1071 -10
  53. package/{esm → types}/types/CamOverlayAPI/infotickerSchema.d.ts +2 -2
  54. package/types/types/CamOverlayAPI/scoreBoardSchema.d.ts +357 -0
  55. package/types/types/CamStreamerAPI.d.ts +274 -0
  56. package/types/web/DefaultClient.d.ts +6 -0
  57. package/cjs/CamScripterAPI.d.ts +0 -37
  58. package/cjs/CamStreamerAPI.d.ts +0 -19
  59. package/cjs/CamSwitcherAPI.d.ts +0 -54
  60. package/cjs/CamSwitcherEvents.d.ts +0 -18
  61. package/cjs/PlaneTrackerAPI.d.ts +0 -43
  62. package/cjs/events/AxisCameraStationEvents.d.ts +0 -12
  63. package/cjs/internal/ProxyClient.d.ts +0 -10
  64. package/cjs/internal/types.d.ts +0 -42
  65. package/cjs/node/index.d.ts +0 -5
  66. package/cjs/types/CamOverlayAPI/infotickerSchema.d.ts +0 -96
  67. package/cjs/types/CamStreamerAPI.d.ts +0 -150
  68. package/cjs/web/DefaultClient.d.ts +0 -6
  69. package/esm/CamOverlayAPI.d.ts +0 -41
  70. package/esm/CamOverlayDrawingAPI.d.ts +0 -41
  71. package/esm/CamOverlayPainter/Frame.d.ts +0 -67
  72. package/esm/CamOverlayPainter/Painter.d.ts +0 -43
  73. package/esm/CamOverlayPainter/ResourceManager.d.ts +0 -15
  74. package/esm/CamScripterAPICameraEventsGenerator.d.ts +0 -74
  75. package/esm/CamStreamerAPI.d.ts +0 -19
  76. package/esm/CamSwitcherEvents.d.ts +0 -18
  77. package/esm/CreatePackage.d.ts +0 -1
  78. package/esm/PlaneTrackerAPI.d.ts +0 -43
  79. package/esm/VapixAPI.d.ts +0 -80
  80. package/esm/VapixEvents.d.ts +0 -43
  81. package/esm/errors/errors.d.ts +0 -37
  82. package/esm/events/GenetecAgent.d.ts +0 -159
  83. package/esm/index.d.ts +0 -23
  84. package/esm/internal/Digest.d.ts +0 -4
  85. package/esm/internal/constants.d.ts +0 -1
  86. package/esm/internal/transformers.d.ts +0 -5
  87. package/esm/internal/utils.d.ts +0 -14
  88. package/esm/internal/versionCompare.d.ts +0 -6
  89. package/esm/node/DefaultClient.d.ts +0 -14
  90. package/esm/node/HttpRequestSender.d.ts +0 -29
  91. package/esm/node/HttpServer.d.ts +0 -21
  92. package/esm/node/WsClient.d.ts +0 -40
  93. package/esm/types/CamOverlayAPI/CamOverlayAPI.d.ts +0 -3260
  94. package/esm/types/CamOverlayAPI/accuweatherSchema.d.ts +0 -84
  95. package/esm/types/CamOverlayAPI/customGraphicsSchema.d.ts +0 -700
  96. package/esm/types/CamOverlayAPI/imagesSchema.d.ts +0 -95
  97. package/esm/types/CamOverlayAPI/index.d.ts +0 -11
  98. package/esm/types/CamOverlayAPI/pipSchema.d.ts +0 -125
  99. package/esm/types/CamOverlayAPI/ptzCompassSchema.d.ts +0 -93
  100. package/esm/types/CamOverlayAPI/ptzSchema.d.ts +0 -118
  101. package/esm/types/CamOverlayAPI/screenSharingSchema.d.ts +0 -58
  102. package/esm/types/CamOverlayAPI/webCameraSharingSchema.d.ts +0 -58
  103. package/esm/types/CamOverlayAPI/widgetCommonTypes.d.ts +0 -141
  104. package/esm/types/CamOverlayDrawingAPI.d.ts +0 -58
  105. package/esm/types/CamOverlayPainter.d.ts +0 -74
  106. package/esm/types/CamScripterAPI.d.ts +0 -132
  107. package/esm/types/CamStreamerAPI.d.ts +0 -150
  108. package/esm/types/CamSwitcherAPI.d.ts +0 -812
  109. package/esm/types/CamSwitcherEvents.d.ts +0 -568
  110. package/esm/types/PlaneTrackerAPI.d.ts +0 -8
  111. package/esm/types/VapixAPI.d.ts +0 -1819
  112. package/esm/types/common.d.ts +0 -46
  113. package/esm/web/DefaultClient.d.ts +0 -6
  114. package/esm/web/WsClient.d.ts +0 -13
  115. package/esm/web/index.d.ts +0 -2
  116. /package/cjs/{internal → node}/Digest.js +0 -0
  117. /package/esm/{internal → node}/Digest.js +0 -0
  118. /package/{cjs → types}/CamOverlayDrawingAPI.d.ts +0 -0
  119. /package/{cjs → types}/CamOverlayPainter/Frame.d.ts +0 -0
  120. /package/{cjs → types}/CamOverlayPainter/Painter.d.ts +0 -0
  121. /package/{cjs → types}/CamOverlayPainter/ResourceManager.d.ts +0 -0
  122. /package/{cjs → types}/CamScripterAPICameraEventsGenerator.d.ts +0 -0
  123. /package/{cjs → types}/CreatePackage.d.ts +0 -0
  124. /package/{cjs → types}/VapixEvents.d.ts +0 -0
  125. /package/{cjs → types}/errors/errors.d.ts +0 -0
  126. /package/{cjs → types}/internal/constants.d.ts +0 -0
  127. /package/{cjs → types}/internal/transformers.d.ts +0 -0
  128. /package/{cjs → types}/internal/utils.d.ts +0 -0
  129. /package/{cjs → types}/internal/versionCompare.d.ts +0 -0
  130. /package/{cjs/internal → types/node}/Digest.d.ts +0 -0
  131. /package/{cjs → types}/node/HttpRequestSender.d.ts +0 -0
  132. /package/{cjs → types}/node/HttpServer.d.ts +0 -0
  133. /package/{cjs → types}/node/WsClient.d.ts +0 -0
  134. /package/{cjs → types/node}/events/GenetecAgent.d.ts +0 -0
  135. /package/{cjs → types}/types/CamOverlayAPI/accuweatherSchema.d.ts +0 -0
  136. /package/{cjs → types}/types/CamOverlayAPI/customGraphicsSchema.d.ts +0 -0
  137. /package/{cjs → types}/types/CamOverlayAPI/imagesSchema.d.ts +0 -0
  138. /package/{cjs → types}/types/CamOverlayAPI/index.d.ts +0 -0
  139. /package/{cjs → types}/types/CamOverlayAPI/pipSchema.d.ts +0 -0
  140. /package/{cjs → types}/types/CamOverlayAPI/ptzCompassSchema.d.ts +0 -0
  141. /package/{cjs → types}/types/CamOverlayAPI/ptzSchema.d.ts +0 -0
  142. /package/{cjs → types}/types/CamOverlayAPI/screenSharingSchema.d.ts +0 -0
  143. /package/{cjs → types}/types/CamOverlayAPI/webCameraSharingSchema.d.ts +0 -0
  144. /package/{cjs → types}/types/CamOverlayAPI/widgetCommonTypes.d.ts +0 -0
  145. /package/{cjs → types}/types/CamOverlayDrawingAPI.d.ts +0 -0
  146. /package/{cjs → types}/types/CamOverlayPainter.d.ts +0 -0
  147. /package/{cjs → types}/types/CamScripterAPI.d.ts +0 -0
  148. /package/{cjs → types}/types/CamSwitcherAPI.d.ts +0 -0
  149. /package/{cjs → types}/types/CamSwitcherEvents.d.ts +0 -0
  150. /package/{cjs → types}/types/PlaneTrackerAPI.d.ts +0 -0
  151. /package/{cjs → types}/types/VapixAPI.d.ts +0 -0
  152. /package/{cjs → types}/types/common.d.ts +0 -0
  153. /package/{cjs → types}/web/WsClient.d.ts +0 -0
  154. /package/{cjs → types}/web/index.d.ts +0 -0
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AxisCameraStationEvents = void 0;
4
- const utils_1 = require("../internal/utils");
5
- const ProxyClient_1 = require("../internal/ProxyClient");
6
- const node_1 = require("../node");
4
+ const utils_1 = require("../../internal/utils");
5
+ const ProxyClient_1 = require("../../internal/ProxyClient");
6
+ const DefaultClient_1 = require("../DefaultClient");
7
7
  class AxisCameraStationEvents {
8
8
  sourceKey;
9
9
  client;
10
10
  constructor(clientOptions, sourceKey) {
11
11
  this.sourceKey = sourceKey;
12
- this.client = new node_1.DefaultClient(clientOptions);
12
+ this.client = new DefaultClient_1.DefaultClient(clientOptions);
13
13
  }
14
14
  getClient(proxyParams) {
15
15
  return proxyParams ? new ProxyClient_1.ProxyClient(this.client, proxyParams) : this.client;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GenetecAgent = void 0;
4
4
  const zod_1 = require("zod");
5
- const utils_1 = require("../internal/utils");
5
+ const utils_1 = require("../../internal/utils");
6
6
  const successResponseSchema = zod_1.z.object({
7
7
  Rsp: zod_1.z.object({
8
8
  Status: zod_1.z.literal('Ok'),
package/cjs/node/index.js CHANGED
@@ -17,5 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./DefaultClient"), exports);
18
18
  __exportStar(require("./WsClient"), exports);
19
19
  __exportStar(require("./HttpServer"), exports);
20
- __exportStar(require("../events/AxisCameraStationEvents"), exports);
21
- __exportStar(require("../events/GenetecAgent"), exports);
20
+ __exportStar(require("./events/AxisCameraStationEvents"), exports);
21
+ __exportStar(require("./events/GenetecAgent"), exports);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fileDataSchema = exports.fileListSchema = exports.fileSchema = exports.storageResponseSchema = exports.storageDataListSchema = exports.storageSchema = exports.ImageType = exports.isWebCameraSharing = exports.isScreenSharing = exports.isPtz = exports.isPtzCompass = exports.isPip = exports.isInfoticker = exports.isImages = exports.isCustomGraphics = exports.isAccuweather = exports.widgetListSchema = exports.widgetsSchema = exports.WSResponseSchema = void 0;
3
+ exports.fileDataSchema = exports.fileListSchema = exports.fileSchema = exports.storageResponseSchema = exports.storageDataListSchema = exports.storageSchema = exports.ImageType = exports.isScoreOverview = exports.isBaseballScoreBoardAutomatic = exports.isBaseballScoreBoard = exports.isScoreBoard = exports.isWebCameraSharing = exports.isScreenSharing = exports.isPtz = exports.isPtzCompass = exports.isPip = exports.isInfoticker = exports.isImages = exports.isCustomGraphics = exports.isAccuweather = exports.widgetListSchema = exports.widgetsSchema = exports.WSResponseSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const infotickerSchema_1 = require("./infotickerSchema");
6
6
  const accuweatherSchema_1 = require("./accuweatherSchema");
@@ -11,10 +11,10 @@ const pipSchema_1 = require("./pipSchema");
11
11
  const customGraphicsSchema_1 = require("./customGraphicsSchema");
12
12
  const screenSharingSchema_1 = require("./screenSharingSchema");
13
13
  const webCameraSharingSchema_1 = require("./webCameraSharingSchema");
14
+ const scoreBoardSchema_1 = require("./scoreBoardSchema");
14
15
  exports.WSResponseSchema = zod_1.z.object({
15
16
  status: zod_1.z.number(),
16
17
  message: zod_1.z.string(),
17
- data: zod_1.z.string(),
18
18
  });
19
19
  exports.widgetsSchema = zod_1.z.discriminatedUnion('name', [
20
20
  infotickerSchema_1.infoTickerSchema,
@@ -26,6 +26,10 @@ exports.widgetsSchema = zod_1.z.discriminatedUnion('name', [
26
26
  customGraphicsSchema_1.customGraphicsSchema,
27
27
  screenSharingSchema_1.screenSharingSchema,
28
28
  webCameraSharingSchema_1.webCameraSharingSchema,
29
+ scoreBoardSchema_1.scoreBoardSchema,
30
+ scoreBoardSchema_1.baseballScoreBoardSchema,
31
+ scoreBoardSchema_1.baseballScoreBoardAutomaticSchema,
32
+ scoreBoardSchema_1.scoreOverviewSchema,
29
33
  ]);
30
34
  exports.widgetListSchema = zod_1.z.object({
31
35
  services: zod_1.z.array(exports.widgetsSchema),
@@ -48,6 +52,14 @@ const isScreenSharing = (widget) => widget.name === 'screenSharing';
48
52
  exports.isScreenSharing = isScreenSharing;
49
53
  const isWebCameraSharing = (widget) => widget.name === 'web_camera';
50
54
  exports.isWebCameraSharing = isWebCameraSharing;
55
+ const isScoreBoard = (widget) => widget.name === 'scoreBoard';
56
+ exports.isScoreBoard = isScoreBoard;
57
+ const isBaseballScoreBoard = (widget) => widget.name === 'baseballScoreBoard';
58
+ exports.isBaseballScoreBoard = isBaseballScoreBoard;
59
+ const isBaseballScoreBoardAutomatic = (widget) => widget.name === 'myBallBaseballWidgets';
60
+ exports.isBaseballScoreBoardAutomatic = isBaseballScoreBoardAutomatic;
61
+ const isScoreOverview = (widget) => widget.name === 'scoreOverview';
62
+ exports.isScoreOverview = isScoreOverview;
51
63
  var ImageType;
52
64
  (function (ImageType) {
53
65
  ImageType[ImageType["PNG"] = 0] = "PNG";
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.scoreOverviewSchema = exports.baseballScoreBoardAutomaticSchema = exports.baseballScoreBoardSchema = exports.scoreBoardSchema = exports.sportFontSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const widgetCommonTypes_1 = require("./widgetCommonTypes");
6
+ exports.sportFontSchema = zod_1.z.union([zod_1.z.literal('classic'), zod_1.z.intersection(zod_1.z.string(), zod_1.z.object({}))]);
7
+ exports.scoreBoardSchema = zod_1.z.object({
8
+ id: zod_1.z.number().nonnegative(),
9
+ enabled: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
10
+ schedule: zod_1.z.string().optional(),
11
+ cameraList: zod_1.z.array(zod_1.z.number()),
12
+ zIndex: zod_1.z.number().nonnegative(),
13
+ name: zod_1.z.literal('scoreBoard'),
14
+ pos_x: zod_1.z.number(),
15
+ pos_y: zod_1.z.number(),
16
+ coordSystem: widgetCommonTypes_1.coordinateSystemSchema,
17
+ width: zod_1.z.number(),
18
+ height: zod_1.z.number(),
19
+ scale: zod_1.z.number(),
20
+ teamHomeShortname: zod_1.z.string(),
21
+ teamGuestShortname: zod_1.z.string(),
22
+ teamHomeBackgroundColor: zod_1.z.string(),
23
+ teamGuestBackgroundColor: zod_1.z.string(),
24
+ teamHomeTextColor: zod_1.z.string(),
25
+ teamGuestTextColor: zod_1.z.string(),
26
+ teamHomeImgPath: zod_1.z.string(),
27
+ teamGuestImgPath: zod_1.z.string(),
28
+ teamHomeCurrentScore: zod_1.z.number(),
29
+ teamGuestCurrentScore: zod_1.z.number(),
30
+ baseTimeTimestamp: zod_1.z.number(),
31
+ baseTimePlaytime: zod_1.z.number(),
32
+ currentPeriodPlaytime: zod_1.z.number(),
33
+ timeIsRunning: zod_1.z.boolean(),
34
+ currentPeriodLength: zod_1.z.number(),
35
+ currentPeriod: zod_1.z.number(),
36
+ font: exports.sportFontSchema.default('classic'),
37
+ });
38
+ exports.baseballScoreBoardSchema = zod_1.z.object({
39
+ id: zod_1.z.number().nonnegative(),
40
+ enabled: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
41
+ schedule: zod_1.z.string().optional(),
42
+ cameraList: zod_1.z.array(zod_1.z.number()),
43
+ zIndex: zod_1.z.number().nonnegative(),
44
+ name: zod_1.z.literal('baseballScoreBoard'),
45
+ pos_x: zod_1.z.number(),
46
+ pos_y: zod_1.z.number(),
47
+ coordSystem: widgetCommonTypes_1.coordinateSystemSchema,
48
+ width: zod_1.z.number(),
49
+ height: zod_1.z.number(),
50
+ scale: zod_1.z.number(),
51
+ matchFinished: zod_1.z.boolean(),
52
+ bases: zod_1.z.tuple([zod_1.z.boolean(), zod_1.z.boolean(), zod_1.z.boolean()]),
53
+ homeInning: zod_1.z.boolean(),
54
+ inning: zod_1.z.number().nonnegative(),
55
+ outs: zod_1.z.number().nonnegative(),
56
+ balls: zod_1.z.number().nonnegative(),
57
+ strikes: zod_1.z.number().nonnegative(),
58
+ baseTimeTimestamp: zod_1.z.number(),
59
+ baseTimePlaytime: zod_1.z.number(),
60
+ timeIsRunning: zod_1.z.boolean(),
61
+ teamHomeShortname: zod_1.z.string(),
62
+ teamGuestShortname: zod_1.z.string(),
63
+ teamHomeBackgroundColor: zod_1.z.string(),
64
+ teamGuestBackgroundColor: zod_1.z.string(),
65
+ teamHomeTextColor: zod_1.z.string(),
66
+ teamGuestTextColor: zod_1.z.string(),
67
+ teamHomeCurrentScore: zod_1.z.number(),
68
+ teamGuestCurrentScore: zod_1.z.number(),
69
+ footerImgPath: zod_1.z.string().optional(),
70
+ footerText: zod_1.z.string().optional(),
71
+ footerBackgroundColor: zod_1.z.string().optional(),
72
+ footerTextColor: zod_1.z.string().optional(),
73
+ font: exports.sportFontSchema.default('classic'),
74
+ });
75
+ exports.baseballScoreBoardAutomaticSchema = zod_1.z.object({
76
+ id: zod_1.z.number().nonnegative(),
77
+ enabled: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
78
+ schedule: zod_1.z.string().optional(),
79
+ cameraList: zod_1.z.array(zod_1.z.number()),
80
+ zIndex: zod_1.z.number().nonnegative(),
81
+ name: zod_1.z.literal('myBallBaseballWidgets'),
82
+ width: zod_1.z.number(),
83
+ height: zod_1.z.number(),
84
+ scale: zod_1.z.number(),
85
+ matchDetailLink: zod_1.z.string(),
86
+ matchListLink: zod_1.z.string(),
87
+ mirrored: zod_1.z.boolean(),
88
+ pregameWidgetText: zod_1.z.string(),
89
+ teamHomeBackgroundColor: zod_1.z.string(),
90
+ teamGuestBackgroundColor: zod_1.z.string(),
91
+ teamHomeTextColor: zod_1.z.string(),
92
+ teamGuestTextColor: zod_1.z.string(),
93
+ homeLogoPath: zod_1.z.string(),
94
+ guestLogoPath: zod_1.z.string(),
95
+ footerImgPath: zod_1.z.string().optional(),
96
+ footerText: zod_1.z.string().optional(),
97
+ footerBackgroundColor: zod_1.z.string().optional(),
98
+ footerTextColor: zod_1.z.string().optional(),
99
+ font: exports.sportFontSchema.default('classic'),
100
+ });
101
+ exports.scoreOverviewSchema = zod_1.z.object({
102
+ id: zod_1.z.number().nonnegative(),
103
+ enabled: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
104
+ cameraList: zod_1.z.array(zod_1.z.number()),
105
+ zIndex: zod_1.z.number().nonnegative(),
106
+ name: zod_1.z.literal('scoreOverview'),
107
+ pos_x: zod_1.z.number(),
108
+ pos_y: zod_1.z.number(),
109
+ coordSystem: widgetCommonTypes_1.coordinateSystemSchema,
110
+ width: zod_1.z.number(),
111
+ height: zod_1.z.number(),
112
+ scale: zod_1.z.number(),
113
+ teamHomeName: zod_1.z.string(),
114
+ teamGuestName: zod_1.z.string(),
115
+ teamHomeBackgroundColor: zod_1.z.string(),
116
+ teamGuestBackgroundColor: zod_1.z.string(),
117
+ teamHomeTextColor: zod_1.z.string(),
118
+ teamGuestTextColor: zod_1.z.string(),
119
+ teamHomeImgPath: zod_1.z.string(),
120
+ teamGuestImgPath: zod_1.z.string(),
121
+ teamHomeCurrentScore: zod_1.z.number(),
122
+ teamGuestCurrentScore: zod_1.z.number(),
123
+ scoreVisible: zod_1.z.boolean(),
124
+ description: zod_1.z.string(),
125
+ textFont: exports.sportFontSchema.default('classic'),
126
+ scoreFont: zod_1.z.literal('classic'),
127
+ });
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.camstreamerServerResponseSchema = exports.streamListSchema = exports.streamAttributesSchema = void 0;
3
+ exports.camstreamerServerResponseSchema = exports.cameraStreamResponseSchema = exports.streamSchema = exports.cameraStreamSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- exports.streamAttributesSchema = zod_1.z.object({
5
+ exports.cameraStreamSchema = zod_1.z.object({
6
6
  enabled: zod_1.z.string(),
7
7
  active: zod_1.z.string(),
8
8
  audioSource: zod_1.z.string(),
@@ -25,7 +25,34 @@ exports.streamAttributesSchema = zod_1.z.object({
25
25
  startTime: zod_1.z.string(),
26
26
  stopTime: zod_1.z.string(),
27
27
  });
28
- exports.streamListSchema = zod_1.z.record(zod_1.z.string(), exports.streamAttributesSchema);
28
+ exports.streamSchema = zod_1.z.object({
29
+ enabled: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
30
+ active: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
31
+ audioSource: zod_1.z.string(),
32
+ avSyncMsec: zod_1.z.number().int(),
33
+ internalVapixParameters: zod_1.z.string(),
34
+ userVapixParameters: zod_1.z.string(),
35
+ outputParameters: zod_1.z.string(),
36
+ outputType: zod_1.z.union([zod_1.z.literal('video'), zod_1.z.literal('images'), zod_1.z.literal('none')]),
37
+ mediaServerUrl: zod_1.z.string(),
38
+ inputType: zod_1.z.union([zod_1.z.literal('CSw'), zod_1.z.literal('CRS'), zod_1.z.literal('RTSP_URL')]),
39
+ inputUrl: zod_1.z.string(),
40
+ forceStereo: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
41
+ streamDelay: zod_1.z.number().nullable(),
42
+ statusLed: zod_1.z.number(),
43
+ statusPort: zod_1.z.string(),
44
+ callApi: zod_1.z.number().int(),
45
+ trigger: zod_1.z.string(),
46
+ schedule: zod_1.z.string(),
47
+ prepareAhead: zod_1.z.number().int(),
48
+ startTime: zod_1.z.number().nullable(),
49
+ stopTime: zod_1.z.number().nullable(),
50
+ });
51
+ exports.cameraStreamResponseSchema = zod_1.z.object({
52
+ data: exports.cameraStreamSchema,
53
+ code: zod_1.z.number(),
54
+ message: zod_1.z.string(),
55
+ });
29
56
  exports.camstreamerServerResponseSchema = zod_1.z.object({
30
57
  code: zod_1.z.number(),
31
58
  message: zod_1.z.string(),
@@ -26,7 +26,7 @@ export class CamOverlayAPI {
26
26
  }
27
27
  async wsAuthorization(options) {
28
28
  const response = await this._get({ path: `${BASE_PATH}/ws_authorization.cgi` }, options);
29
- return WSResponseSchema.parse(response).data;
29
+ return WSResponseSchema.parse(response).message;
30
30
  }
31
31
  async getMjpegStreamImage(mjpegUrl, options) {
32
32
  return await this._getBlob({
@@ -198,7 +198,7 @@ export class CamOverlayAPI {
198
198
  const agent = this.getClient(options?.proxyParams);
199
199
  const res = await agent.get({ ...params, timeout: options?.timeout });
200
200
  if (res.ok) {
201
- return (await res.json());
201
+ return await res.json();
202
202
  }
203
203
  else {
204
204
  throw new Error(await responseStringify(res));
@@ -208,7 +208,7 @@ export class CamOverlayAPI {
208
208
  const agent = this.getClient(options?.proxyParams);
209
209
  const res = await agent.post({ ...params, timeout: options?.timeout });
210
210
  if (res.ok) {
211
- return (await res.json());
211
+ return await res.json();
212
212
  }
213
213
  else {
214
214
  throw new Error(await responseStringify(res));
@@ -1,6 +1,7 @@
1
+ import z from 'zod';
1
2
  import { ProxyClient } from './internal/ProxyClient';
2
3
  import { responseStringify } from './internal/utils';
3
- import { streamAttributesSchema, streamListSchema } from './types/CamStreamerAPI';
4
+ import { cameraStreamSchema } from './types/CamStreamerAPI';
4
5
  const BASE_PATH = '/local/camstreamer';
5
6
  export class CamStreamerAPI {
6
7
  client;
@@ -12,11 +13,18 @@ export class CamStreamerAPI {
12
13
  }
13
14
  async getStreamList(options) {
14
15
  const streamListRes = await this.get(`${BASE_PATH}/stream/list.cgi`, undefined, options);
15
- return streamListSchema.parse(streamListRes.data);
16
+ const list = z.record(z.string(), cameraStreamSchema).parse(streamListRes.data);
17
+ const res = {};
18
+ for (const [key, data] of Object.entries(list)) {
19
+ const streamId = parseInt(key);
20
+ res[streamId] = parseCameraStreamResponse(data);
21
+ }
22
+ return res;
16
23
  }
17
24
  async getStream(streamId, options) {
18
25
  const stream = await this.get(`${BASE_PATH}/stream/get.cgi?stream_id=${streamId}`, undefined, options);
19
- return streamAttributesSchema.parse(stream.data);
26
+ const cameraData = cameraStreamSchema.parse(stream.data);
27
+ return parseCameraStreamResponse(cameraData);
20
28
  }
21
29
  async getStreamParameter(streamId, paramName, options) {
22
30
  const stream = await this.get(`${BASE_PATH}/stream/get.cgi?stream_id=${streamId}`, undefined, options);
@@ -24,29 +32,38 @@ export class CamStreamerAPI {
24
32
  }
25
33
  async setStream(streamId, params, options) {
26
34
  const { streamDelay, startTime, stopTime, ...rest } = params;
27
- await this.get(`${BASE_PATH}/stream/set.cgi`, {
35
+ return await this.get(`${BASE_PATH}/stream/set.cgi`, {
28
36
  stream_id: streamId,
29
37
  streamDelay: streamDelay ?? '',
30
- startTime: startTime ?? 'null',
31
- stopTime: stopTime ?? 'null',
38
+ startTime: startTime ?? null,
39
+ stopTime: stopTime ?? null,
32
40
  ...rest,
33
41
  }, options);
34
42
  }
35
43
  async setStreamParameter(streamId, paramName, value, options) {
36
- await this.get(`${BASE_PATH}/stream/set.cgi?stream_id=${streamId}&${paramName}=${value}`, undefined, options);
44
+ return await this.get(`${BASE_PATH}/stream/set.cgi?stream_id=${streamId}&${paramName}=${value}`, undefined, options);
37
45
  }
38
46
  async isStreaming(streamId, options) {
39
47
  const response = await this.get(`${BASE_PATH}/get_streamstat.cgi?stream_id=${streamId}`, undefined, options);
40
48
  return response.data.is_streaming === 1;
41
49
  }
42
50
  async deleteStream(streamId, options) {
43
- await this.get(`${BASE_PATH}/stream/remove.cgi`, { stream_id: streamId }, options);
51
+ const res = await this.get(`${BASE_PATH}/stream/remove.cgi`, { stream_id: streamId }, options);
52
+ return res.data.status === 200;
44
53
  }
45
- wsAuthorization(options) {
46
- return this.get(`${BASE_PATH}/ws_authorization.cgi`, undefined, options);
54
+ async getWsAuthorization(options) {
55
+ const res = await this.get(`${BASE_PATH}/ws_authorization.cgi`, undefined, options);
56
+ if (res.status !== 200) {
57
+ throw new Error(`Server error on ws authorization: ${res.message}`);
58
+ }
59
+ return res.data;
47
60
  }
48
61
  async getUtcTime(options) {
49
- return await this.get(`${BASE_PATH}/get_utc_time.cgi`, undefined, options);
62
+ const res = await this.get(`${BASE_PATH}/get_utc_time.cgi`, undefined, options);
63
+ if (res.status !== 200) {
64
+ throw new Error(`Server error on get UTC time: ${res.message}`);
65
+ }
66
+ return res.data;
50
67
  }
51
68
  async get(path, parameters, options) {
52
69
  const agent = this.getClient(options?.proxyParams);
@@ -59,3 +76,28 @@ export class CamStreamerAPI {
59
76
  }
60
77
  }
61
78
  }
79
+ export const parseCameraStreamResponse = (cameraStreamData) => {
80
+ return {
81
+ enabled: parseInt(cameraStreamData.enabled),
82
+ active: parseInt(cameraStreamData.active),
83
+ audioSource: cameraStreamData.audioSource,
84
+ avSyncMsec: parseInt(cameraStreamData.avSyncMsec),
85
+ internalVapixParameters: cameraStreamData.internalVapixParameters,
86
+ userVapixParameters: cameraStreamData.userVapixParameters,
87
+ outputParameters: cameraStreamData.outputParameters,
88
+ outputType: cameraStreamData.outputType,
89
+ mediaServerUrl: cameraStreamData.mediaServerUrl,
90
+ inputType: cameraStreamData.inputType,
91
+ inputUrl: cameraStreamData.inputUrl,
92
+ forceStereo: parseInt(cameraStreamData.forceStereo),
93
+ streamDelay: isNaN(parseInt(cameraStreamData.streamDelay)) ? null : parseInt(cameraStreamData.streamDelay),
94
+ statusLed: parseInt(cameraStreamData.statusLed),
95
+ statusPort: cameraStreamData.statusPort,
96
+ callApi: parseInt(cameraStreamData.callApi),
97
+ trigger: cameraStreamData.trigger,
98
+ schedule: cameraStreamData.schedule,
99
+ prepareAhead: parseInt(cameraStreamData.prepareAhead),
100
+ startTime: isNaN(parseInt(cameraStreamData.startTime)) ? null : parseInt(cameraStreamData.startTime),
101
+ stopTime: isNaN(parseInt(cameraStreamData.stopTime)) ? null : parseInt(cameraStreamData.stopTime),
102
+ };
103
+ };
@@ -108,10 +108,10 @@ export class CamSwitcherAPI {
108
108
  async playlistQueuePlayNext(options) {
109
109
  await this.get(`${BASE_PATH}/playlist_queue_play_next.cgi`, undefined, options);
110
110
  }
111
- async addNewClip(file, clipType, storage, id, fileName, options) {
111
+ async addNewClip(file, clipType, storage, clipId, fileName, options) {
112
112
  const path = `${BASE_PATH}/clip_upload.cgi?storage=${storage}`;
113
113
  const formData = new this.CustomFormData();
114
- formData.append('clip_name', id);
114
+ formData.append('clip_name', clipId);
115
115
  formData.append('clip_type', clipType);
116
116
  formData.append('file', file, fileName);
117
117
  const agent = this.getClient(options?.proxyParams);
@@ -121,8 +121,8 @@ export class CamSwitcherAPI {
121
121
  throw new AddNewClipError(output.message);
122
122
  }
123
123
  }
124
- removeClip(id, storage, options) {
125
- return this.get(`${BASE_PATH}/clip_remove.cgi`, { clip_name: id, storage }, options);
124
+ removeClip(clipId, storage, options) {
125
+ return this.get(`${BASE_PATH}/clip_remove.cgi`, { clip_name: clipId, storage }, options);
126
126
  }
127
127
  async getClipList(options) {
128
128
  const data = await this.get(`${BASE_PATH}/clip_list.cgi`, undefined, options);
@@ -177,8 +177,8 @@ export class CamSwitcherAPI {
177
177
  };
178
178
  return this.setParamFromCameraJSON(CSW_PARAM_NAMES.SECONDARY_AUDIO, data, options);
179
179
  }
180
- setDefaultPlaylist(id, options) {
181
- const value = JSON.stringify({ default_playlist_id: id });
180
+ setDefaultPlaylist(playlistId, options) {
181
+ const value = JSON.stringify({ default_playlist_id: playlistId });
182
182
  return this.vapixAgent.setParameter({
183
183
  [CSW_PARAM_NAMES.DEFAULT_PLAYLIST]: value,
184
184
  }, options);
@@ -250,7 +250,7 @@ export class CamSwitcherAPI {
250
250
  const agent = this.getClient(options?.proxyParams);
251
251
  const res = await agent.get({ path, parameters, timeout: options?.timeout });
252
252
  if (res.ok) {
253
- const d = (await res.json());
253
+ const d = await res.json();
254
254
  return d.data;
255
255
  }
256
256
  else {
@@ -1,63 +1,7 @@
1
- import { cswEventsSchema, } from './types/CamSwitcherEvents';
2
- export class CamSwitcherEvents {
3
- isDestroyed = false;
4
- ws = null;
5
- listeners = {};
6
- setWebsocket(ws) {
7
- if (this.ws) {
8
- this.ws.destroy();
9
- }
10
- this.ws = ws;
11
- this.ws.onmessage = (e) => this.onMessage(e);
12
- }
13
- resendInitData() {
14
- const request = {
15
- command: 'sendInitData',
16
- };
17
- this.ws?.send(JSON.stringify(request));
18
- }
19
- addListener(type, listener, id) {
20
- const typeList = this.listeners[type];
21
- if (typeList === undefined) {
22
- this.listeners[type] = { [id]: listener };
23
- return;
24
- }
25
- typeList[id] = listener;
26
- }
27
- removeListener(type, id) {
28
- const typeList = this.listeners[type];
29
- if (typeList) {
30
- delete typeList[id];
31
- }
32
- }
33
- onMessage(evt) {
34
- if (this.isDestroyed) {
35
- return;
36
- }
37
- try {
38
- const eventData = JSON.parse(evt.data);
39
- const data = cswEventsSchema.parse(eventData);
40
- if (data.type === 'init') {
41
- this.processMessage(data.data, true);
42
- return;
43
- }
44
- this.processMessage(data, false);
45
- }
46
- catch (error) {
47
- console.error('Error parsing event data:', evt.data, error);
48
- }
49
- }
50
- processMessage(event, isInit) {
51
- const listeners = this.listeners[event.type];
52
- const list = Object.values(listeners ?? {});
53
- list.forEach((listener) => listener(event, isInit));
54
- }
55
- destroy() {
56
- this.isDestroyed = true;
57
- if (this.ws) {
58
- this.ws.destroy();
59
- this.ws = null;
60
- }
61
- this.listeners = {};
1
+ import { WsEvents } from './internal/WsEvents';
2
+ import { cswEventsSchema } from './types/CamSwitcherEvents';
3
+ export class CamSwitcherEvents extends WsEvents {
4
+ constructor(ws) {
5
+ super(cswEventsSchema, ws);
62
6
  }
63
7
  }