camstreamerlib
Version:
Helper library for CamStreamer ACAP applications.
27 lines (26 loc) • 1.31 kB
JavaScript
import { z } from 'zod';
export const booleanSchema = z.union([z.literal(0), z.literal(1)]);
export const audioChannelSchema = z.union([z.literal('mono'), z.literal('stereo')]);
export const audioChannelCountSchema = z.union([z.literal(1), z.literal(2)]);
export const h264ProfileSchema = z.union([z.literal('high'), z.literal('main'), z.literal('baseline')]);
export const flashStorageTypeSchema = z.literal('FLASH');
export const sdCardStorageTypeSchema = z.literal('SD_DISK');
export const storageTypeSchema = z.union([sdCardStorageTypeSchema, flashStorageTypeSchema]);
export const networkCameraListSchema = z.array(z.object({
name: z.string(),
ip: z.string(),
}));
export const keyboardShortcutSchema = z.string().nullable();
export const keyboardShortcutsSchema = z.record(keyboardShortcutSchema);
export const bitrateModeSchema = z.union([z.literal('VBR'), z.literal('MBR'), z.literal('ABR')]);
export const bitrateVapixParamsSchema = z.object({
bitrateMode: bitrateModeSchema,
maximumBitRate: z.number(),
retentionTime: z.number(),
bitRateLimit: z.number(),
});
export const fileSchema = typeof File !== 'undefined'
? z.instanceof(File)
: z.custom((val) => {
return val !== null && typeof val === 'object' && 'name' in val && 'size' in val && 'type' in val;
});