camstreamerlib 4.0.0-beta.75 → 4.0.0-beta.77
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/cjs/CamOverlayAPI.d.ts +22 -22
- package/cjs/CamStreamerAPI.d.ts +64 -49
- package/cjs/CamStreamerAPI.js +36 -23
- package/cjs/errors/errors.d.ts +7 -0
- package/cjs/errors/errors.js +12 -1
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.d.ts +81 -81
- package/cjs/types/CamOverlayAPI/accuweatherSchema.d.ts +4 -4
- package/cjs/types/CamOverlayAPI/customGraphicsSchema.d.ts +2 -2
- package/cjs/types/CamOverlayAPI/imagesSchema.d.ts +6 -6
- package/cjs/types/CamOverlayAPI/infotickerSchema.d.ts +2 -2
- package/cjs/types/CamOverlayAPI/pipSchema.d.ts +2 -2
- package/cjs/types/CamOverlayAPI/ptzCompassSchema.d.ts +2 -2
- package/cjs/types/CamOverlayAPI/ptzSchema.d.ts +2 -2
- package/cjs/types/CamOverlayAPI/screenSharingSchema.d.ts +2 -2
- package/cjs/types/CamOverlayAPI/serviceCommonTypes.d.ts +6 -6
- package/cjs/types/CamOverlayAPI/webCameraSharingSchema.d.ts +2 -2
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.d.ts +267 -0
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.js +48 -0
- package/cjs/types/CamStreamerAPI/facebookSchema.d.ts +21 -0
- package/cjs/types/CamStreamerAPI/facebookSchema.js +11 -0
- package/cjs/types/CamStreamerAPI/hlsSchema.d.ts +21 -0
- package/cjs/types/CamStreamerAPI/hlsSchema.js +11 -0
- package/cjs/types/CamStreamerAPI/index.d.ts +9 -0
- package/cjs/types/CamStreamerAPI/index.js +25 -0
- package/cjs/types/CamStreamerAPI/mpegDvbSchema.d.ts +72 -0
- package/cjs/types/CamStreamerAPI/mpegDvbSchema.js +28 -0
- package/cjs/types/CamStreamerAPI/oldStreamSchema.d.ts +137 -0
- package/cjs/types/{CamStreamerAPI.js → CamStreamerAPI/oldStreamSchema.js} +3 -12
- package/cjs/types/CamStreamerAPI/rtmpSchema.d.ts +21 -0
- package/cjs/types/CamStreamerAPI/rtmpSchema.js +11 -0
- package/cjs/types/CamStreamerAPI/sdCardSchema.d.ts +21 -0
- package/cjs/types/CamStreamerAPI/sdCardSchema.js +11 -0
- package/cjs/types/CamStreamerAPI/streamCommonTypes.d.ts +20 -0
- package/cjs/types/CamStreamerAPI/streamCommonTypes.js +19 -0
- package/cjs/types/CamStreamerAPI/windySchema.d.ts +21 -0
- package/cjs/types/CamStreamerAPI/windySchema.js +11 -0
- package/cjs/types/CamStreamerAPI/youtubeSchema.d.ts +21 -0
- package/cjs/types/CamStreamerAPI/youtubeSchema.js +11 -0
- package/cjs/types/common.d.ts +1 -0
- package/cjs/types/common.js +2 -1
- package/esm/CamStreamerAPI.js +37 -24
- package/esm/errors/errors.js +10 -0
- package/esm/types/CamStreamerAPI/CamStreamerAPI.js +38 -0
- package/esm/types/CamStreamerAPI/facebookSchema.js +5 -0
- package/esm/types/CamStreamerAPI/hlsSchema.js +5 -0
- package/esm/types/CamStreamerAPI/index.js +9 -0
- package/esm/types/CamStreamerAPI/mpegDvbSchema.js +22 -0
- package/esm/types/{CamStreamerAPI.js → CamStreamerAPI/oldStreamSchema.js} +2 -11
- package/esm/types/CamStreamerAPI/rtmpSchema.js +5 -0
- package/esm/types/CamStreamerAPI/sdCardSchema.js +5 -0
- package/esm/types/CamStreamerAPI/streamCommonTypes.js +16 -0
- package/esm/types/CamStreamerAPI/windySchema.js +5 -0
- package/esm/types/CamStreamerAPI/youtubeSchema.js +5 -0
- package/esm/types/common.js +1 -0
- package/package.json +1 -1
- package/types/CamOverlayAPI.d.ts +22 -22
- package/types/CamStreamerAPI.d.ts +64 -49
- package/types/errors/errors.d.ts +7 -0
- package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +81 -81
- package/types/types/CamOverlayAPI/accuweatherSchema.d.ts +4 -4
- package/types/types/CamOverlayAPI/customGraphicsSchema.d.ts +2 -2
- package/types/types/CamOverlayAPI/imagesSchema.d.ts +6 -6
- package/types/types/CamOverlayAPI/infotickerSchema.d.ts +2 -2
- package/types/types/CamOverlayAPI/pipSchema.d.ts +2 -2
- package/types/types/CamOverlayAPI/ptzCompassSchema.d.ts +2 -2
- package/types/types/CamOverlayAPI/ptzSchema.d.ts +2 -2
- package/types/types/CamOverlayAPI/screenSharingSchema.d.ts +2 -2
- package/types/types/CamOverlayAPI/serviceCommonTypes.d.ts +6 -6
- package/types/types/CamOverlayAPI/webCameraSharingSchema.d.ts +2 -2
- package/types/types/CamStreamerAPI/CamStreamerAPI.d.ts +267 -0
- package/types/types/CamStreamerAPI/facebookSchema.d.ts +21 -0
- package/types/types/CamStreamerAPI/hlsSchema.d.ts +21 -0
- package/types/types/CamStreamerAPI/index.d.ts +9 -0
- package/types/types/CamStreamerAPI/mpegDvbSchema.d.ts +72 -0
- package/types/types/CamStreamerAPI/oldStreamSchema.d.ts +137 -0
- package/types/types/CamStreamerAPI/rtmpSchema.d.ts +21 -0
- package/types/types/CamStreamerAPI/sdCardSchema.d.ts +21 -0
- package/types/types/CamStreamerAPI/streamCommonTypes.d.ts +20 -0
- package/types/types/CamStreamerAPI/windySchema.d.ts +21 -0
- package/types/types/CamStreamerAPI/youtubeSchema.d.ts +21 -0
- package/types/types/common.d.ts +1 -0
- package/cjs/types/CamStreamerAPI.d.ts +0 -272
- package/types/types/CamStreamerAPI.d.ts +0 -272
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./CamStreamerAPI"), exports);
|
|
18
|
+
__exportStar(require("./streamCommonTypes"), exports);
|
|
19
|
+
__exportStar(require("./facebookSchema"), exports);
|
|
20
|
+
__exportStar(require("./hlsSchema"), exports);
|
|
21
|
+
__exportStar(require("./mpegDvbSchema"), exports);
|
|
22
|
+
__exportStar(require("./rtmpSchema"), exports);
|
|
23
|
+
__exportStar(require("./sdCardSchema"), exports);
|
|
24
|
+
__exportStar(require("./windySchema"), exports);
|
|
25
|
+
__exportStar(require("./youtubeSchema"), exports);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const mpegDvbSchema: z.ZodObject<{
|
|
3
|
+
enabled: z.ZodBoolean;
|
|
4
|
+
active: z.ZodBoolean;
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
order: z.ZodNumber;
|
|
7
|
+
} & {
|
|
8
|
+
type: z.ZodLiteral<"mpeg_dvb">;
|
|
9
|
+
ipAddress: z.ZodString;
|
|
10
|
+
port: z.ZodNumber;
|
|
11
|
+
standard: z.ZodEnum<["DVB", "ATSC"]>;
|
|
12
|
+
nullPacketsPaddingEnabled: z.ZodBoolean;
|
|
13
|
+
nullPacketsPaddingKbps: z.ZodNumber;
|
|
14
|
+
videoPid: z.ZodNumber;
|
|
15
|
+
audioPid: z.ZodNumber;
|
|
16
|
+
mpegtsStreamId: z.ZodNumber;
|
|
17
|
+
pmtPid: z.ZodNumber;
|
|
18
|
+
pcrPid: z.ZodNumber;
|
|
19
|
+
pcrPeriodMs: z.ZodNumber;
|
|
20
|
+
providerName: z.ZodString;
|
|
21
|
+
serviceName: z.ZodString;
|
|
22
|
+
triggerType: z.ZodEnum<["manual", "onetime", "recurrent", "io", "nonstop"]>;
|
|
23
|
+
statusCameraLed: z.ZodBoolean;
|
|
24
|
+
statusCameraOutput: z.ZodNumber;
|
|
25
|
+
saveToSdCard: z.ZodBoolean;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
type: "mpeg_dvb";
|
|
28
|
+
port: number;
|
|
29
|
+
enabled: boolean;
|
|
30
|
+
active: boolean;
|
|
31
|
+
title: string;
|
|
32
|
+
order: number;
|
|
33
|
+
ipAddress: string;
|
|
34
|
+
standard: "DVB" | "ATSC";
|
|
35
|
+
nullPacketsPaddingEnabled: boolean;
|
|
36
|
+
nullPacketsPaddingKbps: number;
|
|
37
|
+
videoPid: number;
|
|
38
|
+
audioPid: number;
|
|
39
|
+
mpegtsStreamId: number;
|
|
40
|
+
pmtPid: number;
|
|
41
|
+
pcrPid: number;
|
|
42
|
+
pcrPeriodMs: number;
|
|
43
|
+
providerName: string;
|
|
44
|
+
serviceName: string;
|
|
45
|
+
triggerType: "manual" | "onetime" | "recurrent" | "io" | "nonstop";
|
|
46
|
+
statusCameraLed: boolean;
|
|
47
|
+
statusCameraOutput: number;
|
|
48
|
+
saveToSdCard: boolean;
|
|
49
|
+
}, {
|
|
50
|
+
type: "mpeg_dvb";
|
|
51
|
+
port: number;
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
active: boolean;
|
|
54
|
+
title: string;
|
|
55
|
+
order: number;
|
|
56
|
+
ipAddress: string;
|
|
57
|
+
standard: "DVB" | "ATSC";
|
|
58
|
+
nullPacketsPaddingEnabled: boolean;
|
|
59
|
+
nullPacketsPaddingKbps: number;
|
|
60
|
+
videoPid: number;
|
|
61
|
+
audioPid: number;
|
|
62
|
+
mpegtsStreamId: number;
|
|
63
|
+
pmtPid: number;
|
|
64
|
+
pcrPid: number;
|
|
65
|
+
pcrPeriodMs: number;
|
|
66
|
+
providerName: string;
|
|
67
|
+
serviceName: string;
|
|
68
|
+
triggerType: "manual" | "onetime" | "recurrent" | "io" | "nonstop";
|
|
69
|
+
statusCameraLed: boolean;
|
|
70
|
+
statusCameraOutput: number;
|
|
71
|
+
saveToSdCard: boolean;
|
|
72
|
+
}>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.mpegDvbSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const streamCommonTypes_1 = require("./streamCommonTypes");
|
|
9
|
+
exports.mpegDvbSchema = streamCommonTypes_1.streamCommonSchema.extend({
|
|
10
|
+
type: zod_1.default.literal('mpeg_dvb'),
|
|
11
|
+
ipAddress: zod_1.default.string(),
|
|
12
|
+
port: zod_1.default.number(),
|
|
13
|
+
standard: zod_1.default.enum(['DVB', 'ATSC']),
|
|
14
|
+
nullPacketsPaddingEnabled: zod_1.default.boolean(),
|
|
15
|
+
nullPacketsPaddingKbps: zod_1.default.number(),
|
|
16
|
+
videoPid: zod_1.default.number(),
|
|
17
|
+
audioPid: zod_1.default.number(),
|
|
18
|
+
mpegtsStreamId: zod_1.default.number(),
|
|
19
|
+
pmtPid: zod_1.default.number(),
|
|
20
|
+
pcrPid: zod_1.default.number(),
|
|
21
|
+
pcrPeriodMs: zod_1.default.number(),
|
|
22
|
+
providerName: zod_1.default.string(),
|
|
23
|
+
serviceName: zod_1.default.string(),
|
|
24
|
+
triggerType: zod_1.default.enum(['manual', 'onetime', 'recurrent', 'io', 'nonstop']),
|
|
25
|
+
statusCameraLed: zod_1.default.boolean(),
|
|
26
|
+
statusCameraOutput: zod_1.default.number(),
|
|
27
|
+
saveToSdCard: zod_1.default.boolean(),
|
|
28
|
+
});
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const oldStringStreamSchema: z.ZodObject<{
|
|
3
|
+
enabled: z.ZodString;
|
|
4
|
+
active: z.ZodString;
|
|
5
|
+
audioSource: z.ZodString;
|
|
6
|
+
avSyncMsec: z.ZodString;
|
|
7
|
+
internalVapixParameters: z.ZodString;
|
|
8
|
+
userVapixParameters: z.ZodString;
|
|
9
|
+
outputParameters: z.ZodString;
|
|
10
|
+
outputType: z.ZodString;
|
|
11
|
+
mediaServerUrl: z.ZodString;
|
|
12
|
+
inputType: z.ZodString;
|
|
13
|
+
inputUrl: z.ZodString;
|
|
14
|
+
forceStereo: z.ZodString;
|
|
15
|
+
streamDelay: z.ZodString;
|
|
16
|
+
statusLed: z.ZodString;
|
|
17
|
+
statusPort: z.ZodString;
|
|
18
|
+
callApi: z.ZodString;
|
|
19
|
+
trigger: z.ZodString;
|
|
20
|
+
schedule: z.ZodString;
|
|
21
|
+
prepareAhead: z.ZodString;
|
|
22
|
+
startTime: z.ZodString;
|
|
23
|
+
stopTime: z.ZodString;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
enabled: string;
|
|
26
|
+
active: string;
|
|
27
|
+
audioSource: string;
|
|
28
|
+
avSyncMsec: string;
|
|
29
|
+
internalVapixParameters: string;
|
|
30
|
+
userVapixParameters: string;
|
|
31
|
+
outputParameters: string;
|
|
32
|
+
outputType: string;
|
|
33
|
+
mediaServerUrl: string;
|
|
34
|
+
inputType: string;
|
|
35
|
+
inputUrl: string;
|
|
36
|
+
forceStereo: string;
|
|
37
|
+
streamDelay: string;
|
|
38
|
+
statusLed: string;
|
|
39
|
+
statusPort: string;
|
|
40
|
+
callApi: string;
|
|
41
|
+
trigger: string;
|
|
42
|
+
schedule: string;
|
|
43
|
+
prepareAhead: string;
|
|
44
|
+
startTime: string;
|
|
45
|
+
stopTime: string;
|
|
46
|
+
}, {
|
|
47
|
+
enabled: string;
|
|
48
|
+
active: string;
|
|
49
|
+
audioSource: string;
|
|
50
|
+
avSyncMsec: string;
|
|
51
|
+
internalVapixParameters: string;
|
|
52
|
+
userVapixParameters: string;
|
|
53
|
+
outputParameters: string;
|
|
54
|
+
outputType: string;
|
|
55
|
+
mediaServerUrl: string;
|
|
56
|
+
inputType: string;
|
|
57
|
+
inputUrl: string;
|
|
58
|
+
forceStereo: string;
|
|
59
|
+
streamDelay: string;
|
|
60
|
+
statusLed: string;
|
|
61
|
+
statusPort: string;
|
|
62
|
+
callApi: string;
|
|
63
|
+
trigger: string;
|
|
64
|
+
schedule: string;
|
|
65
|
+
prepareAhead: string;
|
|
66
|
+
startTime: string;
|
|
67
|
+
stopTime: string;
|
|
68
|
+
}>;
|
|
69
|
+
export type TOldStringStream = z.infer<typeof oldStringStreamSchema>;
|
|
70
|
+
export declare const oldStreamSchema: z.ZodObject<{
|
|
71
|
+
enabled: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
|
|
72
|
+
active: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
|
|
73
|
+
audioSource: z.ZodString;
|
|
74
|
+
avSyncMsec: z.ZodNumber;
|
|
75
|
+
internalVapixParameters: z.ZodString;
|
|
76
|
+
userVapixParameters: z.ZodString;
|
|
77
|
+
outputParameters: z.ZodString;
|
|
78
|
+
outputType: z.ZodUnion<[z.ZodLiteral<"video">, z.ZodLiteral<"images">, z.ZodLiteral<"none">]>;
|
|
79
|
+
mediaServerUrl: z.ZodString;
|
|
80
|
+
inputType: z.ZodUnion<[z.ZodLiteral<"CSw">, z.ZodLiteral<"CRS">, z.ZodLiteral<"RTSP_URL">]>;
|
|
81
|
+
inputUrl: z.ZodString;
|
|
82
|
+
forceStereo: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
|
|
83
|
+
streamDelay: z.ZodNullable<z.ZodNumber>;
|
|
84
|
+
statusLed: z.ZodNumber;
|
|
85
|
+
statusPort: z.ZodString;
|
|
86
|
+
callApi: z.ZodNumber;
|
|
87
|
+
trigger: z.ZodString;
|
|
88
|
+
schedule: z.ZodString;
|
|
89
|
+
prepareAhead: z.ZodNumber;
|
|
90
|
+
startTime: z.ZodNullable<z.ZodNumber>;
|
|
91
|
+
stopTime: z.ZodNullable<z.ZodNumber>;
|
|
92
|
+
}, "strip", z.ZodTypeAny, {
|
|
93
|
+
enabled: 0 | 1;
|
|
94
|
+
active: 0 | 1;
|
|
95
|
+
audioSource: string;
|
|
96
|
+
avSyncMsec: number;
|
|
97
|
+
internalVapixParameters: string;
|
|
98
|
+
userVapixParameters: string;
|
|
99
|
+
outputParameters: string;
|
|
100
|
+
outputType: "video" | "none" | "images";
|
|
101
|
+
mediaServerUrl: string;
|
|
102
|
+
inputType: "RTSP_URL" | "CSw" | "CRS";
|
|
103
|
+
inputUrl: string;
|
|
104
|
+
forceStereo: 0 | 1;
|
|
105
|
+
streamDelay: number | null;
|
|
106
|
+
statusLed: number;
|
|
107
|
+
statusPort: string;
|
|
108
|
+
callApi: number;
|
|
109
|
+
trigger: string;
|
|
110
|
+
schedule: string;
|
|
111
|
+
prepareAhead: number;
|
|
112
|
+
startTime: number | null;
|
|
113
|
+
stopTime: number | null;
|
|
114
|
+
}, {
|
|
115
|
+
enabled: 0 | 1;
|
|
116
|
+
active: 0 | 1;
|
|
117
|
+
audioSource: string;
|
|
118
|
+
avSyncMsec: number;
|
|
119
|
+
internalVapixParameters: string;
|
|
120
|
+
userVapixParameters: string;
|
|
121
|
+
outputParameters: string;
|
|
122
|
+
outputType: "video" | "none" | "images";
|
|
123
|
+
mediaServerUrl: string;
|
|
124
|
+
inputType: "RTSP_URL" | "CSw" | "CRS";
|
|
125
|
+
inputUrl: string;
|
|
126
|
+
forceStereo: 0 | 1;
|
|
127
|
+
streamDelay: number | null;
|
|
128
|
+
statusLed: number;
|
|
129
|
+
statusPort: string;
|
|
130
|
+
callApi: number;
|
|
131
|
+
trigger: string;
|
|
132
|
+
schedule: string;
|
|
133
|
+
prepareAhead: number;
|
|
134
|
+
startTime: number | null;
|
|
135
|
+
stopTime: number | null;
|
|
136
|
+
}>;
|
|
137
|
+
export type TOldStream = z.infer<typeof oldStreamSchema>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.oldStreamSchema = exports.oldStringStreamSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
exports.
|
|
5
|
+
exports.oldStringStreamSchema = 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,7 @@ exports.cameraStreamSchema = zod_1.z.object({
|
|
|
25
25
|
startTime: zod_1.z.string(),
|
|
26
26
|
stopTime: zod_1.z.string(),
|
|
27
27
|
});
|
|
28
|
-
exports.
|
|
28
|
+
exports.oldStreamSchema = zod_1.z.object({
|
|
29
29
|
enabled: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
|
|
30
30
|
active: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
|
|
31
31
|
audioSource: zod_1.z.string(),
|
|
@@ -48,12 +48,3 @@ exports.streamSchema = zod_1.z.object({
|
|
|
48
48
|
startTime: zod_1.z.number().nullable(),
|
|
49
49
|
stopTime: zod_1.z.number().nullable(),
|
|
50
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
|
-
});
|
|
56
|
-
exports.camstreamerServerResponseSchema = zod_1.z.object({
|
|
57
|
-
code: zod_1.z.number(),
|
|
58
|
-
message: zod_1.z.string(),
|
|
59
|
-
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const rtmpSchema: z.ZodObject<{
|
|
3
|
+
enabled: z.ZodBoolean;
|
|
4
|
+
active: z.ZodBoolean;
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
order: z.ZodNumber;
|
|
7
|
+
} & {
|
|
8
|
+
type: z.ZodLiteral<"rtmp">;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
type: "rtmp";
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
active: boolean;
|
|
13
|
+
title: string;
|
|
14
|
+
order: number;
|
|
15
|
+
}, {
|
|
16
|
+
type: "rtmp";
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
active: boolean;
|
|
19
|
+
title: string;
|
|
20
|
+
order: number;
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.rtmpSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const streamCommonTypes_1 = require("./streamCommonTypes");
|
|
9
|
+
exports.rtmpSchema = streamCommonTypes_1.streamCommonSchema.extend({
|
|
10
|
+
type: zod_1.default.literal('rtmp'),
|
|
11
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const sdCardSchema: z.ZodObject<{
|
|
3
|
+
enabled: z.ZodBoolean;
|
|
4
|
+
active: z.ZodBoolean;
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
order: z.ZodNumber;
|
|
7
|
+
} & {
|
|
8
|
+
type: z.ZodLiteral<"sd_card">;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
type: "sd_card";
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
active: boolean;
|
|
13
|
+
title: string;
|
|
14
|
+
order: number;
|
|
15
|
+
}, {
|
|
16
|
+
type: "sd_card";
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
active: boolean;
|
|
19
|
+
title: string;
|
|
20
|
+
order: number;
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.sdCardSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const streamCommonTypes_1 = require("./streamCommonTypes");
|
|
9
|
+
exports.sdCardSchema = streamCommonTypes_1.streamCommonSchema.extend({
|
|
10
|
+
type: zod_1.default.literal('sd_card'),
|
|
11
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const streamTypeSchema: z.ZodUnion<[z.ZodLiteral<"youtube">, z.ZodLiteral<"facebook">, z.ZodLiteral<"sd_card">, z.ZodLiteral<"windy">, z.ZodLiteral<"mpeg_dvb">, z.ZodLiteral<"hls">, z.ZodLiteral<"rtmp">]>;
|
|
3
|
+
export type TStreamType = z.infer<typeof streamTypeSchema>;
|
|
4
|
+
export declare const streamCommonSchema: z.ZodObject<{
|
|
5
|
+
enabled: z.ZodBoolean;
|
|
6
|
+
active: z.ZodBoolean;
|
|
7
|
+
title: z.ZodString;
|
|
8
|
+
order: z.ZodNumber;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
active: boolean;
|
|
12
|
+
title: string;
|
|
13
|
+
order: number;
|
|
14
|
+
}, {
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
active: boolean;
|
|
17
|
+
title: string;
|
|
18
|
+
order: number;
|
|
19
|
+
}>;
|
|
20
|
+
export type TCommonStream = z.infer<typeof streamCommonSchema>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.streamCommonSchema = exports.streamTypeSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.streamTypeSchema = zod_1.z.union([
|
|
6
|
+
zod_1.z.literal('youtube'),
|
|
7
|
+
zod_1.z.literal('facebook'),
|
|
8
|
+
zod_1.z.literal('sd_card'),
|
|
9
|
+
zod_1.z.literal('windy'),
|
|
10
|
+
zod_1.z.literal('mpeg_dvb'),
|
|
11
|
+
zod_1.z.literal('hls'),
|
|
12
|
+
zod_1.z.literal('rtmp'),
|
|
13
|
+
]);
|
|
14
|
+
exports.streamCommonSchema = zod_1.z.object({
|
|
15
|
+
enabled: zod_1.z.boolean(),
|
|
16
|
+
active: zod_1.z.boolean(),
|
|
17
|
+
title: zod_1.z.string(),
|
|
18
|
+
order: zod_1.z.number(),
|
|
19
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const windySchema: z.ZodObject<{
|
|
3
|
+
enabled: z.ZodBoolean;
|
|
4
|
+
active: z.ZodBoolean;
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
order: z.ZodNumber;
|
|
7
|
+
} & {
|
|
8
|
+
type: z.ZodLiteral<"windy">;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
type: "windy";
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
active: boolean;
|
|
13
|
+
title: string;
|
|
14
|
+
order: number;
|
|
15
|
+
}, {
|
|
16
|
+
type: "windy";
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
active: boolean;
|
|
19
|
+
title: string;
|
|
20
|
+
order: number;
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.windySchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const streamCommonTypes_1 = require("./streamCommonTypes");
|
|
9
|
+
exports.windySchema = streamCommonTypes_1.streamCommonSchema.extend({
|
|
10
|
+
type: zod_1.default.literal('windy'),
|
|
11
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const youtubeSchema: z.ZodObject<{
|
|
3
|
+
enabled: z.ZodBoolean;
|
|
4
|
+
active: z.ZodBoolean;
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
order: z.ZodNumber;
|
|
7
|
+
} & {
|
|
8
|
+
type: z.ZodLiteral<"youtube">;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
type: "youtube";
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
active: boolean;
|
|
13
|
+
title: string;
|
|
14
|
+
order: number;
|
|
15
|
+
}, {
|
|
16
|
+
type: "youtube";
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
active: boolean;
|
|
19
|
+
title: string;
|
|
20
|
+
order: number;
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.youtubeSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const streamCommonTypes_1 = require("./streamCommonTypes");
|
|
9
|
+
exports.youtubeSchema = streamCommonTypes_1.streamCommonSchema.extend({
|
|
10
|
+
type: zod_1.default.literal('youtube'),
|
|
11
|
+
});
|
package/cjs/types/common.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export declare const booleanSchema: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
|
|
2
3
|
export declare const audioChannelSchema: z.ZodUnion<[z.ZodLiteral<"mono">, z.ZodLiteral<"stereo">]>;
|
|
3
4
|
export type TAudioChannel = z.infer<typeof audioChannelSchema>;
|
|
4
5
|
export declare const audioChannelCountSchema: z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>]>;
|
package/cjs/types/common.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.keyboardShortcutsSchema = exports.keyboardShortcutSchema = exports.networkCameraListSchema = exports.storageTypeSchema = exports.sdCardStorageTypeSchema = exports.flashStorageTypeSchema = exports.h264ProfileSchema = exports.audioChannelCountSchema = exports.audioChannelSchema = void 0;
|
|
3
|
+
exports.keyboardShortcutsSchema = exports.keyboardShortcutSchema = exports.networkCameraListSchema = exports.storageTypeSchema = exports.sdCardStorageTypeSchema = exports.flashStorageTypeSchema = exports.h264ProfileSchema = exports.audioChannelCountSchema = exports.audioChannelSchema = exports.booleanSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
exports.booleanSchema = zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]);
|
|
5
6
|
exports.audioChannelSchema = zod_1.z.union([zod_1.z.literal('mono'), zod_1.z.literal('stereo')]);
|
|
6
7
|
exports.audioChannelCountSchema = zod_1.z.union([zod_1.z.literal(1), zod_1.z.literal(2)]);
|
|
7
8
|
exports.h264ProfileSchema = zod_1.z.union([zod_1.z.literal('high'), zod_1.z.literal('main'), zod_1.z.literal('baseline')]);
|
package/esm/CamStreamerAPI.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ProxyClient } from './internal/ProxyClient';
|
|
3
|
-
import {
|
|
4
|
-
import { ErrorWithResponse, UtcTimeFetchError, WsAuthorizationError } from './errors/errors';
|
|
3
|
+
import { streamSchema } from './types/CamStreamerAPI/CamStreamerAPI';
|
|
4
|
+
import { ErrorWithResponse, UtcTimeFetchError, WsAuthorizationError, MigrationError } from './errors/errors';
|
|
5
|
+
import { oldStringStreamSchema } from './types/CamStreamerAPI/oldStreamSchema';
|
|
5
6
|
const BASE_PATH = '/local/camstreamer';
|
|
6
7
|
export class CamStreamerAPI {
|
|
7
8
|
client;
|
|
8
9
|
constructor(client) {
|
|
9
10
|
this.client = client;
|
|
10
11
|
}
|
|
12
|
+
static getProxyPath = () => `${BASE_PATH}/proxy.cgi`;
|
|
11
13
|
getClient(proxyParams) {
|
|
12
14
|
return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
|
|
13
15
|
}
|
|
@@ -27,35 +29,46 @@ export class CamStreamerAPI {
|
|
|
27
29
|
}
|
|
28
30
|
async getStreamList(options) {
|
|
29
31
|
const res = await this._getJson(`${BASE_PATH}/stream/list.cgi`, undefined, options);
|
|
30
|
-
const list = z.record(z.string(), cameraStreamSchema).parse(res.data);
|
|
31
32
|
const streamList = {};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const invalidList = {};
|
|
34
|
+
for (const [key, value] of Object.entries(res.data)) {
|
|
35
|
+
const id = parseInt(key);
|
|
36
|
+
try {
|
|
37
|
+
const parsed = streamSchema.parse(value);
|
|
38
|
+
streamList[id] = parsed;
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
const oldStream = oldStringStreamSchema.parse(value);
|
|
42
|
+
const parsedOldStream = parseCameraStreamResponse(oldStream);
|
|
43
|
+
invalidList[id] = parsedOldStream;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (Object.keys(invalidList).length > 0) {
|
|
47
|
+
throw new MigrationError(streamList, invalidList);
|
|
35
48
|
}
|
|
36
49
|
return streamList;
|
|
37
50
|
}
|
|
38
51
|
async getStream(streamId, options) {
|
|
39
52
|
const res = await this._getJson(`${BASE_PATH}/stream/get.cgi`, { stream_id: streamId }, options);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const { streamDelay, startTime, stopTime, ...rest } = params;
|
|
49
|
-
await this._getJson(`${BASE_PATH}/stream/set.cgi`, {
|
|
50
|
-
stream_id: streamId,
|
|
51
|
-
streamDelay: streamDelay ?? '',
|
|
52
|
-
startTime: startTime ?? null,
|
|
53
|
-
stopTime: stopTime ?? null,
|
|
54
|
-
...rest,
|
|
55
|
-
}, options);
|
|
53
|
+
try {
|
|
54
|
+
return streamSchema.parse(res.data);
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
const oldStream = oldStringStreamSchema.parse(res.data);
|
|
58
|
+
const parsedOldStream = parseCameraStreamResponse(oldStream);
|
|
59
|
+
throw new MigrationError({}, { [streamId]: parsedOldStream });
|
|
60
|
+
}
|
|
56
61
|
}
|
|
57
|
-
async
|
|
58
|
-
|
|
62
|
+
async setStream(streamId, streamData, options) {
|
|
63
|
+
const agent = this.getClient(options?.proxyParams);
|
|
64
|
+
await agent.post({
|
|
65
|
+
path: `${BASE_PATH}/stream/set.cgi`,
|
|
66
|
+
data: streamData,
|
|
67
|
+
parameters: {
|
|
68
|
+
stream_id: streamId,
|
|
69
|
+
},
|
|
70
|
+
timeout: options?.timeout,
|
|
71
|
+
});
|
|
59
72
|
}
|
|
60
73
|
async isStreaming(streamId, options) {
|
|
61
74
|
const res = await this._getJson(`${BASE_PATH}/get_streamstat.cgi`, { stream_id: streamId }, options);
|
package/esm/errors/errors.js
CHANGED
|
@@ -174,3 +174,13 @@ export class BadRequestError extends ErrorWithResponse {
|
|
|
174
174
|
this.name = 'BadRequestError';
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
+
export class MigrationError extends Error {
|
|
178
|
+
valid;
|
|
179
|
+
invalid;
|
|
180
|
+
constructor(valid, invalid) {
|
|
181
|
+
super('Migration to newer version is needed: some stream entries failed to parse.');
|
|
182
|
+
this.name = 'MigrationError';
|
|
183
|
+
this.valid = valid;
|
|
184
|
+
this.invalid = invalid;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { facebookSchema } from './facebookSchema';
|
|
3
|
+
import { hlsSchema } from './hlsSchema';
|
|
4
|
+
import { mpegDvbSchema } from './mpegDvbSchema';
|
|
5
|
+
import { rtmpSchema } from './rtmpSchema';
|
|
6
|
+
import { sdCardSchema } from './sdCardSchema';
|
|
7
|
+
import { windySchema } from './windySchema';
|
|
8
|
+
import { youtubeSchema } from './youtubeSchema';
|
|
9
|
+
export const streamSchema = z.discriminatedUnion('type', [
|
|
10
|
+
facebookSchema,
|
|
11
|
+
hlsSchema,
|
|
12
|
+
mpegDvbSchema,
|
|
13
|
+
rtmpSchema,
|
|
14
|
+
sdCardSchema,
|
|
15
|
+
windySchema,
|
|
16
|
+
youtubeSchema,
|
|
17
|
+
]);
|
|
18
|
+
export const isFacebookStream = (stream) => {
|
|
19
|
+
return stream.type === 'facebook';
|
|
20
|
+
};
|
|
21
|
+
export const isHlsStream = (stream) => {
|
|
22
|
+
return stream.type === 'hls';
|
|
23
|
+
};
|
|
24
|
+
export const isMpegDvbStream = (stream) => {
|
|
25
|
+
return stream.type === 'mpeg_dvb';
|
|
26
|
+
};
|
|
27
|
+
export const isRtmpStream = (stream) => {
|
|
28
|
+
return stream.type === 'rtmp';
|
|
29
|
+
};
|
|
30
|
+
export const isSdCardStream = (stream) => {
|
|
31
|
+
return stream.type === 'sd_card';
|
|
32
|
+
};
|
|
33
|
+
export const isWindyStream = (stream) => {
|
|
34
|
+
return stream.type === 'windy';
|
|
35
|
+
};
|
|
36
|
+
export const isYouTubeStream = (stream) => {
|
|
37
|
+
return stream.type === 'youtube';
|
|
38
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './CamStreamerAPI';
|
|
2
|
+
export * from './streamCommonTypes';
|
|
3
|
+
export * from './facebookSchema';
|
|
4
|
+
export * from './hlsSchema';
|
|
5
|
+
export * from './mpegDvbSchema';
|
|
6
|
+
export * from './rtmpSchema';
|
|
7
|
+
export * from './sdCardSchema';
|
|
8
|
+
export * from './windySchema';
|
|
9
|
+
export * from './youtubeSchema';
|