camstreamerlib 4.0.0-beta.5 → 4.0.0-beta.7
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/CamSwitcherAPI.d.ts +5 -1
- package/cjs/CamSwitcherAPI.js +4 -2
- package/cjs/VapixAPI.js +2 -2
- package/cjs/types/CamSwitcherEvents.d.ts +77 -0
- package/cjs/types/CamSwitcherEvents.js +8 -0
- package/cjs/types/VapixAPI.d.ts +394 -302
- package/cjs/types/VapixAPI.js +5 -2
- package/esm/CamSwitcherAPI.d.ts +5 -1
- package/esm/CamSwitcherAPI.js +4 -2
- package/esm/VapixAPI.js +2 -2
- package/esm/types/CamSwitcherEvents.d.ts +77 -0
- package/esm/types/CamSwitcherEvents.js +8 -0
- package/esm/types/VapixAPI.d.ts +394 -302
- package/esm/types/VapixAPI.js +5 -2
- package/package.json +1 -1
package/cjs/CamSwitcherAPI.d.ts
CHANGED
|
@@ -3,8 +3,12 @@ import { TAudioPushInfo, TOutputInfo, TStorageInfo, TStreamSaveList, TClipList,
|
|
|
3
3
|
import { TAudioChannel, TNetworkCamera, TStorageType } from './types/common';
|
|
4
4
|
export declare class CamSwitcherAPI<Client extends IClient = IClient> {
|
|
5
5
|
client: Client;
|
|
6
|
+
private CustomFormData;
|
|
6
7
|
private vapixAgent;
|
|
7
|
-
constructor(client: Client
|
|
8
|
+
constructor(client: Client, CustomFormData?: {
|
|
9
|
+
new (form?: HTMLFormElement | undefined, submitter?: HTMLElement | null | undefined): FormData;
|
|
10
|
+
prototype: FormData;
|
|
11
|
+
});
|
|
8
12
|
static getProxyUrlPath: () => string;
|
|
9
13
|
static getWsEventsUrlPath: () => string;
|
|
10
14
|
static getClipPreviewUrlPath: (id: string, storage: TStorageType) => string;
|
package/cjs/CamSwitcherAPI.js
CHANGED
|
@@ -13,9 +13,11 @@ const constants_1 = require("./internal/constants");
|
|
|
13
13
|
const baseUrl = '/local/camswitcher/api';
|
|
14
14
|
class CamSwitcherAPI {
|
|
15
15
|
client;
|
|
16
|
+
CustomFormData;
|
|
16
17
|
vapixAgent;
|
|
17
|
-
constructor(client) {
|
|
18
|
+
constructor(client, CustomFormData = FormData) {
|
|
18
19
|
this.client = client;
|
|
20
|
+
this.CustomFormData = CustomFormData;
|
|
19
21
|
this.vapixAgent = new VapixAPI_1.VapixAPI(client, () => '');
|
|
20
22
|
}
|
|
21
23
|
static getProxyUrlPath = () => `${baseUrl}/proxy.cgi`;
|
|
@@ -102,7 +104,7 @@ class CamSwitcherAPI {
|
|
|
102
104
|
await this.get(`${baseUrl}/playlist_queue_play_next.cgi`);
|
|
103
105
|
}
|
|
104
106
|
async addNewClip(file, clipType, storage, id, fileName) {
|
|
105
|
-
const formData = new
|
|
107
|
+
const formData = new this.CustomFormData();
|
|
106
108
|
formData.append('clip_name', id);
|
|
107
109
|
formData.append('clip_type', clipType);
|
|
108
110
|
formData.append('file', file, fileName);
|
package/cjs/VapixAPI.js
CHANGED
|
@@ -180,7 +180,7 @@ class VapixAPI {
|
|
|
180
180
|
const data = { apiVersion: '1.0', method: 'getDevicesSettings' };
|
|
181
181
|
const res = await this.postJson(proxy, '/axis-cgi/audiodevicecontrol.cgi', data);
|
|
182
182
|
const result = VapixAPI_1.audioDeviceRequestSchema.parse(await res.json());
|
|
183
|
-
return result.devices.map((device) => ({
|
|
183
|
+
return result.data.devices.map((device) => ({
|
|
184
184
|
...device,
|
|
185
185
|
inputs: (device.inputs || []).sort((a, b) => a.id.localeCompare(b.id)),
|
|
186
186
|
outputs: (device.outputs || []).sort((a, b) => a.id.localeCompare(b.id)),
|
|
@@ -403,7 +403,7 @@ const parseParameters = (response) => {
|
|
|
403
403
|
}
|
|
404
404
|
const delimiterPos = line.indexOf('=');
|
|
405
405
|
if (delimiterPos !== -1) {
|
|
406
|
-
const paramName = line.substring(0, delimiterPos);
|
|
406
|
+
const paramName = line.substring(0, delimiterPos).replace('root.', '');
|
|
407
407
|
const paramValue = line.substring(delimiterPos + 1);
|
|
408
408
|
params[paramName] = paramValue;
|
|
409
409
|
}
|
|
@@ -44,6 +44,27 @@ declare const cswEventsDataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
|
|
|
44
44
|
master_audio: boolean;
|
|
45
45
|
stream_name?: string | undefined;
|
|
46
46
|
clip_name?: string | undefined;
|
|
47
|
+
}>, z.ZodObject<{
|
|
48
|
+
type: z.ZodLiteral<"StreamSwitchVideoError">;
|
|
49
|
+
playlist_name: z.ZodString;
|
|
50
|
+
playlist_active_stream: z.ZodNumber;
|
|
51
|
+
stream_name: z.ZodOptional<z.ZodString>;
|
|
52
|
+
clip_name: z.ZodOptional<z.ZodString>;
|
|
53
|
+
info: z.ZodString;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
type: "StreamSwitchVideoError";
|
|
56
|
+
playlist_name: string;
|
|
57
|
+
playlist_active_stream: number;
|
|
58
|
+
info: string;
|
|
59
|
+
stream_name?: string | undefined;
|
|
60
|
+
clip_name?: string | undefined;
|
|
61
|
+
}, {
|
|
62
|
+
type: "StreamSwitchVideoError";
|
|
63
|
+
playlist_name: string;
|
|
64
|
+
playlist_active_stream: number;
|
|
65
|
+
info: string;
|
|
66
|
+
stream_name?: string | undefined;
|
|
67
|
+
clip_name?: string | undefined;
|
|
47
68
|
}>, z.ZodObject<{
|
|
48
69
|
type: z.ZodLiteral<"StreamSwitchAudioError">;
|
|
49
70
|
stream_name: z.ZodOptional<z.ZodString>;
|
|
@@ -176,6 +197,27 @@ export declare const cswEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
176
197
|
master_audio: boolean;
|
|
177
198
|
stream_name?: string | undefined;
|
|
178
199
|
clip_name?: string | undefined;
|
|
200
|
+
}>, z.ZodObject<{
|
|
201
|
+
type: z.ZodLiteral<"StreamSwitchVideoError">;
|
|
202
|
+
playlist_name: z.ZodString;
|
|
203
|
+
playlist_active_stream: z.ZodNumber;
|
|
204
|
+
stream_name: z.ZodOptional<z.ZodString>;
|
|
205
|
+
clip_name: z.ZodOptional<z.ZodString>;
|
|
206
|
+
info: z.ZodString;
|
|
207
|
+
}, "strip", z.ZodTypeAny, {
|
|
208
|
+
type: "StreamSwitchVideoError";
|
|
209
|
+
playlist_name: string;
|
|
210
|
+
playlist_active_stream: number;
|
|
211
|
+
info: string;
|
|
212
|
+
stream_name?: string | undefined;
|
|
213
|
+
clip_name?: string | undefined;
|
|
214
|
+
}, {
|
|
215
|
+
type: "StreamSwitchVideoError";
|
|
216
|
+
playlist_name: string;
|
|
217
|
+
playlist_active_stream: number;
|
|
218
|
+
info: string;
|
|
219
|
+
stream_name?: string | undefined;
|
|
220
|
+
clip_name?: string | undefined;
|
|
179
221
|
}>, z.ZodObject<{
|
|
180
222
|
type: z.ZodLiteral<"StreamSwitchAudioError">;
|
|
181
223
|
stream_name: z.ZodOptional<z.ZodString>;
|
|
@@ -278,6 +320,13 @@ export declare const cswEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
278
320
|
master_audio: boolean;
|
|
279
321
|
stream_name?: string | undefined;
|
|
280
322
|
clip_name?: string | undefined;
|
|
323
|
+
} | {
|
|
324
|
+
type: "StreamSwitchVideoError";
|
|
325
|
+
playlist_name: string;
|
|
326
|
+
playlist_active_stream: number;
|
|
327
|
+
info: string;
|
|
328
|
+
stream_name?: string | undefined;
|
|
329
|
+
clip_name?: string | undefined;
|
|
281
330
|
} | {
|
|
282
331
|
type: "StreamSwitchAudioError";
|
|
283
332
|
master_audio: boolean;
|
|
@@ -324,6 +373,13 @@ export declare const cswEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
324
373
|
master_audio: boolean;
|
|
325
374
|
stream_name?: string | undefined;
|
|
326
375
|
clip_name?: string | undefined;
|
|
376
|
+
} | {
|
|
377
|
+
type: "StreamSwitchVideoError";
|
|
378
|
+
playlist_name: string;
|
|
379
|
+
playlist_active_stream: number;
|
|
380
|
+
info: string;
|
|
381
|
+
stream_name?: string | undefined;
|
|
382
|
+
clip_name?: string | undefined;
|
|
327
383
|
} | {
|
|
328
384
|
type: "StreamSwitchAudioError";
|
|
329
385
|
master_audio: boolean;
|
|
@@ -398,6 +454,27 @@ export declare const cswEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
398
454
|
master_audio: boolean;
|
|
399
455
|
stream_name?: string | undefined;
|
|
400
456
|
clip_name?: string | undefined;
|
|
457
|
+
}>, z.ZodObject<{
|
|
458
|
+
type: z.ZodLiteral<"StreamSwitchVideoError">;
|
|
459
|
+
playlist_name: z.ZodString;
|
|
460
|
+
playlist_active_stream: z.ZodNumber;
|
|
461
|
+
stream_name: z.ZodOptional<z.ZodString>;
|
|
462
|
+
clip_name: z.ZodOptional<z.ZodString>;
|
|
463
|
+
info: z.ZodString;
|
|
464
|
+
}, "strip", z.ZodTypeAny, {
|
|
465
|
+
type: "StreamSwitchVideoError";
|
|
466
|
+
playlist_name: string;
|
|
467
|
+
playlist_active_stream: number;
|
|
468
|
+
info: string;
|
|
469
|
+
stream_name?: string | undefined;
|
|
470
|
+
clip_name?: string | undefined;
|
|
471
|
+
}, {
|
|
472
|
+
type: "StreamSwitchVideoError";
|
|
473
|
+
playlist_name: string;
|
|
474
|
+
playlist_active_stream: number;
|
|
475
|
+
info: string;
|
|
476
|
+
stream_name?: string | undefined;
|
|
477
|
+
clip_name?: string | undefined;
|
|
401
478
|
}>, z.ZodObject<{
|
|
402
479
|
type: z.ZodLiteral<"StreamSwitchAudioError">;
|
|
403
480
|
stream_name: z.ZodOptional<z.ZodString>;
|
|
@@ -19,6 +19,14 @@ const cswEventsDataSchema = zod_1.z.discriminatedUnion('type', [
|
|
|
19
19
|
clip_name: zod_1.z.string().optional(),
|
|
20
20
|
master_audio: zod_1.z.boolean(),
|
|
21
21
|
}),
|
|
22
|
+
zod_1.z.object({
|
|
23
|
+
type: zod_1.z.literal('StreamSwitchVideoError'),
|
|
24
|
+
playlist_name: zod_1.z.string(),
|
|
25
|
+
playlist_active_stream: zod_1.z.number(),
|
|
26
|
+
stream_name: zod_1.z.string().optional(),
|
|
27
|
+
clip_name: zod_1.z.string().optional(),
|
|
28
|
+
info: zod_1.z.string(),
|
|
29
|
+
}),
|
|
22
30
|
zod_1.z.object({
|
|
23
31
|
type: zod_1.z.literal('StreamSwitchAudioError'),
|
|
24
32
|
stream_name: zod_1.z.string().optional(),
|