camstreamerlib 4.0.0-beta.13 → 4.0.0-beta.130
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 +143 -38
- package/cjs/CamOverlayAPI.d.ts +560 -336
- package/cjs/CamOverlayAPI.js +99 -184
- package/cjs/CamScripterAPI.d.ts +41 -17
- package/cjs/CamScripterAPI.js +50 -56
- package/cjs/CamStreamerAPI.d.ts +3139 -14
- package/cjs/CamStreamerAPI.js +151 -52
- package/cjs/CamSwitcherAPI.d.ts +155 -42
- package/cjs/CamSwitcherAPI.js +134 -189
- package/cjs/PlaneTrackerAPI.d.ts +236 -0
- package/cjs/PlaneTrackerAPI.js +194 -0
- package/cjs/VapixAPI.d.ts +84 -43
- package/cjs/VapixAPI.js +312 -216
- package/cjs/{CreatePackage.js → bin/CreatePackage.js} +44 -18
- package/cjs/errors/errors.d.ts +70 -4
- package/cjs/errors/errors.js +140 -7
- package/cjs/index.d.ts +20 -8
- package/cjs/index.js +28 -12
- package/cjs/internal/BasicAPI.d.ts +15 -0
- package/cjs/internal/BasicAPI.js +93 -0
- package/cjs/internal/ProxyClient.d.ts +8 -9
- package/cjs/internal/ProxyClient.js +28 -34
- package/cjs/internal/WsEvents.d.ts +38 -0
- package/cjs/{CamSwitcherEvents.js → internal/WsEvents.js} +33 -22
- 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/types.d.ts +32 -20
- package/cjs/internal/utils.d.ts +1 -3
- package/cjs/internal/utils.js +1 -12
- package/cjs/internal/versionCompare.d.ts +2 -2
- package/cjs/node/CamOverlayDrawingAPI.d.ts +41 -0
- package/cjs/{CamOverlayDrawingAPI.js → node/CamOverlayDrawingAPI.js} +28 -20
- package/{esm → cjs/node}/CamOverlayPainter/Frame.d.ts +8 -37
- package/cjs/{CamOverlayPainter → node/CamOverlayPainter}/Frame.js +33 -0
- package/cjs/{CamOverlayPainter → node/CamOverlayPainter}/Painter.d.ts +5 -21
- package/cjs/{CamOverlayPainter → node/CamOverlayPainter}/Painter.js +5 -17
- package/cjs/node/CamOverlayPainter/ResourceManager.d.ts +15 -0
- package/cjs/node/CamOverlayPainter/ResourceManager.js +72 -0
- package/cjs/node/CamScripterAPICameraEventsGenerator.d.ts +31 -0
- package/cjs/{CamScripterAPICameraEventsGenerator.js → node/CamScripterAPICameraEventsGenerator.js} +13 -13
- package/cjs/node/DefaultClient.d.ts +6 -6
- package/cjs/node/DefaultClient.js +12 -16
- package/cjs/{internal → node}/Digest.js +24 -1
- package/cjs/node/Digest.test.js +13 -0
- package/cjs/node/HttpRequestSender.d.ts +1 -0
- package/cjs/node/HttpRequestSender.js +14 -4
- package/cjs/node/HttpServer.d.ts +1 -1
- package/cjs/node/HttpServer.js +29 -6
- package/cjs/node/TimeZoneDaemon.d.ts +6 -0
- package/cjs/node/TimeZoneDaemon.js +29 -0
- package/cjs/node/VapixEvents.d.ts +16 -0
- package/cjs/{VapixEvents.js → node/VapixEvents.js} +10 -10
- package/cjs/node/WsClient.d.ts +9 -18
- package/cjs/node/WsClient.js +27 -20
- package/cjs/node/events/AxisCameraStationEvents.d.ts +12 -0
- package/cjs/{events → node/events}/AxisCameraStationEvents.js +18 -13
- package/cjs/node/events/GenetecAgent.d.ts +16 -0
- package/cjs/node/events/GenetecAgent.js +124 -0
- package/cjs/node/index.d.ts +18 -2
- package/cjs/node/index.js +39 -5
- package/cjs/{models/CamOverlayAPI/widgetsSchema.d.ts → types/CamOverlayAPI/CamOverlayAPI.d.ts} +2534 -746
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +131 -0
- package/cjs/{models → types}/CamOverlayAPI/accuweatherSchema.d.ts +15 -15
- package/cjs/{models → types}/CamOverlayAPI/accuweatherSchema.js +7 -8
- package/cjs/{models → types}/CamOverlayAPI/customGraphicsSchema.d.ts +106 -105
- package/cjs/{models → types}/CamOverlayAPI/customGraphicsSchema.js +5 -6
- package/{esm/models → cjs/types}/CamOverlayAPI/imagesSchema.d.ts +17 -17
- package/cjs/types/CamOverlayAPI/imagesSchema.js +9 -0
- package/cjs/{models → types}/CamOverlayAPI/index.d.ts +2 -4
- package/cjs/{models → types}/CamOverlayAPI/index.js +2 -4
- package/cjs/{models → types}/CamOverlayAPI/infotickerSchema.d.ts +25 -25
- package/cjs/{models → types}/CamOverlayAPI/infotickerSchema.js +6 -7
- package/{esm/models → cjs/types}/CamOverlayAPI/pipSchema.d.ts +19 -19
- package/cjs/{models → types}/CamOverlayAPI/pipSchema.js +5 -6
- package/{esm/models → cjs/types}/CamOverlayAPI/ptzCompassSchema.d.ts +16 -13
- package/cjs/{models → types}/CamOverlayAPI/ptzCompassSchema.js +5 -5
- package/{esm/models → cjs/types}/CamOverlayAPI/ptzSchema.d.ts +26 -26
- package/cjs/types/CamOverlayAPI/ptzSchema.js +12 -0
- package/cjs/types/CamOverlayAPI/scoreBoardSchema.d.ts +357 -0
- package/cjs/types/CamOverlayAPI/scoreBoardSchema.js +132 -0
- package/cjs/{models → types}/CamOverlayAPI/screenSharingSchema.d.ts +13 -13
- package/cjs/types/CamOverlayAPI/screenSharingSchema.js +8 -0
- package/{esm/models/CamOverlayAPI/widgetCommonSchema.d.ts → cjs/types/CamOverlayAPI/serviceCommonTypes.d.ts} +75 -56
- package/cjs/{models/CamOverlayAPI/widgetCommonSchema.js → types/CamOverlayAPI/serviceCommonTypes.js} +33 -18
- package/{esm/models → cjs/types}/CamOverlayAPI/webCameraSharingSchema.d.ts +13 -13
- package/cjs/types/CamOverlayAPI/webCameraSharingSchema.js +8 -0
- package/cjs/types/CamOverlayDrawingAPI.d.ts +48 -0
- package/cjs/types/CamOverlayDrawingAPI.js +2 -0
- package/cjs/types/CamOverlayPainter.d.ts +76 -0
- package/cjs/types/CamOverlayPainter.js +14 -0
- package/cjs/types/CamScripterAPI.d.ts +86 -23
- package/cjs/types/CamScripterAPI.js +24 -8
- package/cjs/types/CamScripterAPICameraEventsGenerator.d.ts +45 -0
- package/cjs/types/CamScripterAPICameraEventsGenerator.js +2 -0
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.d.ts +22299 -0
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.js +165 -0
- package/cjs/types/CamStreamerAPI/facebookSchema.d.ts +501 -0
- package/cjs/types/CamStreamerAPI/facebookSchema.js +23 -0
- package/cjs/types/CamStreamerAPI/index.d.ts +6 -0
- package/cjs/types/CamStreamerAPI/index.js +22 -0
- package/cjs/types/{CamStreamerAPI.d.ts → CamStreamerAPI/oldStreamSchema.d.ts} +104 -35
- package/cjs/types/CamStreamerAPI/oldStreamSchema.js +53 -0
- package/cjs/types/CamStreamerAPI/streamCommonTypes.d.ts +500 -0
- package/cjs/types/CamStreamerAPI/streamCommonTypes.js +119 -0
- package/cjs/types/CamStreamerAPI/streamsSchema.d.ts +7379 -0
- package/cjs/types/CamStreamerAPI/streamsSchema.js +59 -0
- package/cjs/types/CamStreamerAPI/windySchema.d.ts +435 -0
- package/cjs/types/CamStreamerAPI/windySchema.js +11 -0
- package/cjs/types/CamStreamerAPI/youtubeSchema.d.ts +468 -0
- package/cjs/types/CamStreamerAPI/youtubeSchema.js +22 -0
- package/cjs/types/CamSwitcherAPI.d.ts +181 -121
- package/cjs/types/CamSwitcherAPI.js +31 -1
- package/cjs/{events → types}/GenetecAgent.d.ts +47 -47
- package/cjs/types/GenetecAgent.js +31 -0
- package/cjs/types/PlaneTrackerAPI.d.ts +980 -0
- package/cjs/types/PlaneTrackerAPI.js +333 -0
- package/cjs/types/VapixAPI.d.ts +255 -15
- package/cjs/types/VapixAPI.js +66 -3
- package/cjs/types/VapixEvents.d.ts +15 -0
- package/cjs/types/VapixEvents.js +2 -0
- package/cjs/types/common.d.ts +43 -3
- package/cjs/types/common.js +17 -2
- package/cjs/types/ws/CamOverlayEvents.d.ts +88 -0
- package/cjs/types/ws/CamOverlayEvents.js +19 -0
- package/cjs/types/ws/CamStreamerEvents.d.ts +282 -0
- package/cjs/types/ws/CamStreamerEvents.js +36 -0
- package/cjs/types/ws/PlaneTrackerEvents.d.ts +1703 -0
- package/cjs/types/ws/PlaneTrackerEvents.js +207 -0
- package/cjs/web/DefaultClient.d.ts +7 -5
- package/cjs/web/DefaultClient.js +25 -11
- package/cjs/web/WsClient.d.ts +9 -5
- package/cjs/web/WsClient.js +16 -18
- package/cjs/ws/CamOverlayEvents.d.ts +8 -0
- package/cjs/ws/CamOverlayEvents.js +24 -0
- package/cjs/ws/CamStreamerEvents.d.ts +8 -0
- package/cjs/ws/CamStreamerEvents.js +24 -0
- package/cjs/ws/CamSwitcherEvents.d.ts +8 -0
- package/cjs/ws/CamSwitcherEvents.js +24 -0
- package/cjs/ws/PlaneTrackerEvents.d.ts +9 -0
- package/cjs/ws/PlaneTrackerEvents.js +30 -0
- package/esm/CamOverlayAPI.js +99 -184
- package/esm/CamScripterAPI.js +51 -57
- package/esm/CamStreamerAPI.js +149 -51
- package/esm/CamSwitcherAPI.js +137 -192
- package/esm/PlaneTrackerAPI.js +190 -0
- package/esm/VapixAPI.js +314 -218
- package/esm/{CreatePackage.js → bin/CreatePackage.js} +16 -16
- package/esm/errors/errors.js +122 -6
- package/esm/index.js +20 -8
- package/esm/internal/BasicAPI.js +89 -0
- package/esm/internal/ProxyClient.js +28 -34
- package/esm/{CamSwitcherEvents.js → internal/WsEvents.js} +31 -20
- package/esm/internal/constants.js +1 -0
- package/esm/internal/convertors.js +108 -0
- package/esm/internal/utils.js +0 -9
- package/esm/{CamOverlayDrawingAPI.js → node/CamOverlayDrawingAPI.js} +26 -18
- package/esm/{CamOverlayPainter → node/CamOverlayPainter}/Frame.js +33 -0
- package/esm/{CamOverlayPainter → node/CamOverlayPainter}/Painter.js +2 -13
- package/esm/{CamOverlayPainter → node/CamOverlayPainter}/ResourceManager.js +7 -5
- package/esm/{CamScripterAPICameraEventsGenerator.js → node/CamScripterAPICameraEventsGenerator.js} +11 -11
- package/esm/node/DefaultClient.js +12 -16
- package/esm/node/Digest.test.js +11 -0
- package/esm/node/HttpRequestSender.js +14 -4
- package/esm/node/HttpServer.js +1 -1
- package/esm/node/TimeZoneDaemon.js +25 -0
- package/esm/{VapixEvents.js → node/VapixEvents.js} +10 -10
- package/esm/node/WsClient.js +22 -15
- package/esm/{events → node/events}/AxisCameraStationEvents.js +18 -13
- package/esm/node/events/GenetecAgent.js +120 -0
- package/esm/node/index.js +18 -2
- package/esm/types/CamOverlayAPI/CamOverlayAPI.js +110 -0
- package/esm/{models → types}/CamOverlayAPI/accuweatherSchema.js +3 -4
- package/esm/{models → types}/CamOverlayAPI/customGraphicsSchema.js +3 -4
- package/esm/types/CamOverlayAPI/imagesSchema.js +6 -0
- package/esm/{models → types}/CamOverlayAPI/index.js +2 -4
- package/esm/{models → types}/CamOverlayAPI/infotickerSchema.js +3 -4
- package/esm/{models → types}/CamOverlayAPI/pipSchema.js +4 -5
- package/esm/{models → types}/CamOverlayAPI/ptzCompassSchema.js +4 -4
- package/esm/types/CamOverlayAPI/ptzSchema.js +9 -0
- package/esm/types/CamOverlayAPI/scoreBoardSchema.js +129 -0
- package/esm/types/CamOverlayAPI/screenSharingSchema.js +5 -0
- package/esm/{models/CamOverlayAPI/widgetCommonSchema.js → types/CamOverlayAPI/serviceCommonTypes.js} +32 -17
- package/esm/types/CamOverlayAPI/webCameraSharingSchema.js +5 -0
- package/esm/types/CamOverlayDrawingAPI.js +1 -0
- package/esm/types/CamOverlayPainter.js +11 -0
- package/esm/types/CamScripterAPI.js +23 -7
- package/esm/types/CamScripterAPICameraEventsGenerator.js +1 -0
- package/esm/types/CamStreamerAPI/CamStreamerAPI.js +142 -0
- package/esm/types/CamStreamerAPI/facebookSchema.js +17 -0
- package/esm/types/CamStreamerAPI/index.js +6 -0
- package/esm/types/CamStreamerAPI/oldStreamSchema.js +50 -0
- package/esm/types/CamStreamerAPI/streamCommonTypes.js +116 -0
- package/esm/types/CamStreamerAPI/streamsSchema.js +53 -0
- package/esm/types/CamStreamerAPI/windySchema.js +5 -0
- package/esm/types/CamStreamerAPI/youtubeSchema.js +16 -0
- package/esm/types/CamSwitcherAPI.js +31 -1
- package/esm/types/GenetecAgent.js +28 -0
- package/esm/types/PlaneTrackerAPI.js +330 -0
- package/esm/types/VapixAPI.js +65 -2
- package/esm/types/VapixEvents.js +1 -0
- package/esm/types/common.js +16 -1
- package/esm/types/ws/CamOverlayEvents.js +16 -0
- package/esm/types/ws/CamStreamerEvents.js +33 -0
- package/esm/types/ws/PlaneTrackerEvents.js +204 -0
- package/esm/web/DefaultClient.js +25 -11
- package/esm/web/WsClient.js +16 -18
- package/esm/ws/CamOverlayEvents.js +20 -0
- package/esm/ws/CamStreamerEvents.js +20 -0
- package/esm/ws/CamSwitcherEvents.js +20 -0
- package/esm/ws/PlaneTrackerEvents.js +26 -0
- package/package.json +43 -9
- package/{esm → types}/CamOverlayAPI.d.ts +560 -336
- package/types/CamScripterAPI.d.ts +43 -0
- package/types/CamStreamerAPI.d.ts +3141 -0
- package/types/CamSwitcherAPI.d.ts +165 -0
- package/types/PlaneTrackerAPI.d.ts +236 -0
- package/types/VapixAPI.d.ts +119 -0
- package/types/bin/CreatePackage.d.ts +1 -0
- package/types/errors/errors.d.ts +103 -0
- package/types/index.d.ts +28 -0
- package/types/internal/BasicAPI.d.ts +15 -0
- package/types/internal/ProxyClient.d.ts +10 -0
- package/types/internal/WsEvents.d.ts +38 -0
- package/{esm → types}/internal/constants.d.ts +1 -0
- package/types/internal/convertors.d.ts +6 -0
- package/types/internal/types.d.ts +47 -0
- package/{esm → types}/internal/utils.d.ts +1 -3
- package/{esm → types}/internal/versionCompare.d.ts +2 -2
- package/types/node/CamOverlayDrawingAPI.d.ts +41 -0
- package/{cjs → types/node}/CamOverlayPainter/Frame.d.ts +8 -37
- package/{esm → types/node}/CamOverlayPainter/Painter.d.ts +5 -21
- package/types/node/CamOverlayPainter/ResourceManager.d.ts +15 -0
- package/types/node/CamScripterAPICameraEventsGenerator.d.ts +31 -0
- package/types/node/DefaultClient.d.ts +16 -0
- package/types/node/Digest.test.d.ts +1 -0
- package/{esm → types}/node/HttpRequestSender.d.ts +1 -0
- package/{esm → types}/node/HttpServer.d.ts +1 -1
- package/types/node/TimeZoneDaemon.d.ts +6 -0
- package/types/node/VapixEvents.d.ts +16 -0
- package/types/node/WsClient.d.ts +30 -0
- package/types/node/events/AxisCameraStationEvents.d.ts +12 -0
- package/types/node/events/GenetecAgent.d.ts +16 -0
- package/types/node/index.d.ts +18 -0
- package/{esm/models/CamOverlayAPI/widgetsSchema.d.ts → types/types/CamOverlayAPI/CamOverlayAPI.d.ts} +2534 -746
- package/{esm/models → types/types}/CamOverlayAPI/accuweatherSchema.d.ts +15 -15
- package/{esm/models → types/types}/CamOverlayAPI/customGraphicsSchema.d.ts +106 -105
- package/{cjs/models → types/types}/CamOverlayAPI/imagesSchema.d.ts +17 -17
- package/{esm/models → types/types}/CamOverlayAPI/index.d.ts +2 -4
- package/{esm/models → types/types}/CamOverlayAPI/infotickerSchema.d.ts +25 -25
- package/{cjs/models → types/types}/CamOverlayAPI/pipSchema.d.ts +19 -19
- package/{cjs/models → types/types}/CamOverlayAPI/ptzCompassSchema.d.ts +16 -13
- package/{cjs/models → types/types}/CamOverlayAPI/ptzSchema.d.ts +26 -26
- package/types/types/CamOverlayAPI/scoreBoardSchema.d.ts +357 -0
- package/{esm/models → types/types}/CamOverlayAPI/screenSharingSchema.d.ts +13 -13
- package/{cjs/models/CamOverlayAPI/widgetCommonSchema.d.ts → types/types/CamOverlayAPI/serviceCommonTypes.d.ts} +75 -56
- package/{cjs/models → types/types}/CamOverlayAPI/webCameraSharingSchema.d.ts +13 -13
- package/types/types/CamOverlayDrawingAPI.d.ts +48 -0
- package/types/types/CamOverlayPainter.d.ts +76 -0
- package/types/types/CamScripterAPI.d.ts +130 -0
- package/types/types/CamScripterAPICameraEventsGenerator.d.ts +45 -0
- package/types/types/CamStreamerAPI/CamStreamerAPI.d.ts +22299 -0
- package/types/types/CamStreamerAPI/facebookSchema.d.ts +501 -0
- package/types/types/CamStreamerAPI/index.d.ts +6 -0
- package/{esm/types/CamStreamerAPI.d.ts → types/types/CamStreamerAPI/oldStreamSchema.d.ts} +104 -35
- package/types/types/CamStreamerAPI/streamCommonTypes.d.ts +500 -0
- package/types/types/CamStreamerAPI/streamsSchema.d.ts +7379 -0
- package/types/types/CamStreamerAPI/windySchema.d.ts +435 -0
- package/types/types/CamStreamerAPI/youtubeSchema.d.ts +468 -0
- package/{esm → types}/types/CamSwitcherAPI.d.ts +181 -121
- package/{esm/events → types/types}/GenetecAgent.d.ts +47 -47
- package/types/types/PlaneTrackerAPI.d.ts +980 -0
- package/{esm → types}/types/VapixAPI.d.ts +255 -15
- package/types/types/VapixEvents.d.ts +15 -0
- package/types/types/common.d.ts +77 -0
- package/types/types/ws/CamOverlayEvents.d.ts +88 -0
- package/types/types/ws/CamStreamerEvents.d.ts +282 -0
- package/types/types/ws/PlaneTrackerEvents.d.ts +1703 -0
- package/types/web/DefaultClient.d.ts +8 -0
- package/types/web/WsClient.d.ts +17 -0
- package/types/ws/CamOverlayEvents.d.ts +8 -0
- package/types/ws/CamStreamerEvents.d.ts +8 -0
- package/types/ws/CamSwitcherEvents.d.ts +8 -0
- package/types/ws/PlaneTrackerEvents.d.ts +9 -0
- package/cjs/CamOverlayDrawingAPI.d.ts +0 -86
- package/cjs/CamOverlayPainter/ResourceManager.d.ts +0 -14
- package/cjs/CamOverlayPainter/ResourceManager.js +0 -46
- package/cjs/CamScripterAPICameraEventsGenerator.d.ts +0 -74
- package/cjs/CamSwitcherEvents.d.ts +0 -18
- package/cjs/VapixEvents.d.ts +0 -43
- package/cjs/events/AxisCameraStationEvents.d.ts +0 -10
- package/cjs/events/GenetecAgent.js +0 -123
- package/cjs/models/CamOverlayAPI/constants.d.ts +0 -11
- package/cjs/models/CamOverlayAPI/constants.js +0 -14
- package/cjs/models/CamOverlayAPI/fileSchema.d.ts +0 -28
- package/cjs/models/CamOverlayAPI/fileSchema.js +0 -17
- package/cjs/models/CamOverlayAPI/imagesSchema.js +0 -10
- package/cjs/models/CamOverlayAPI/ptzSchema.js +0 -13
- package/cjs/models/CamOverlayAPI/screenSharingSchema.js +0 -9
- package/cjs/models/CamOverlayAPI/webCameraSharingSchema.js +0 -9
- package/cjs/models/CamOverlayAPI/widgetsSchema.js +0 -27
- package/cjs/node/WsEventClient.d.ts +0 -13
- package/cjs/node/WsEventClient.js +0 -22
- package/cjs/types/CamOverlayAPI.d.ts +0 -328
- package/cjs/types/CamOverlayAPI.js +0 -26
- package/cjs/types/CamStreamerAPI.js +0 -28
- package/esm/CamOverlayDrawingAPI.d.ts +0 -86
- package/esm/CamOverlayPainter/ResourceManager.d.ts +0 -14
- package/esm/CamScripterAPI.d.ts +0 -19
- package/esm/CamScripterAPICameraEventsGenerator.d.ts +0 -74
- package/esm/CamStreamerAPI.d.ts +0 -16
- package/esm/CamSwitcherAPI.d.ts +0 -52
- package/esm/CamSwitcherEvents.d.ts +0 -18
- package/esm/VapixAPI.d.ts +0 -78
- package/esm/VapixEvents.d.ts +0 -43
- package/esm/errors/errors.d.ts +0 -37
- package/esm/events/AxisCameraStationEvents.d.ts +0 -10
- package/esm/events/GenetecAgent.js +0 -119
- package/esm/index.d.ts +0 -16
- package/esm/internal/ProxyClient.d.ts +0 -11
- package/esm/internal/types.d.ts +0 -35
- package/esm/models/CamOverlayAPI/constants.d.ts +0 -11
- package/esm/models/CamOverlayAPI/constants.js +0 -11
- package/esm/models/CamOverlayAPI/fileSchema.d.ts +0 -28
- package/esm/models/CamOverlayAPI/fileSchema.js +0 -14
- package/esm/models/CamOverlayAPI/imagesSchema.js +0 -7
- package/esm/models/CamOverlayAPI/ptzSchema.js +0 -10
- package/esm/models/CamOverlayAPI/screenSharingSchema.js +0 -6
- package/esm/models/CamOverlayAPI/webCameraSharingSchema.js +0 -6
- package/esm/models/CamOverlayAPI/widgetsSchema.js +0 -24
- package/esm/node/DefaultClient.d.ts +0 -16
- package/esm/node/WsClient.d.ts +0 -39
- package/esm/node/WsEventClient.d.ts +0 -13
- package/esm/node/WsEventClient.js +0 -18
- package/esm/types/CamOverlayAPI.d.ts +0 -328
- package/esm/types/CamOverlayAPI.js +0 -14
- package/esm/types/CamScripterAPI.d.ts +0 -67
- package/esm/types/CamStreamerAPI.js +0 -25
- package/esm/types/common.d.ts +0 -37
- package/esm/web/DefaultClient.d.ts +0 -6
- package/esm/web/WsClient.d.ts +0 -13
- package/esm/web/index.d.ts +0 -2
- package/cjs/{CreatePackage.d.ts → bin/CreatePackage.d.ts} +0 -0
- package/cjs/{internal → node}/Digest.d.ts +0 -0
- package/{esm/CreatePackage.d.ts → cjs/node/Digest.test.d.ts} +0 -0
- package/{esm/types → cjs/types/ws}/CamSwitcherEvents.d.ts +8 -8
- package/cjs/types/{CamSwitcherEvents.js → ws/CamSwitcherEvents.js} +0 -0
- package/esm/{internal → node}/Digest.js +0 -0
- package/esm/types/{CamSwitcherEvents.js → ws/CamSwitcherEvents.js} +0 -0
- package/{esm → types}/internal/transformers.d.ts +0 -0
- package/{esm/internal → types/node}/Digest.d.ts +0 -0
- package/{cjs/types → types/types/ws}/CamSwitcherEvents.d.ts +8 -8
- /package/{esm/node → types/web}/index.d.ts +0 -0
|
@@ -4,43 +4,37 @@ exports.ProxyClient = void 0;
|
|
|
4
4
|
const utils_1 = require("./utils");
|
|
5
5
|
class ProxyClient {
|
|
6
6
|
client;
|
|
7
|
-
|
|
8
|
-
constructor(client,
|
|
7
|
+
proxyParams;
|
|
8
|
+
constructor(client, proxyParams) {
|
|
9
9
|
this.client = client;
|
|
10
|
-
this.
|
|
10
|
+
this.proxyParams = proxyParams;
|
|
11
11
|
}
|
|
12
|
-
get
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const {
|
|
16
|
-
return this.client.get(
|
|
17
|
-
}
|
|
18
|
-
post
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const {
|
|
22
|
-
return this.client.post(
|
|
23
|
-
}
|
|
24
|
-
getReal
|
|
25
|
-
if (proxy !== null) {
|
|
26
|
-
return {
|
|
27
|
-
realUrl: this.getProxyUrl(),
|
|
28
|
-
realHeaders: {
|
|
29
|
-
...(headers ?? {}),
|
|
30
|
-
'x-target-camera-protocol': proxy.port === 443 ? 'https' : 'http',
|
|
31
|
-
'x-target-camera-path': url,
|
|
32
|
-
'x-target-camera-ip': proxy.ip,
|
|
33
|
-
'x-target-camera-mdns': proxy.mdnsName,
|
|
34
|
-
'x-target-camera-port': String(proxy.port),
|
|
35
|
-
'x-target-camera-pass': encodeURIComponent(proxy.pass),
|
|
36
|
-
'x-target-camera-user': encodeURIComponent(proxy.user),
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
}
|
|
12
|
+
get(params) {
|
|
13
|
+
const { path, parameters, headers, timeout } = params;
|
|
14
|
+
const targetPath = (0, utils_1.addParametersToPath)(path, parameters);
|
|
15
|
+
const { realPath, realHeaders } = this.getReal(targetPath, headers);
|
|
16
|
+
return this.client.get({ path: realPath, headers: realHeaders, timeout });
|
|
17
|
+
}
|
|
18
|
+
post(params) {
|
|
19
|
+
const { path, data, parameters, headers, timeout } = params;
|
|
20
|
+
const targetPath = (0, utils_1.addParametersToPath)(path, parameters);
|
|
21
|
+
const { realPath, realHeaders } = this.getReal(targetPath, headers);
|
|
22
|
+
return this.client.post({ path: realPath, data, headers: realHeaders, timeout });
|
|
23
|
+
}
|
|
24
|
+
getReal(targetPath, headers) {
|
|
40
25
|
return {
|
|
41
|
-
|
|
42
|
-
realHeaders:
|
|
26
|
+
realPath: this.proxyParams.path,
|
|
27
|
+
realHeaders: {
|
|
28
|
+
...(headers ?? {}),
|
|
29
|
+
'x-target-camera-protocol': this.proxyParams.target.port === 443 ? 'https' : 'http',
|
|
30
|
+
'x-target-camera-path': targetPath,
|
|
31
|
+
'x-target-camera-ip': this.proxyParams.target.ip,
|
|
32
|
+
'x-target-camera-mdns': this.proxyParams.target.mdnsName,
|
|
33
|
+
'x-target-camera-port': String(this.proxyParams.target.port),
|
|
34
|
+
'x-target-camera-pass': this.proxyParams.target.pass,
|
|
35
|
+
'x-target-camera-user': this.proxyParams.target.user,
|
|
36
|
+
},
|
|
43
37
|
};
|
|
44
|
-
}
|
|
38
|
+
}
|
|
45
39
|
}
|
|
46
40
|
exports.ProxyClient = ProxyClient;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { IWsClient } from './types';
|
|
2
|
+
type TEventType<T extends {
|
|
3
|
+
type: string;
|
|
4
|
+
}> = T extends {
|
|
5
|
+
type: infer Type;
|
|
6
|
+
} ? Type : never;
|
|
7
|
+
type TEvent<T extends {
|
|
8
|
+
type: string;
|
|
9
|
+
}, Type extends TEventType<T>> = T extends {
|
|
10
|
+
type: Type;
|
|
11
|
+
} ? T : never;
|
|
12
|
+
type TValidate<T extends {
|
|
13
|
+
type: string;
|
|
14
|
+
}> = (data: string) => {
|
|
15
|
+
type: 'init';
|
|
16
|
+
data: TEvent<T, TEventType<T>>;
|
|
17
|
+
} | TEvent<T, TEventType<T>>;
|
|
18
|
+
type TListenerFunction<T extends {
|
|
19
|
+
type: string;
|
|
20
|
+
}, Type extends TEventType<T>> = (data: TEvent<T, Type>, isInit: boolean) => void;
|
|
21
|
+
export declare class WsEvents<T extends {
|
|
22
|
+
type: string;
|
|
23
|
+
}> {
|
|
24
|
+
private validate;
|
|
25
|
+
ws: IWsClient;
|
|
26
|
+
private _isDestroyed;
|
|
27
|
+
private listeners;
|
|
28
|
+
constructor(validate: TValidate<T>, ws: IWsClient);
|
|
29
|
+
get isDestroyed(): boolean;
|
|
30
|
+
resendInitData(): void;
|
|
31
|
+
addListener<Type extends TEventType<T>>(type: Type, listener: TListenerFunction<T, Type>, id: string): void;
|
|
32
|
+
removeListener<Type extends TEventType<T>>(type: Type, id: string): void;
|
|
33
|
+
removeAllListenersForId(id: string): void;
|
|
34
|
+
private onMessage;
|
|
35
|
+
private processMessage;
|
|
36
|
+
destroy(): void;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
exports.WsEvents = void 0;
|
|
4
|
+
class WsEvents {
|
|
5
|
+
validate;
|
|
6
|
+
ws;
|
|
7
|
+
_isDestroyed = false;
|
|
8
8
|
listeners = {};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.ws.destroy();
|
|
12
|
-
}
|
|
9
|
+
constructor(validate, ws) {
|
|
10
|
+
this.validate = validate;
|
|
13
11
|
this.ws = ws;
|
|
14
|
-
this.ws.
|
|
12
|
+
this.ws.onMessage = (e) => this.onMessage(e);
|
|
13
|
+
}
|
|
14
|
+
get isDestroyed() {
|
|
15
|
+
return this._isDestroyed;
|
|
15
16
|
}
|
|
16
17
|
resendInitData() {
|
|
17
18
|
const request = {
|
|
18
19
|
command: 'sendInitData',
|
|
19
20
|
};
|
|
20
|
-
this.ws
|
|
21
|
+
this.ws.send(JSON.stringify(request));
|
|
21
22
|
}
|
|
22
23
|
addListener(type, listener, id) {
|
|
23
24
|
const typeList = this.listeners[type];
|
|
@@ -31,23 +32,31 @@ class CamSwitcherEvents {
|
|
|
31
32
|
const typeList = this.listeners[type];
|
|
32
33
|
if (typeList) {
|
|
33
34
|
delete typeList[id];
|
|
35
|
+
if (Object.keys(typeList).length === 0) {
|
|
36
|
+
delete this.listeners[type];
|
|
37
|
+
}
|
|
34
38
|
}
|
|
35
39
|
}
|
|
36
|
-
|
|
40
|
+
removeAllListenersForId(id) {
|
|
41
|
+
for (const type in this.listeners) {
|
|
42
|
+
this.removeListener(type, id);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
onMessage(incomeData) {
|
|
37
46
|
if (this.isDestroyed) {
|
|
38
47
|
return;
|
|
39
48
|
}
|
|
40
49
|
try {
|
|
41
|
-
const eventData = JSON.parse(
|
|
42
|
-
const data =
|
|
43
|
-
if (data
|
|
50
|
+
const eventData = JSON.parse(incomeData.toString());
|
|
51
|
+
const data = this.validate(eventData);
|
|
52
|
+
if (isInitEvent(data)) {
|
|
44
53
|
this.processMessage(data.data, true);
|
|
45
54
|
return;
|
|
46
55
|
}
|
|
47
56
|
this.processMessage(data, false);
|
|
48
57
|
}
|
|
49
58
|
catch (error) {
|
|
50
|
-
console.error('Error parsing event data:',
|
|
59
|
+
console.error('Error parsing event data:', incomeData.toString(), error);
|
|
51
60
|
}
|
|
52
61
|
}
|
|
53
62
|
processMessage(event, isInit) {
|
|
@@ -56,12 +65,14 @@ class CamSwitcherEvents {
|
|
|
56
65
|
list.forEach((listener) => listener(event, isInit));
|
|
57
66
|
}
|
|
58
67
|
destroy() {
|
|
59
|
-
this.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
68
|
+
this._isDestroyed = true;
|
|
69
|
+
this.ws.onMessage = () => { };
|
|
70
|
+
this.ws.onOpen = () => Promise.reject(new Error('Websocket is destroyed'));
|
|
71
|
+
this.ws.destroy();
|
|
64
72
|
this.listeners = {};
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
|
-
exports.
|
|
75
|
+
exports.WsEvents = WsEvents;
|
|
76
|
+
const isInitEvent = (event) => {
|
|
77
|
+
return event.type === 'init';
|
|
78
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FIRMWARE_WITH_BITRATE_MODES_SUPPORT = void 0;
|
|
3
|
+
exports.FIRMWARE_WITH_OVERLAYS_SUPPORT = exports.FIRMWARE_WITH_BITRATE_MODES_SUPPORT = void 0;
|
|
4
4
|
exports.FIRMWARE_WITH_BITRATE_MODES_SUPPORT = '11.11.73';
|
|
5
|
+
exports.FIRMWARE_WITH_OVERLAYS_SUPPORT = '10.7.0';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TInternalVapixParameters } from '../types/CamStreamerAPI';
|
|
2
|
+
import { TBitrateMode, TBitrateVapixParams } from '../types/common';
|
|
3
|
+
export declare const parseBitrateOptionsToVapixParams: (firmWareVersion: string, bitrateMode: TBitrateMode | undefined, cameraOptions: Partial<TBitrateVapixParams>) => string;
|
|
4
|
+
export declare const parseVapixParamsToBitrateOptions: (bitrateVapixParams: string) => TBitrateVapixParams;
|
|
5
|
+
export declare const parseVideoOptionsToVapixParams: (firmWareVersion: string, video: TInternalVapixParameters) => string;
|
|
6
|
+
export declare const parseVapixParamsToVideoOptions: (internalVapixParams: string) => TInternalVapixParameters;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseVapixParamsToVideoOptions = exports.parseVideoOptionsToVapixParams = exports.parseVapixParamsToBitrateOptions = exports.parseBitrateOptionsToVapixParams = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const versionCompare_1 = require("./versionCompare");
|
|
6
|
+
const parseBitrateOptionsToVapixParams = (firmWareVersion, bitrateMode, cameraOptions) => {
|
|
7
|
+
if (!(0, versionCompare_1.isFirmwareVersionAtLeast)(firmWareVersion, constants_1.FIRMWARE_WITH_BITRATE_MODES_SUPPORT)) {
|
|
8
|
+
return `videomaxbitrate=${cameraOptions.maximumBitRate}`;
|
|
9
|
+
}
|
|
10
|
+
if (bitrateMode === undefined) {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
const data = {
|
|
14
|
+
VBR: 'videobitratemode=vbr',
|
|
15
|
+
MBR: `videobitratemode=mbr&videomaxbitrate=${cameraOptions.maximumBitRate}&videobitratepriority=framerate`,
|
|
16
|
+
ABR: `videobitratemode=abr&videoabrtargetbitrate=${cameraOptions.maximumBitRate}&videoabrretentiontime=${cameraOptions.retentionTime}&videoabrmaxbitrate=${cameraOptions.bitRateLimit}`,
|
|
17
|
+
};
|
|
18
|
+
return data[bitrateMode];
|
|
19
|
+
};
|
|
20
|
+
exports.parseBitrateOptionsToVapixParams = parseBitrateOptionsToVapixParams;
|
|
21
|
+
const parseVapixParamsToBitrateOptions = (bitrateVapixParams) => {
|
|
22
|
+
const params = {};
|
|
23
|
+
const searchParams = new URLSearchParams(bitrateVapixParams);
|
|
24
|
+
searchParams.forEach((value, key) => {
|
|
25
|
+
params[key] = value;
|
|
26
|
+
});
|
|
27
|
+
const bitrateMode = params['videobitratemode'] !== undefined ? params['videobitratemode'].toUpperCase() : undefined;
|
|
28
|
+
const hasLowerFw = bitrateMode === undefined && params['videomaxbitrate'] !== undefined;
|
|
29
|
+
if (hasLowerFw) {
|
|
30
|
+
const maximumBitRate = parseInt(params['videomaxbitrate'] ?? '0', 10);
|
|
31
|
+
return {
|
|
32
|
+
bitrateMode: 'MBR',
|
|
33
|
+
maximumBitRate: maximumBitRate,
|
|
34
|
+
retentionTime: 1,
|
|
35
|
+
bitRateLimit: Math.floor(maximumBitRate * 1.1),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (bitrateMode === 'ABR') {
|
|
39
|
+
const maximumBitRate = parseInt(params['videoabrtargetbitrate'] ?? '0', 10);
|
|
40
|
+
const retentionTime = parseInt(params['videoabrretentiontime'] ?? '0', 10);
|
|
41
|
+
const bitRateLimit = parseInt(params['videoabrmaxbitrate'] ?? '0', 10);
|
|
42
|
+
return {
|
|
43
|
+
bitrateMode,
|
|
44
|
+
maximumBitRate,
|
|
45
|
+
retentionTime,
|
|
46
|
+
bitRateLimit,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
else if (bitrateMode === 'MBR') {
|
|
50
|
+
const maximumBitRate = params['videomaxbitrate'] !== undefined ? parseInt(params['videomaxbitrate'], 10) : null;
|
|
51
|
+
const oldMaximumBitrateParamValue = parseInt(params['videombrmaxbitrate'] ?? '0', 10);
|
|
52
|
+
return {
|
|
53
|
+
bitrateMode: bitrateMode,
|
|
54
|
+
maximumBitRate: maximumBitRate ?? oldMaximumBitrateParamValue,
|
|
55
|
+
retentionTime: 1,
|
|
56
|
+
bitRateLimit: Math.floor(maximumBitRate ?? oldMaximumBitrateParamValue * 1.1),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
bitrateMode: bitrateMode,
|
|
61
|
+
retentionTime: 1,
|
|
62
|
+
maximumBitRate: 0,
|
|
63
|
+
bitRateLimit: 0,
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
exports.parseVapixParamsToBitrateOptions = parseVapixParamsToBitrateOptions;
|
|
67
|
+
const parseVideoOptionsToVapixParams = (firmWareVersion, video) => {
|
|
68
|
+
const bitrateParams = (0, exports.parseBitrateOptionsToVapixParams)(firmWareVersion, video.bitrateMode, {
|
|
69
|
+
maximumBitRate: video.maximumBitRate,
|
|
70
|
+
retentionTime: video.retentionTime,
|
|
71
|
+
bitRateLimit: video.bitRateLimit,
|
|
72
|
+
});
|
|
73
|
+
let overlaysParams = '';
|
|
74
|
+
if ((0, versionCompare_1.isFirmwareVersionAtLeast)(firmWareVersion, constants_1.FIRMWARE_WITH_OVERLAYS_SUPPORT)) {
|
|
75
|
+
overlaysParams = `&overlays=${video.overlays}`;
|
|
76
|
+
}
|
|
77
|
+
const nbrOfChannels = video.audio === 1 ? `&nbrOfChannels=${video.nbrOfChannels}` : '';
|
|
78
|
+
const audioParams = `audio=${video.audio}${nbrOfChannels}`;
|
|
79
|
+
const videoCodecParams = video.videoCodec === 'h264'
|
|
80
|
+
? `videoCodec=${video.videoCodec}&h264Profile=${video.h264Profile}`
|
|
81
|
+
: `videoCodec=${video.videoCodec}`;
|
|
82
|
+
const videoParams = `camera=${video.camera}&resolution=${video.resolution}&fps=${video.fps}&compression=${video.compression}&videokeyframeinterval=${video.govLength}&${videoCodecParams}${overlaysParams}`;
|
|
83
|
+
return [videoParams, bitrateParams, audioParams].join('&');
|
|
84
|
+
};
|
|
85
|
+
exports.parseVideoOptionsToVapixParams = parseVideoOptionsToVapixParams;
|
|
86
|
+
const parseVapixParamsToVideoOptions = (internalVapixParams) => {
|
|
87
|
+
const bitrateOptions = (0, exports.parseVapixParamsToBitrateOptions)(internalVapixParams);
|
|
88
|
+
const params = {};
|
|
89
|
+
const searchParams = new URLSearchParams(internalVapixParams);
|
|
90
|
+
searchParams.forEach((value, key) => {
|
|
91
|
+
params[key] = value;
|
|
92
|
+
});
|
|
93
|
+
let h264Profile = undefined;
|
|
94
|
+
if (params['videoCodec'] === 'h264') {
|
|
95
|
+
h264Profile = (params['h264Profile'] ?? 'high');
|
|
96
|
+
}
|
|
97
|
+
let nbrOfChannels = undefined;
|
|
98
|
+
if (params['audio'] === '1') {
|
|
99
|
+
nbrOfChannels = parseInt(params['nbrOfChannels'] ?? '1');
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
...bitrateOptions,
|
|
103
|
+
camera: params['camera'] ?? '1',
|
|
104
|
+
resolution: params['resolution'] ?? '',
|
|
105
|
+
fps: parseInt(params['fps'] ?? '0', 10),
|
|
106
|
+
compression: parseInt(params['compression'] ?? '0', 10),
|
|
107
|
+
govLength: parseInt(params['videokeyframeinterval'] ?? '0', 10),
|
|
108
|
+
videoCodec: (params['videoCodec'] ?? 'h264'),
|
|
109
|
+
h264Profile,
|
|
110
|
+
audio: parseInt(params['audio'] ?? '0'),
|
|
111
|
+
nbrOfChannels,
|
|
112
|
+
overlays: params['overlays'],
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
exports.parseVapixParamsToVideoOptions = parseVapixParamsToVideoOptions;
|
package/cjs/internal/types.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Response as UndiciResponse } from 'undici';
|
|
3
1
|
export type Options = {
|
|
4
2
|
ip?: string;
|
|
5
3
|
port?: number;
|
|
@@ -11,25 +9,39 @@ export type Options = {
|
|
|
11
9
|
export type HttpOptions = Options & {
|
|
12
10
|
keepAlive?: boolean;
|
|
13
11
|
};
|
|
14
|
-
export type WsOptions = Options;
|
|
15
12
|
export type TParameters = Record<string, string | number | boolean | null | undefined>;
|
|
16
|
-
export type TResponse =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
export type TResponse = {
|
|
14
|
+
json: () => Promise<any>;
|
|
15
|
+
text: () => Promise<string>;
|
|
16
|
+
blob: () => Promise<unknown>;
|
|
17
|
+
status: number;
|
|
18
|
+
ok: boolean;
|
|
19
|
+
statusText: string;
|
|
20
|
+
};
|
|
21
|
+
export type TGetParams = {
|
|
22
|
+
path: string;
|
|
23
|
+
parameters?: TParameters;
|
|
24
|
+
headers?: Record<string, string>;
|
|
25
|
+
timeout?: number;
|
|
26
|
+
};
|
|
27
|
+
export type TPostParams<Data> = {
|
|
28
|
+
path: string;
|
|
29
|
+
data: string | Data;
|
|
30
|
+
parameters?: TParameters;
|
|
31
|
+
headers?: Record<string, string>;
|
|
32
|
+
timeout?: number;
|
|
33
|
+
};
|
|
34
|
+
export interface IClient<TRes extends TResponse, Data> {
|
|
35
|
+
get: (params: TGetParams) => Promise<TRes>;
|
|
36
|
+
post: (params: TPostParams<Data>) => Promise<TRes>;
|
|
27
37
|
}
|
|
28
|
-
export type TBlobResponse<Client extends IClient<TResponse>> = Awaited<ReturnType<Awaited<ReturnType<Client['get']>>['blob']>>;
|
|
29
|
-
export interface
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
export type TBlobResponse<Client extends IClient<TResponse, any>> = Awaited<ReturnType<Awaited<ReturnType<Client['get']>>['blob']>>;
|
|
39
|
+
export interface IWsClient {
|
|
40
|
+
onMessage: null | ((data: ArrayBuffer | string) => void);
|
|
41
|
+
onOpen: () => void;
|
|
42
|
+
onClose: () => void;
|
|
43
|
+
onError: (error: Error) => void;
|
|
44
|
+
send: (data: ArrayBuffer | string) => void;
|
|
45
|
+
reconnect: () => void;
|
|
32
46
|
destroy: () => void;
|
|
33
|
-
onmessage: null | ((event: Event) => void);
|
|
34
|
-
send: (data: string) => void;
|
|
35
47
|
}
|
package/cjs/internal/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TPlaylistPlayType } from '../types/CamSwitcherAPI';
|
|
2
|
-
import {
|
|
2
|
+
import { TParameters } from './types';
|
|
3
3
|
export declare const addParametersToPath: (path: string, params?: TParameters) => string;
|
|
4
4
|
export declare const paramToUrl: (params?: TParameters) => string;
|
|
5
5
|
export declare const arrayToUrl: (arr: string | string[]) => string;
|
|
@@ -9,7 +9,5 @@ export declare const isClip: (id?: string) => boolean;
|
|
|
9
9
|
export declare const isTracker: (id?: string) => boolean;
|
|
10
10
|
export declare const isPlaylist: (id?: string) => boolean;
|
|
11
11
|
export declare const isLoopPlayType: (playType: TPlaylistPlayType) => boolean;
|
|
12
|
-
export declare function isClient(arg?: Options | IClient<TResponse>): arg is IClient<TResponse>;
|
|
13
|
-
export declare function responseStringify(res: TResponse): Promise<string>;
|
|
14
12
|
export declare function pad(num: number, size: number): string;
|
|
15
13
|
export declare function isNullish<T>(value: T | undefined | null): value is undefined | null;
|
package/cjs/internal/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isNullish = exports.pad = exports.
|
|
3
|
+
exports.isNullish = exports.pad = exports.isLoopPlayType = exports.isPlaylist = exports.isTracker = exports.isClip = exports.isStream = exports.isCamera = exports.arrayToUrl = exports.paramToUrl = exports.addParametersToPath = void 0;
|
|
4
4
|
const addParametersToPath = (path, params) => {
|
|
5
5
|
if (params === undefined || Object.keys(params).length === 0) {
|
|
6
6
|
return path;
|
|
@@ -43,17 +43,6 @@ const isPlaylist = (id) => id?.charAt(0) === 'p';
|
|
|
43
43
|
exports.isPlaylist = isPlaylist;
|
|
44
44
|
const isLoopPlayType = (playType) => playType.includes('LOOP');
|
|
45
45
|
exports.isLoopPlayType = isLoopPlayType;
|
|
46
|
-
function isClient(arg = {}) {
|
|
47
|
-
return 'get' in arg && 'post' in arg;
|
|
48
|
-
}
|
|
49
|
-
exports.isClient = isClient;
|
|
50
|
-
async function responseStringify(res) {
|
|
51
|
-
return JSON.stringify({
|
|
52
|
-
status: res.status,
|
|
53
|
-
body: await res.text(),
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
exports.responseStringify = responseStringify;
|
|
57
46
|
function pad(num, size) {
|
|
58
47
|
const sign = Math.sign(num) === -1 ? '-' : '';
|
|
59
48
|
return (sign +
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const assertVersionString: (s: string, msg?: string) => void;
|
|
2
2
|
export declare const isFirmwareVersionAtLeast: (version: string, compareVersion: string) => boolean;
|
|
3
3
|
export declare const isVersionAtLeast: (version: string, compareVersion: string) => boolean;
|
|
4
|
-
export declare const firmwareVersionCompare: (a: string, b: string) =>
|
|
5
|
-
export declare const versionCompare: (a: string, b: string) =>
|
|
4
|
+
export declare const firmwareVersionCompare: (a: string, b: string) => 1 | 0 | -1;
|
|
5
|
+
export declare const versionCompare: (a: string, b: string) => 1 | 0 | -1;
|
|
6
6
|
export declare const fixVersionToDots: (version: string) => string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
import { EventEmitter } from 'events';
|
|
5
|
+
import { CamOverlayDrawingOptions, TCairoCreateResponse, TCairoResponse, TUploadImageResponse, TWriteTextParams } from '../types/CamOverlayDrawingAPI';
|
|
6
|
+
export declare class CamOverlayDrawingAPI extends EventEmitter {
|
|
7
|
+
private tls;
|
|
8
|
+
private tlsInsecure;
|
|
9
|
+
private ip;
|
|
10
|
+
private port;
|
|
11
|
+
private user;
|
|
12
|
+
private pass;
|
|
13
|
+
private cameraList;
|
|
14
|
+
private zIndex;
|
|
15
|
+
private callId;
|
|
16
|
+
private sendMessages;
|
|
17
|
+
private timeoutCheckTimer;
|
|
18
|
+
private wsConnected;
|
|
19
|
+
private ws;
|
|
20
|
+
constructor(options?: CamOverlayDrawingOptions);
|
|
21
|
+
connect(): void;
|
|
22
|
+
disconnect(): void;
|
|
23
|
+
isConnected(): boolean;
|
|
24
|
+
cairo(command: string, ...params: unknown[]): Promise<TCairoResponse | TCairoCreateResponse>;
|
|
25
|
+
writeText(...params: TWriteTextParams): Promise<TCairoResponse>;
|
|
26
|
+
uploadImageData(imgBuffer: Buffer): Promise<TUploadImageResponse>;
|
|
27
|
+
uploadFontData(fontBuffer: Buffer): Promise<TCairoCreateResponse>;
|
|
28
|
+
showCairoImage(cairoImage: string, posX: number, posY: number): Promise<TCairoResponse>;
|
|
29
|
+
showCairoImageAbsolute(cairoImage: string, posX: number, posY: number, width: number, height: number): Promise<TCairoResponse>;
|
|
30
|
+
removeImage(): Promise<TCairoResponse>;
|
|
31
|
+
private createWsClient;
|
|
32
|
+
private incomingWsMessageHandler;
|
|
33
|
+
private sendMessage;
|
|
34
|
+
private sendBinaryMessage;
|
|
35
|
+
private startMsgsTimeoutCheck;
|
|
36
|
+
private stopMsgsTimeoutCheck;
|
|
37
|
+
private reconnectWithError;
|
|
38
|
+
private reportMessage;
|
|
39
|
+
private reportError;
|
|
40
|
+
private reportClose;
|
|
41
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CamOverlayDrawingAPI = void 0;
|
|
4
|
-
const
|
|
5
|
-
const WsClient_1 = require("./
|
|
6
|
-
class CamOverlayDrawingAPI extends EventEmitter {
|
|
4
|
+
const events_1 = require("events");
|
|
5
|
+
const WsClient_1 = require("./WsClient");
|
|
6
|
+
class CamOverlayDrawingAPI extends events_1.EventEmitter {
|
|
7
7
|
tls;
|
|
8
8
|
tlsInsecure;
|
|
9
9
|
ip;
|
|
@@ -37,14 +37,14 @@ class CamOverlayDrawingAPI extends EventEmitter {
|
|
|
37
37
|
this.sendMessages = {};
|
|
38
38
|
this.wsConnected = false;
|
|
39
39
|
this.createWsClient();
|
|
40
|
-
EventEmitter.call(this);
|
|
40
|
+
events_1.EventEmitter.call(this);
|
|
41
41
|
}
|
|
42
42
|
connect() {
|
|
43
43
|
this.ws.open();
|
|
44
44
|
this.startMsgsTimeoutCheck();
|
|
45
45
|
}
|
|
46
46
|
disconnect() {
|
|
47
|
-
this.ws.
|
|
47
|
+
this.ws.destroy();
|
|
48
48
|
this.stopMsgsTimeoutCheck();
|
|
49
49
|
}
|
|
50
50
|
isConnected() {
|
|
@@ -101,23 +101,23 @@ class CamOverlayDrawingAPI extends EventEmitter {
|
|
|
101
101
|
tlsInsecure: this.tlsInsecure,
|
|
102
102
|
};
|
|
103
103
|
this.ws = new WsClient_1.WsClient(options);
|
|
104
|
-
this.ws.
|
|
104
|
+
this.ws.onOpen = () => {
|
|
105
105
|
console.log('CamOverlay connection opened');
|
|
106
106
|
this.wsConnected = true;
|
|
107
107
|
this.emit('open');
|
|
108
|
-
}
|
|
109
|
-
this.ws.
|
|
110
|
-
this.ws.
|
|
108
|
+
};
|
|
109
|
+
this.ws.onMessage = (data) => this.incomingWsMessageHandler(data.toString());
|
|
110
|
+
this.ws.onError = (error) => {
|
|
111
111
|
this.reportError(error);
|
|
112
|
-
}
|
|
113
|
-
this.ws.
|
|
112
|
+
};
|
|
113
|
+
this.ws.onClose = () => {
|
|
114
114
|
console.log('CamOverlay connection closed');
|
|
115
115
|
this.wsConnected = false;
|
|
116
116
|
this.reportClose();
|
|
117
|
-
}
|
|
117
|
+
};
|
|
118
118
|
}
|
|
119
119
|
incomingWsMessageHandler(msgData) {
|
|
120
|
-
const dataJSON = JSON.parse(msgData
|
|
120
|
+
const dataJSON = JSON.parse(msgData);
|
|
121
121
|
let errorResponse;
|
|
122
122
|
if ('error' in dataJSON) {
|
|
123
123
|
errorResponse = dataJSON;
|
|
@@ -168,13 +168,21 @@ class CamOverlayDrawingAPI extends EventEmitter {
|
|
|
168
168
|
throw new Error('No CamOverlay connection');
|
|
169
169
|
}
|
|
170
170
|
msgJson.call_id = ++this.callId;
|
|
171
|
-
const
|
|
172
|
-
const
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const
|
|
177
|
-
|
|
171
|
+
const jsonString = JSON.stringify(msgJson);
|
|
172
|
+
const jsonByteLength = Buffer.byteLength(jsonString);
|
|
173
|
+
const headerLength = 5;
|
|
174
|
+
const totalLength = headerLength + jsonByteLength + data.byteLength;
|
|
175
|
+
const arrayBuffer = new ArrayBuffer(totalLength);
|
|
176
|
+
const view = new DataView(arrayBuffer);
|
|
177
|
+
view.setInt8(0, 1);
|
|
178
|
+
view.setInt32(1, jsonByteLength);
|
|
179
|
+
const jsonBuffer = new Uint8Array(arrayBuffer, 5, jsonByteLength);
|
|
180
|
+
for (let i = 0; i < jsonString.length; i++) {
|
|
181
|
+
jsonBuffer[i] = jsonString.charCodeAt(i);
|
|
182
|
+
}
|
|
183
|
+
const dataBuffer = new Uint8Array(arrayBuffer, 5 + jsonByteLength, data.byteLength);
|
|
184
|
+
data.copy(dataBuffer);
|
|
185
|
+
this.ws.send(arrayBuffer);
|
|
178
186
|
this.sendMessages[this.callId] = { resolve, reject, sentTimestamp: Date.now() };
|
|
179
187
|
}
|
|
180
188
|
catch (err) {
|
|
@@ -1,42 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import { CamOverlayDrawingAPI
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export type TTmf = 'TFM_OVERFLOW' | 'TFM_SCALE' | 'TFM_TRUNCATE';
|
|
8
|
-
export type TObjectFitType = 'fill' | 'fit' | 'none';
|
|
9
|
-
export type TFrameOptions = {
|
|
10
|
-
enabled?: boolean;
|
|
11
|
-
x: number;
|
|
12
|
-
y: number;
|
|
13
|
-
width: number;
|
|
14
|
-
height: number;
|
|
15
|
-
text?: string;
|
|
16
|
-
fontColor?: TRgb;
|
|
17
|
-
font?: string;
|
|
18
|
-
bgColor?: TRgba;
|
|
19
|
-
bgImage?: string;
|
|
20
|
-
bgType?: TObjectFitType;
|
|
21
|
-
borderRadius?: number;
|
|
22
|
-
borderWidth?: number;
|
|
23
|
-
borderColor?: TRgba;
|
|
24
|
-
customDraw?: TDrawingCallback;
|
|
25
|
-
layer?: number;
|
|
26
|
-
};
|
|
27
|
-
export type TFrameInfo = {
|
|
28
|
-
width: number;
|
|
29
|
-
height: number;
|
|
30
|
-
};
|
|
31
|
-
export type TDrawingCallback = (cod: CamOverlayDrawingAPI, cairo: string, info: TFrameInfo) => Promise<void>;
|
|
32
|
-
export interface Frame {
|
|
33
|
-
on(event: 'open', listener: () => void): this;
|
|
34
|
-
on(event: 'close', listener: () => void): this;
|
|
35
|
-
on(event: 'layoutChanged', listener: () => void): this;
|
|
36
|
-
emit(event: 'open'): boolean;
|
|
37
|
-
emit(event: 'close'): boolean;
|
|
38
|
-
emit(event: 'layoutChanged'): boolean;
|
|
39
|
-
}
|
|
3
|
+
import { CamOverlayDrawingAPI } from '../CamOverlayDrawingAPI';
|
|
4
|
+
import { TAlign, TCairoCreateResponse, TUploadImageResponse } from '../../types/CamOverlayDrawingAPI';
|
|
5
|
+
import { ResourceManager } from './ResourceManager';
|
|
6
|
+
import { TBg, TBorder, TDrawingCallback, TFrame, TFrameOptions, TObjectFitType, TRgb, TRgba, TText, TTmf } from '../../types/CamOverlayPainter';
|
|
40
7
|
export declare class Frame extends EventEmitter {
|
|
41
8
|
protected enabled: boolean;
|
|
42
9
|
protected posX: number;
|
|
@@ -64,17 +31,21 @@ export declare class Frame extends EventEmitter {
|
|
|
64
31
|
disable(): void;
|
|
65
32
|
setFramePosition(x: number, y: number): void;
|
|
66
33
|
setFrameSize(width: number, height: number): void;
|
|
34
|
+
getFrameInfo(): TFrame;
|
|
67
35
|
setText(text: string, align: TAlign, textType?: TTmf, fontColor?: TRgb): void;
|
|
68
36
|
setFontColor(fontColor: TRgb): void;
|
|
69
37
|
setFont(fontName: string): void;
|
|
70
38
|
setFontData(fontData: TCairoCreateResponse): void;
|
|
39
|
+
getTextInfo(): TText;
|
|
71
40
|
setBgColor(color: TRgba): void;
|
|
72
41
|
setBgImage(imageName: string, type?: TObjectFitType): void;
|
|
73
42
|
setBgImageData(imageData: TUploadImageResponse, type?: TObjectFitType): void;
|
|
74
43
|
setBgType(type: TObjectFitType): void;
|
|
44
|
+
getBgInfo(): TBg;
|
|
75
45
|
setBorderRadius(radius: number): void;
|
|
76
46
|
setBorderWidth(width: number): void;
|
|
77
47
|
setBorderColor(color: TRgba): void;
|
|
48
|
+
getBorderInfo(): TBorder;
|
|
78
49
|
setCustomDraw(customDraw: TDrawingCallback): void;
|
|
79
50
|
resetFont(): void;
|
|
80
51
|
resetBgColor(): void;
|