camstreamerlib 4.0.0-beta.102 → 4.0.0-beta.103
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 +6 -6
- package/cjs/CamStreamerAPI.d.ts +270 -305
- package/cjs/CamStreamerAPI.js +12 -2
- package/cjs/CamSwitcherAPI.js +9 -63
- package/cjs/errors/errors.d.ts +4 -3
- package/cjs/errors/errors.js +3 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +1 -0
- package/cjs/internal/constants.d.ts +1 -0
- package/cjs/internal/constants.js +2 -1
- package/cjs/internal/convertors.d.ts +6 -0
- package/cjs/internal/convertors.js +115 -0
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.d.ts +21 -21
- package/cjs/types/CamOverlayAPI/customGraphicsSchema.d.ts +2 -2
- package/cjs/types/CamOverlayAPI/ptzCompassSchema.d.ts +4 -4
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.d.ts +1501 -1976
- package/cjs/types/CamStreamerAPI/churchSchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/daCastSchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/dailymotionSchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/facebookSchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/gameChangerSchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/hlsPullSchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/hlsPushSchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/ibmSchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/microsoftAzureSchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/microsoftStreamSchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/mpegDvbSchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/oldStreamSchema.d.ts +12 -12
- package/cjs/types/CamStreamerAPI/rtmpSchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/rtmpSchema.js +1 -1
- package/cjs/types/CamStreamerAPI/sdCardSchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/srtSchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/streamCommonTypes.d.ts +88 -56
- package/cjs/types/CamStreamerAPI/streamCommonTypes.js +44 -9
- package/cjs/types/CamStreamerAPI/twitchSchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/vimeoSchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/windySchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/wowzaSchema.d.ts +27 -38
- package/cjs/types/CamStreamerAPI/youtubeSchema.d.ts +27 -38
- package/cjs/types/CamSwitcherAPI.d.ts +8 -27
- package/cjs/types/CamSwitcherAPI.js +2 -9
- package/cjs/types/common.d.ts +19 -0
- package/cjs/types/common.js +8 -1
- package/cjs/types/ws/CamStreamerEvents.d.ts +44 -0
- package/cjs/types/ws/CamStreamerEvents.js +5 -0
- package/esm/CamStreamerAPI.js +12 -2
- package/esm/CamSwitcherAPI.js +8 -62
- package/esm/errors/errors.js +3 -1
- package/esm/index.js +1 -0
- package/esm/internal/constants.js +1 -0
- package/esm/internal/convertors.js +108 -0
- package/esm/types/CamStreamerAPI/rtmpSchema.js +1 -1
- package/esm/types/CamStreamerAPI/streamCommonTypes.js +44 -9
- package/esm/types/CamSwitcherAPI.js +1 -8
- package/esm/types/common.js +7 -0
- package/esm/types/ws/CamStreamerEvents.js +5 -0
- package/package.json +1 -1
- package/types/CamOverlayAPI.d.ts +6 -6
- package/types/CamStreamerAPI.d.ts +270 -305
- package/types/errors/errors.d.ts +4 -3
- package/types/index.d.ts +1 -0
- package/types/internal/constants.d.ts +1 -0
- package/types/internal/convertors.d.ts +6 -0
- package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +21 -21
- package/types/types/CamOverlayAPI/customGraphicsSchema.d.ts +2 -2
- package/types/types/CamOverlayAPI/ptzCompassSchema.d.ts +4 -4
- package/types/types/CamStreamerAPI/CamStreamerAPI.d.ts +1501 -1976
- package/types/types/CamStreamerAPI/churchSchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/daCastSchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/dailymotionSchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/facebookSchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/gameChangerSchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/hlsPullSchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/hlsPushSchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/ibmSchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/microsoftAzureSchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/microsoftStreamSchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/mpegDvbSchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/oldStreamSchema.d.ts +12 -12
- package/types/types/CamStreamerAPI/rtmpSchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/sdCardSchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/srtSchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/streamCommonTypes.d.ts +88 -56
- package/types/types/CamStreamerAPI/twitchSchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/vimeoSchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/windySchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/wowzaSchema.d.ts +27 -38
- package/types/types/CamStreamerAPI/youtubeSchema.d.ts +27 -38
- package/types/types/CamSwitcherAPI.d.ts +8 -27
- package/types/types/common.d.ts +19 -0
- package/types/types/ws/CamStreamerEvents.d.ts +44 -0
|
@@ -98,30 +98,21 @@ export declare const wowzaSchema: z.ZodObject<{
|
|
|
98
98
|
}[];
|
|
99
99
|
}>]>;
|
|
100
100
|
inputType: z.ZodUnion<[z.ZodLiteral<"CSw">, z.ZodLiteral<"CRS">, z.ZodLiteral<"RTSP_URL">]>;
|
|
101
|
-
internalVapixParameters: z.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
audio: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
|
|
101
|
+
internalVapixParameters: z.ZodString;
|
|
102
|
+
userVapixParameters: z.ZodString;
|
|
103
|
+
streamingProtocol: z.ZodUnion<[z.ZodLiteral<"RTSP">, z.ZodLiteral<"RTMP">, z.ZodLiteral<"RTMPS">, z.ZodLiteral<"HLS">]>;
|
|
104
|
+
streamDelay: z.ZodObject<{
|
|
105
|
+
enabled: z.ZodBoolean;
|
|
106
|
+
timeS: z.ZodNumber;
|
|
107
|
+
unit: z.ZodUnion<[z.ZodLiteral<"seconds">, z.ZodLiteral<"minutes">, z.ZodLiteral<"hours">]>;
|
|
109
108
|
}, "strip", z.ZodTypeAny, {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
audio?: 0 | 1 | undefined;
|
|
114
|
-
fps?: number | undefined;
|
|
115
|
-
videobitrate?: number | undefined;
|
|
116
|
-
videomaxbitrate?: number | undefined;
|
|
109
|
+
enabled: boolean;
|
|
110
|
+
timeS: number;
|
|
111
|
+
unit: "seconds" | "minutes" | "hours";
|
|
117
112
|
}, {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
audio?: 0 | 1 | undefined;
|
|
122
|
-
fps?: number | undefined;
|
|
123
|
-
videobitrate?: number | undefined;
|
|
124
|
-
videomaxbitrate?: number | undefined;
|
|
113
|
+
enabled: boolean;
|
|
114
|
+
timeS: number;
|
|
115
|
+
unit: "seconds" | "minutes" | "hours";
|
|
125
116
|
}>;
|
|
126
117
|
audio: z.ZodDiscriminatedUnion<"source", [z.ZodObject<{
|
|
127
118
|
source: z.ZodLiteral<"none">;
|
|
@@ -211,14 +202,13 @@ export declare const wowzaSchema: z.ZodObject<{
|
|
|
211
202
|
}[];
|
|
212
203
|
};
|
|
213
204
|
inputType: "RTSP_URL" | "CSw" | "CRS";
|
|
214
|
-
internalVapixParameters:
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
videomaxbitrate?: number | undefined;
|
|
205
|
+
internalVapixParameters: string;
|
|
206
|
+
userVapixParameters: string;
|
|
207
|
+
streamingProtocol: "RTSP" | "RTMP" | "RTMPS" | "HLS";
|
|
208
|
+
streamDelay: {
|
|
209
|
+
enabled: boolean;
|
|
210
|
+
timeS: number;
|
|
211
|
+
unit: "seconds" | "minutes" | "hours";
|
|
222
212
|
};
|
|
223
213
|
}, {
|
|
224
214
|
type: "wowza";
|
|
@@ -263,13 +253,12 @@ export declare const wowzaSchema: z.ZodObject<{
|
|
|
263
253
|
}[];
|
|
264
254
|
};
|
|
265
255
|
inputType: "RTSP_URL" | "CSw" | "CRS";
|
|
266
|
-
internalVapixParameters:
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
videomaxbitrate?: number | undefined;
|
|
256
|
+
internalVapixParameters: string;
|
|
257
|
+
userVapixParameters: string;
|
|
258
|
+
streamingProtocol: "RTSP" | "RTMP" | "RTMPS" | "HLS";
|
|
259
|
+
streamDelay: {
|
|
260
|
+
enabled: boolean;
|
|
261
|
+
timeS: number;
|
|
262
|
+
unit: "seconds" | "minutes" | "hours";
|
|
274
263
|
};
|
|
275
264
|
}>;
|
|
@@ -98,30 +98,21 @@ export declare const youtubeSchema: z.ZodObject<{
|
|
|
98
98
|
}[];
|
|
99
99
|
}>]>;
|
|
100
100
|
inputType: z.ZodUnion<[z.ZodLiteral<"CSw">, z.ZodLiteral<"CRS">, z.ZodLiteral<"RTSP_URL">]>;
|
|
101
|
-
internalVapixParameters: z.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
audio: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
|
|
101
|
+
internalVapixParameters: z.ZodString;
|
|
102
|
+
userVapixParameters: z.ZodString;
|
|
103
|
+
streamingProtocol: z.ZodUnion<[z.ZodLiteral<"RTSP">, z.ZodLiteral<"RTMP">, z.ZodLiteral<"RTMPS">, z.ZodLiteral<"HLS">]>;
|
|
104
|
+
streamDelay: z.ZodObject<{
|
|
105
|
+
enabled: z.ZodBoolean;
|
|
106
|
+
timeS: z.ZodNumber;
|
|
107
|
+
unit: z.ZodUnion<[z.ZodLiteral<"seconds">, z.ZodLiteral<"minutes">, z.ZodLiteral<"hours">]>;
|
|
109
108
|
}, "strip", z.ZodTypeAny, {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
audio?: 0 | 1 | undefined;
|
|
114
|
-
fps?: number | undefined;
|
|
115
|
-
videobitrate?: number | undefined;
|
|
116
|
-
videomaxbitrate?: number | undefined;
|
|
109
|
+
enabled: boolean;
|
|
110
|
+
timeS: number;
|
|
111
|
+
unit: "seconds" | "minutes" | "hours";
|
|
117
112
|
}, {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
audio?: 0 | 1 | undefined;
|
|
122
|
-
fps?: number | undefined;
|
|
123
|
-
videobitrate?: number | undefined;
|
|
124
|
-
videomaxbitrate?: number | undefined;
|
|
113
|
+
enabled: boolean;
|
|
114
|
+
timeS: number;
|
|
115
|
+
unit: "seconds" | "minutes" | "hours";
|
|
125
116
|
}>;
|
|
126
117
|
audio: z.ZodDiscriminatedUnion<"source", [z.ZodObject<{
|
|
127
118
|
source: z.ZodLiteral<"none">;
|
|
@@ -225,14 +216,13 @@ export declare const youtubeSchema: z.ZodObject<{
|
|
|
225
216
|
}[];
|
|
226
217
|
};
|
|
227
218
|
inputType: "RTSP_URL" | "CSw" | "CRS";
|
|
228
|
-
internalVapixParameters:
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
videomaxbitrate?: number | undefined;
|
|
219
|
+
internalVapixParameters: string;
|
|
220
|
+
userVapixParameters: string;
|
|
221
|
+
streamingProtocol: "RTSP" | "RTMP" | "RTMPS" | "HLS";
|
|
222
|
+
streamDelay: {
|
|
223
|
+
enabled: boolean;
|
|
224
|
+
timeS: number;
|
|
225
|
+
unit: "seconds" | "minutes" | "hours";
|
|
236
226
|
};
|
|
237
227
|
statusCameraLed: boolean;
|
|
238
228
|
statusCameraOutput: string;
|
|
@@ -291,14 +281,13 @@ export declare const youtubeSchema: z.ZodObject<{
|
|
|
291
281
|
}[];
|
|
292
282
|
};
|
|
293
283
|
inputType: "RTSP_URL" | "CSw" | "CRS";
|
|
294
|
-
internalVapixParameters:
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
videomaxbitrate?: number | undefined;
|
|
284
|
+
internalVapixParameters: string;
|
|
285
|
+
userVapixParameters: string;
|
|
286
|
+
streamingProtocol: "RTSP" | "RTMP" | "RTMPS" | "HLS";
|
|
287
|
+
streamDelay: {
|
|
288
|
+
enabled: boolean;
|
|
289
|
+
timeS: number;
|
|
290
|
+
unit: "seconds" | "minutes" | "hours";
|
|
302
291
|
};
|
|
303
292
|
statusCameraLed: boolean;
|
|
304
293
|
statusCameraOutput: string;
|
|
@@ -772,25 +772,6 @@ export declare const clipListSchema: z.ZodObject<{
|
|
|
772
772
|
}>;
|
|
773
773
|
}>;
|
|
774
774
|
export type TClipList = z.infer<typeof clipListSchema>['clip_list'];
|
|
775
|
-
export declare const bitrateModeSchema: z.ZodUnion<[z.ZodLiteral<"VBR">, z.ZodLiteral<"MBR">, z.ZodLiteral<"ABR">]>;
|
|
776
|
-
export type TBitrateMode = z.infer<typeof bitrateModeSchema>;
|
|
777
|
-
export declare const bitrateVapixParamsSchema: z.ZodObject<{
|
|
778
|
-
bitrateMode: z.ZodUnion<[z.ZodLiteral<"VBR">, z.ZodLiteral<"MBR">, z.ZodLiteral<"ABR">]>;
|
|
779
|
-
maximumBitRate: z.ZodNumber;
|
|
780
|
-
retentionTime: z.ZodNumber;
|
|
781
|
-
bitRateLimit: z.ZodNumber;
|
|
782
|
-
}, "strip", z.ZodTypeAny, {
|
|
783
|
-
bitrateMode: "VBR" | "MBR" | "ABR";
|
|
784
|
-
maximumBitRate: number;
|
|
785
|
-
retentionTime: number;
|
|
786
|
-
bitRateLimit: number;
|
|
787
|
-
}, {
|
|
788
|
-
bitrateMode: "VBR" | "MBR" | "ABR";
|
|
789
|
-
maximumBitRate: number;
|
|
790
|
-
retentionTime: number;
|
|
791
|
-
bitRateLimit: number;
|
|
792
|
-
}>;
|
|
793
|
-
export type TBitrateVapixParams = z.infer<typeof bitrateVapixParamsSchema>;
|
|
794
775
|
export declare const cameraOptionsSchema: z.ZodObject<{
|
|
795
776
|
bitrateMode: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"VBR">, z.ZodLiteral<"MBR">, z.ZodLiteral<"ABR">]>>;
|
|
796
777
|
maximumBitRate: z.ZodOptional<z.ZodNumber>;
|
|
@@ -817,15 +798,15 @@ export declare const cameraOptionsSchema: z.ZodObject<{
|
|
|
817
798
|
}, "strip", z.ZodTypeAny, {
|
|
818
799
|
resolution?: string | undefined;
|
|
819
800
|
compression?: number | undefined;
|
|
801
|
+
bitrateMode?: "VBR" | "MBR" | "ABR" | undefined;
|
|
802
|
+
maximumBitRate?: number | undefined;
|
|
803
|
+
retentionTime?: number | undefined;
|
|
804
|
+
bitRateLimit?: number | undefined;
|
|
820
805
|
keyboard?: {
|
|
821
806
|
fromSource: string | null;
|
|
822
807
|
none: string | null;
|
|
823
808
|
} | undefined;
|
|
824
809
|
fps?: number | undefined;
|
|
825
|
-
bitrateMode?: "VBR" | "MBR" | "ABR" | undefined;
|
|
826
|
-
maximumBitRate?: number | undefined;
|
|
827
|
-
retentionTime?: number | undefined;
|
|
828
|
-
bitRateLimit?: number | undefined;
|
|
829
810
|
h264Profile?: "high" | "main" | "baseline" | undefined;
|
|
830
811
|
govLength?: number | undefined;
|
|
831
812
|
bitrateVapixParams?: string | null | undefined;
|
|
@@ -834,15 +815,15 @@ export declare const cameraOptionsSchema: z.ZodObject<{
|
|
|
834
815
|
}, {
|
|
835
816
|
resolution?: string | undefined;
|
|
836
817
|
compression?: number | undefined;
|
|
818
|
+
bitrateMode?: "VBR" | "MBR" | "ABR" | undefined;
|
|
819
|
+
maximumBitRate?: number | undefined;
|
|
820
|
+
retentionTime?: number | undefined;
|
|
821
|
+
bitRateLimit?: number | undefined;
|
|
837
822
|
keyboard?: {
|
|
838
823
|
fromSource: string | null;
|
|
839
824
|
none: string | null;
|
|
840
825
|
} | undefined;
|
|
841
826
|
fps?: number | undefined;
|
|
842
|
-
bitrateMode?: "VBR" | "MBR" | "ABR" | undefined;
|
|
843
|
-
maximumBitRate?: number | undefined;
|
|
844
|
-
retentionTime?: number | undefined;
|
|
845
|
-
bitRateLimit?: number | undefined;
|
|
846
827
|
h264Profile?: "high" | "main" | "baseline" | undefined;
|
|
847
828
|
govLength?: number | undefined;
|
|
848
829
|
bitrateVapixParams?: string | null | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.secondaryAudioSettingsSchema = exports.globalAudioSettingsSchema = exports.globalAudioSettingsTypeSchema = exports.cameraOptionsSchema = exports.
|
|
3
|
+
exports.secondaryAudioSettingsSchema = exports.globalAudioSettingsSchema = exports.globalAudioSettingsTypeSchema = exports.cameraOptionsSchema = exports.clipListSchema = exports.playlistQueueSchema = exports.trackerSaveLoadSchema = exports.trackerSaveSchema = exports.playlistSaveLoadSchema = exports.clipSaveLoadSchema = exports.clipSaveSchema = exports.streamSaveLoadSchema = exports.audioPushInfoSchema = exports.outputInfoSchema = exports.storageInfoListSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const transformers_1 = require("../internal/transformers");
|
|
6
6
|
const common_1 = require("./common");
|
|
@@ -135,14 +135,7 @@ exports.clipListSchema = zod_1.z.object({
|
|
|
135
135
|
])),
|
|
136
136
|
})),
|
|
137
137
|
});
|
|
138
|
-
exports.
|
|
139
|
-
exports.bitrateVapixParamsSchema = zod_1.z.object({
|
|
140
|
-
bitrateMode: exports.bitrateModeSchema,
|
|
141
|
-
maximumBitRate: zod_1.z.number(),
|
|
142
|
-
retentionTime: zod_1.z.number(),
|
|
143
|
-
bitRateLimit: zod_1.z.number(),
|
|
144
|
-
});
|
|
145
|
-
exports.cameraOptionsSchema = exports.bitrateVapixParamsSchema
|
|
138
|
+
exports.cameraOptionsSchema = common_1.bitrateVapixParamsSchema
|
|
146
139
|
.extend({
|
|
147
140
|
resolution: zod_1.z.string(),
|
|
148
141
|
h264Profile: common_1.h264ProfileSchema,
|
package/cjs/types/common.d.ts
CHANGED
|
@@ -48,3 +48,22 @@ export type TCameraImageConfig = {
|
|
|
48
48
|
overlays?: string;
|
|
49
49
|
[key: string]: string | number | undefined;
|
|
50
50
|
};
|
|
51
|
+
export declare const bitrateModeSchema: z.ZodUnion<[z.ZodLiteral<"VBR">, z.ZodLiteral<"MBR">, z.ZodLiteral<"ABR">]>;
|
|
52
|
+
export type TBitrateMode = z.infer<typeof bitrateModeSchema>;
|
|
53
|
+
export declare const bitrateVapixParamsSchema: z.ZodObject<{
|
|
54
|
+
bitrateMode: z.ZodUnion<[z.ZodLiteral<"VBR">, z.ZodLiteral<"MBR">, z.ZodLiteral<"ABR">]>;
|
|
55
|
+
maximumBitRate: z.ZodNumber;
|
|
56
|
+
retentionTime: z.ZodNumber;
|
|
57
|
+
bitRateLimit: z.ZodNumber;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
bitrateMode: "VBR" | "MBR" | "ABR";
|
|
60
|
+
maximumBitRate: number;
|
|
61
|
+
retentionTime: number;
|
|
62
|
+
bitRateLimit: number;
|
|
63
|
+
}, {
|
|
64
|
+
bitrateMode: "VBR" | "MBR" | "ABR";
|
|
65
|
+
maximumBitRate: number;
|
|
66
|
+
retentionTime: number;
|
|
67
|
+
bitRateLimit: number;
|
|
68
|
+
}>;
|
|
69
|
+
export type TBitrateVapixParams = z.infer<typeof bitrateVapixParamsSchema>;
|
package/cjs/types/common.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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 = exports.booleanSchema = void 0;
|
|
3
|
+
exports.bitrateVapixParamsSchema = exports.bitrateModeSchema = 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
5
|
exports.booleanSchema = zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]);
|
|
6
6
|
exports.audioChannelSchema = zod_1.z.union([zod_1.z.literal('mono'), zod_1.z.literal('stereo')]);
|
|
@@ -15,3 +15,10 @@ exports.networkCameraListSchema = zod_1.z.array(zod_1.z.object({
|
|
|
15
15
|
}));
|
|
16
16
|
exports.keyboardShortcutSchema = zod_1.z.string().nullable();
|
|
17
17
|
exports.keyboardShortcutsSchema = zod_1.z.record(exports.keyboardShortcutSchema);
|
|
18
|
+
exports.bitrateModeSchema = zod_1.z.union([zod_1.z.literal('VBR'), zod_1.z.literal('MBR'), zod_1.z.literal('ABR')]);
|
|
19
|
+
exports.bitrateVapixParamsSchema = zod_1.z.object({
|
|
20
|
+
bitrateMode: exports.bitrateModeSchema,
|
|
21
|
+
maximumBitRate: zod_1.z.number(),
|
|
22
|
+
retentionTime: zod_1.z.number(),
|
|
23
|
+
bitRateLimit: zod_1.z.number(),
|
|
24
|
+
});
|
|
@@ -59,6 +59,18 @@ declare const csEventsDataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
59
59
|
type: "CS_API_ERROR";
|
|
60
60
|
streamID: number;
|
|
61
61
|
apiCall: string;
|
|
62
|
+
}>, z.ZodObject<{
|
|
63
|
+
type: z.ZodLiteral<"PortChanged">;
|
|
64
|
+
port: z.ZodNumber;
|
|
65
|
+
value: z.ZodBoolean;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
value: boolean;
|
|
68
|
+
type: "PortChanged";
|
|
69
|
+
port: number;
|
|
70
|
+
}, {
|
|
71
|
+
value: boolean;
|
|
72
|
+
type: "PortChanged";
|
|
73
|
+
port: number;
|
|
62
74
|
}>]>;
|
|
63
75
|
export declare const csEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
64
76
|
type: z.ZodLiteral<"init">;
|
|
@@ -122,6 +134,18 @@ export declare const csEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObjec
|
|
|
122
134
|
type: "CS_API_ERROR";
|
|
123
135
|
streamID: number;
|
|
124
136
|
apiCall: string;
|
|
137
|
+
}>, z.ZodObject<{
|
|
138
|
+
type: z.ZodLiteral<"PortChanged">;
|
|
139
|
+
port: z.ZodNumber;
|
|
140
|
+
value: z.ZodBoolean;
|
|
141
|
+
}, "strip", z.ZodTypeAny, {
|
|
142
|
+
value: boolean;
|
|
143
|
+
type: "PortChanged";
|
|
144
|
+
port: number;
|
|
145
|
+
}, {
|
|
146
|
+
value: boolean;
|
|
147
|
+
type: "PortChanged";
|
|
148
|
+
port: number;
|
|
125
149
|
}>]>;
|
|
126
150
|
}, "strip", z.ZodTypeAny, {
|
|
127
151
|
type: "init";
|
|
@@ -145,6 +169,10 @@ export declare const csEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObjec
|
|
|
145
169
|
type: "CS_API_ERROR";
|
|
146
170
|
streamID: number;
|
|
147
171
|
apiCall: string;
|
|
172
|
+
} | {
|
|
173
|
+
value: boolean;
|
|
174
|
+
type: "PortChanged";
|
|
175
|
+
port: number;
|
|
148
176
|
};
|
|
149
177
|
}, {
|
|
150
178
|
type: "init";
|
|
@@ -168,6 +196,10 @@ export declare const csEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObjec
|
|
|
168
196
|
type: "CS_API_ERROR";
|
|
169
197
|
streamID: number;
|
|
170
198
|
apiCall: string;
|
|
199
|
+
} | {
|
|
200
|
+
value: boolean;
|
|
201
|
+
type: "PortChanged";
|
|
202
|
+
port: number;
|
|
171
203
|
};
|
|
172
204
|
}>, z.ZodObject<{
|
|
173
205
|
type: z.ZodLiteral<"authorization">;
|
|
@@ -229,6 +261,18 @@ export declare const csEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObjec
|
|
|
229
261
|
type: "CS_API_ERROR";
|
|
230
262
|
streamID: number;
|
|
231
263
|
apiCall: string;
|
|
264
|
+
}>, z.ZodObject<{
|
|
265
|
+
type: z.ZodLiteral<"PortChanged">;
|
|
266
|
+
port: z.ZodNumber;
|
|
267
|
+
value: z.ZodBoolean;
|
|
268
|
+
}, "strip", z.ZodTypeAny, {
|
|
269
|
+
value: boolean;
|
|
270
|
+
type: "PortChanged";
|
|
271
|
+
port: number;
|
|
272
|
+
}, {
|
|
273
|
+
value: boolean;
|
|
274
|
+
type: "PortChanged";
|
|
275
|
+
port: number;
|
|
232
276
|
}>]>;
|
|
233
277
|
export type TCamStreamerEvent = z.infer<typeof csEventsDataSchema>;
|
|
234
278
|
export type TCamStreamerEventType = TCamStreamerEvent['type'];
|
|
@@ -24,6 +24,11 @@ const csEventsDataSchema = zod_1.z.discriminatedUnion('type', [
|
|
|
24
24
|
streamID: zod_1.z.number(),
|
|
25
25
|
code: zod_1.z.string(),
|
|
26
26
|
}),
|
|
27
|
+
zod_1.z.object({
|
|
28
|
+
type: zod_1.z.literal('PortChanged'),
|
|
29
|
+
port: zod_1.z.number(),
|
|
30
|
+
value: zod_1.z.boolean(),
|
|
31
|
+
}),
|
|
27
32
|
]);
|
|
28
33
|
exports.csEventsSchema = zod_1.z.discriminatedUnion('type', [
|
|
29
34
|
zod_1.z.object({ type: zod_1.z.literal('init'), data: csEventsDataSchema }),
|
package/esm/CamStreamerAPI.js
CHANGED
|
@@ -29,6 +29,9 @@ export class CamStreamerAPI {
|
|
|
29
29
|
}
|
|
30
30
|
return z.number().parse(res.data);
|
|
31
31
|
}
|
|
32
|
+
async getMaxFps(source = 0, options) {
|
|
33
|
+
return await this._getJson(`${BASE_PATH}/get_max_framerate.cgi`, { video_source: source.toString() }, options);
|
|
34
|
+
}
|
|
32
35
|
async getStreamList(options) {
|
|
33
36
|
const res = await this._getJson(`${BASE_PATH}/stream_list.cgi`, { action: 'get' }, options);
|
|
34
37
|
const oldStreamListRecord = z.record(z.string(), oldStringStreamSchema).safeParse(res.data);
|
|
@@ -41,6 +44,7 @@ export class CamStreamerAPI {
|
|
|
41
44
|
}
|
|
42
45
|
const newStreamData = [];
|
|
43
46
|
const oldStreamData = [];
|
|
47
|
+
const invalidStreamData = [];
|
|
44
48
|
for (const streamData of res.data.streamList) {
|
|
45
49
|
const newStreamParse = streamSchema.safeParse(streamData);
|
|
46
50
|
if (newStreamParse.success) {
|
|
@@ -55,10 +59,10 @@ export class CamStreamerAPI {
|
|
|
55
59
|
});
|
|
56
60
|
continue;
|
|
57
61
|
}
|
|
58
|
-
|
|
62
|
+
invalidStreamData.push(streamData);
|
|
59
63
|
}
|
|
60
64
|
if (oldStreamData.length > 0) {
|
|
61
|
-
throw new MigrationError(newStreamData, oldStreamData);
|
|
65
|
+
throw new MigrationError(newStreamData, oldStreamData, invalidStreamData);
|
|
62
66
|
}
|
|
63
67
|
return newStreamData;
|
|
64
68
|
}
|
|
@@ -86,6 +90,12 @@ export class CamStreamerAPI {
|
|
|
86
90
|
const res = await this._getJson(`${BASE_PATH}/get_streamstat.cgi`, { stream_id: streamId }, options);
|
|
87
91
|
return res.data.is_streaming === 1;
|
|
88
92
|
}
|
|
93
|
+
async setStreamEnabled(streamId, enabled, options) {
|
|
94
|
+
await this._postUrlEncoded(`${BASE_PATH}/set_stream_enabled.cgi`, { stream_id: streamId, enabled: enabled ? 1 : 0 }, options);
|
|
95
|
+
}
|
|
96
|
+
async setStreamActive(streamId, active, options) {
|
|
97
|
+
await this._postUrlEncoded(`${BASE_PATH}/set_stream_active.cgi`, { stream_id: streamId, active: active ? 1 : 0 }, options);
|
|
98
|
+
}
|
|
89
99
|
async listFiles(options) {
|
|
90
100
|
const res = await this._getJson(`${BASE_PATH}/upload_audio.cgi`, { action: 'list' }, options);
|
|
91
101
|
return audioFileListSchema.parse(res.data);
|
package/esm/CamSwitcherAPI.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { AddNewClipError, JsonParseError, ParameterNotFoundError, ErrorWithResponse } from './errors/errors';
|
|
3
|
+
import { parseBitrateOptionsToVapixParams, parseVapixParamsToBitrateOptions } from './internal/convertors';
|
|
3
4
|
import { isClip, isNullish } from './internal/utils';
|
|
4
5
|
import { storageInfoListSchema, outputInfoSchema, audioPushInfoSchema, clipListSchema, playlistQueueSchema, streamSaveLoadSchema, clipSaveLoadSchema, playlistSaveLoadSchema, trackerSaveLoadSchema, secondaryAudioSettingsSchema, globalAudioSettingsSchema, } from './types/CamSwitcherAPI';
|
|
5
6
|
import { networkCameraListSchema, } from './types/common';
|
|
6
7
|
import { VapixAPI } from './VapixAPI';
|
|
7
|
-
import { isFirmwareVersionAtLeast } from './internal/versionCompare';
|
|
8
|
-
import { FIRMWARE_WITH_BITRATE_MODES_SUPPORT } from './internal/constants';
|
|
9
8
|
import { ProxyClient } from './internal/ProxyClient';
|
|
10
9
|
const BASE_PATH = '/local/camswitcher/api';
|
|
11
10
|
export class CamSwitcherAPI {
|
|
@@ -136,7 +135,13 @@ export class CamSwitcherAPI {
|
|
|
136
135
|
return clipListSchema.parse(res.data).clip_list;
|
|
137
136
|
}
|
|
138
137
|
setCamSwitchOptions(data, cameraFWVersion, options) {
|
|
139
|
-
const
|
|
138
|
+
const bitrateData = {
|
|
139
|
+
bitrateMode: data.bitrateMode,
|
|
140
|
+
maximumBitRate: data.maximumBitRate,
|
|
141
|
+
retentionTime: data.retentionTime,
|
|
142
|
+
bitRateLimit: data.bitRateLimit,
|
|
143
|
+
};
|
|
144
|
+
const bitrateVapixParams = parseBitrateOptionsToVapixParams(cameraFWVersion, data.bitrateMode, bitrateData);
|
|
140
145
|
const saveData = {
|
|
141
146
|
video: {
|
|
142
147
|
resolution: data.resolution,
|
|
@@ -303,62 +308,3 @@ const CSW_PARAM_NAMES = {
|
|
|
303
308
|
RTSP_TOKEN: 'Camswitcher.RTSPAccessToken',
|
|
304
309
|
DEFAULT_PLAYLIST: 'Camswitcher.DefaultPlaylist',
|
|
305
310
|
};
|
|
306
|
-
const parseBitrateOptionsToBitrateVapixParams = (firmWareVersion, bitrateMode, cameraOptions) => {
|
|
307
|
-
if (!isFirmwareVersionAtLeast(firmWareVersion, FIRMWARE_WITH_BITRATE_MODES_SUPPORT)) {
|
|
308
|
-
return `videomaxbitrate=${cameraOptions.maximumBitRate}`;
|
|
309
|
-
}
|
|
310
|
-
if (bitrateMode === undefined) {
|
|
311
|
-
return '';
|
|
312
|
-
}
|
|
313
|
-
const data = {
|
|
314
|
-
VBR: 'videobitratemode=vbr',
|
|
315
|
-
MBR: `videobitratemode=mbr&videomaxbitrate=${cameraOptions.maximumBitRate}`,
|
|
316
|
-
ABR: `videobitratemode=abr&videoabrtargetbitrate=${cameraOptions.maximumBitRate}&videoabrretentiontime=${cameraOptions.retentionTime}&videoabrmaxbitrate=${cameraOptions.bitRateLimit}`,
|
|
317
|
-
};
|
|
318
|
-
return data[bitrateMode];
|
|
319
|
-
};
|
|
320
|
-
const parseVapixParamsToBitrateOptions = (bitrateVapixParams) => {
|
|
321
|
-
const params = {};
|
|
322
|
-
const searchParams = new URLSearchParams(bitrateVapixParams);
|
|
323
|
-
searchParams.forEach((value, key) => {
|
|
324
|
-
params[key] = value;
|
|
325
|
-
});
|
|
326
|
-
const bitrateMode = params['videobitratemode'] !== undefined ? params['videobitratemode'].toUpperCase() : undefined;
|
|
327
|
-
const hasLowerFw = bitrateMode === undefined && params['videomaxbitrate'] !== undefined;
|
|
328
|
-
if (hasLowerFw) {
|
|
329
|
-
const maximumBitRate = parseInt(params['videomaxbitrate'] ?? '0', 10);
|
|
330
|
-
return {
|
|
331
|
-
bitrateMode: 'MBR',
|
|
332
|
-
maximumBitRate: maximumBitRate,
|
|
333
|
-
retentionTime: 1,
|
|
334
|
-
bitRateLimit: Math.floor(maximumBitRate * 1.1),
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
if (bitrateMode === 'ABR') {
|
|
338
|
-
const maximumBitRate = parseInt(params['videoabrtargetbitrate'] ?? '0', 10);
|
|
339
|
-
const retentionTime = parseInt(params['videoabrretentiontime'] ?? '0', 10);
|
|
340
|
-
const bitRateLimit = parseInt(params['videoabrmaxbitrate'] ?? '0', 10);
|
|
341
|
-
return {
|
|
342
|
-
bitrateMode,
|
|
343
|
-
maximumBitRate,
|
|
344
|
-
retentionTime,
|
|
345
|
-
bitRateLimit,
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
else if (bitrateMode === 'MBR') {
|
|
349
|
-
const maximumBitRate = params['videomaxbitrate'] !== undefined ? parseInt(params['videomaxbitrate'], 10) : null;
|
|
350
|
-
const oldMaximumBitrateParamValue = parseInt(params['videombrmaxbitrate'] ?? '0', 10);
|
|
351
|
-
return {
|
|
352
|
-
bitrateMode: bitrateMode,
|
|
353
|
-
maximumBitRate: maximumBitRate ?? oldMaximumBitrateParamValue,
|
|
354
|
-
retentionTime: 1,
|
|
355
|
-
bitRateLimit: Math.floor(maximumBitRate ?? oldMaximumBitrateParamValue * 1.1),
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
return {
|
|
359
|
-
bitrateMode: bitrateMode,
|
|
360
|
-
retentionTime: 1,
|
|
361
|
-
maximumBitRate: 0,
|
|
362
|
-
bitRateLimit: 0,
|
|
363
|
-
};
|
|
364
|
-
};
|
package/esm/errors/errors.js
CHANGED
|
@@ -176,11 +176,13 @@ export class BadRequestError extends ErrorWithResponse {
|
|
|
176
176
|
}
|
|
177
177
|
export class MigrationError extends Error {
|
|
178
178
|
valid;
|
|
179
|
+
old;
|
|
179
180
|
invalid;
|
|
180
|
-
constructor(valid, invalid) {
|
|
181
|
+
constructor(valid, old, invalid = []) {
|
|
181
182
|
super('Migration to newer version is needed: some stream entries failed to parse.');
|
|
182
183
|
this.name = 'MigrationError';
|
|
183
184
|
this.valid = valid;
|
|
185
|
+
this.old = old;
|
|
184
186
|
this.invalid = invalid;
|
|
185
187
|
}
|
|
186
188
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './errors/errors';
|
|
2
2
|
export * from './internal/types';
|
|
3
3
|
export * from './internal/constants';
|
|
4
|
+
export * from './internal/convertors';
|
|
4
5
|
export * from './internal/utils';
|
|
5
6
|
export * from './internal/versionCompare';
|
|
6
7
|
export * from './internal/ProxyClient';
|