camstreamerlib 4.0.0-beta.162 → 4.0.0-beta.163

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 CHANGED
@@ -1,13 +1,8 @@
1
1
  # CamStreamerLib - BETA
2
2
 
3
- **This is beta version of CamStreamerLib v4, dont use it on production. Is going to be changed significantly.**
3
+ Web and Node.js helper library for CamStreamer ACAP applications.
4
4
 
5
- **The documentation is in progress**
6
-
7
- Node.js helper library for CamStreamer ACAP applications.
8
-
9
- The library is primarily developed for the CamScripter ACAP application running directly in Axis cameras.
10
- Examples of CamScripter packages can be found at https://github.com/CamStreamer/CamScripterApp_examples
5
+ The library is primarily developed for ACAP applications running directly in Axis cameras.
11
6
 
12
7
  ## Installation
13
8
 
@@ -26,7 +21,7 @@ npm install camstreamerlib
26
21
  | [CamSwitcherAPI](doc/CamSwitcherAPI.md) | Module to access CamSwitcher API. |
27
22
  | [PlaneTrackerAPI](doc/PlaneTrackerAPI.md) | Module to access PlaneTracker API. |
28
23
  | [CamStreamerEvents](doc/ws/CamStreamerEvents.md) | Module which allows receiving events from CamStreamer ACAP application. |
29
- | [OverlayEvents](doc/ws/OverlayEvents.md) | Module which allows receiving events from Overlay ACAP application. |
24
+ | [CamOverlayEvents](doc/ws/CamOverlayEvents.md) | Module which allows receiving events from CamOverlay ACAP application. |
30
25
  | [CamSwitcherEvents](doc/ws/CamSwitcherEvents.md) | Module which allows receiving events from CamSwitcher ACAP application. |
31
26
  | [PlaneTrackerEvents](doc/ws/PlaneTrackerEvents.md) | Module which allows receiving events from PlaneTracker ACAP application. |
32
27
 
@@ -56,11 +51,11 @@ npm install camstreamerlib
56
51
 
57
52
  ### ACAP API Class Constructors Updated
58
53
 
59
- All ACAP API classes now **require a client instance to be passed into their constructors** instead of options object.
54
+ All ACAP API classes now **require a client instance to be passed into their constructors** instead of `options` object.
60
55
 
61
56
  - This change improves flexibility by allowing you to use either the Node or Web client, depending on your environment.
62
57
 
63
- Example (before → now):
58
+ **Example (before → now)**:
64
59
 
65
60
  ```typescript
66
61
  // Before
@@ -78,6 +73,12 @@ const coApi = new CamOverlayAPI({
78
73
  import { DefaultClient } from 'camstreamerlib/web';
79
74
  import { CamOverlayAPI } from 'camstreamerlib';
80
75
 
76
+ // Use DefaultClient in constructor
77
+ const coApi = new CamOverlayAPI(
78
+ new DefaultClient()
79
+ );
80
+
81
+ // Or adjust DefaultClient default values with your own
81
82
  const coApi = new CamOverlayAPI(
82
83
  new DefaultClient({
83
84
  tls: false,
@@ -109,17 +110,43 @@ import { Painter } from 'camstreamerlib/node';
109
110
  import { DefaultClient } from 'camstreamerlib/web';
110
111
  ```
111
112
 
112
- > Note: To ensure compatibility, set the module resolution in your projects tsconfig.json to `"moduleResolution": "bundler"`.
113
+ > :information_source: Note: To ensure compatibility, set the module resolution in your web projects tsconfig.json to `"moduleResolution": "bundler"`.
113
114
 
114
- ### Class and Method Refactored
115
+ ### Classes and Methods Refactored
115
116
 
116
117
  - **CameraVapix API** has been renamed to [**VapixAPI**](doc/VapixAPI.md).
117
118
  - **DefaultAgent** has been refactored into two separate classes - one for node, one for web as [**DefaultClient**](doc/Client.md)
118
119
  - Several method names and parameter names across the library have been updated for consistency and clarity.
120
+ - New API modules and endpoints have been introduced, providing extended functionality and better coverage of the underlying service.
119
121
 
120
- > Please refer to [the documentation](#documentation-for-acap-and-camera-api).
122
+ ### Stream List Migration
121
123
 
122
- - New API modules and endpoints have been introduced, providing extended functionality and better coverage of the underlying service.
124
+ - `CamStreamerAPI.getStreamList()` and `getStream()` now throw a **`MigrationError`** when old-format (v3) stream data is detected on the camera.
125
+ - `MigrationError` provides four arrays to help you handle the transition: `.valid`, `.old`, `.invalid`, and `.unknown`.
126
+
127
+ ```typescript
128
+ import { MigrationError } from 'camstreamerlib';
129
+
130
+ try {
131
+ const streams = await csApi.getStreamList();
132
+ } catch (e) {
133
+ if (e instanceof MigrationError) {
134
+ console.log('Valid streams:', e.valid);
135
+ console.log('Old-format streams needing migration:', e.old);
136
+ }
137
+ }
138
+ ```
139
+
140
+ ### CreatePackage Script Path Changed
141
+
142
+ - The path to the `CreatePackage` script changed from `camstreamerlib/CreatePackage.js` to `camstreamerlib/bin/CreatePackage.js`.
143
+ - Update any `package.json` scripts accordingly:
144
+
145
+ ```json
146
+ "scripts": {
147
+ "create-package": "node node_modules/camstreamerlib/bin/CreatePackage.js"
148
+ }
149
+ ```
123
150
 
124
151
  <hr/>
125
152
  </details>
@@ -204,3 +231,5 @@ The zip package is created in the current directory. You can choose different lo
204
231
  "create-package": "node node_modules/camstreamerlib/bin/CreatePackage.js -i -e=react"
205
232
  }
206
233
  ```
234
+
235
+ > :warning: Path to `CreatePackage` script has changed from `camstreamerlib/CreatePackage.js` to `camstreamerlib/bin/CreatePackage.js` (from v.4.0.0)
@@ -205,6 +205,7 @@ export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> exte
205
205
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
206
206
  position: "fix" | "rotating" | "controllable";
207
207
  webPageUrl: string;
208
+ mediaServerUrl: string | null;
208
209
  } | {
209
210
  status: {
210
211
  led: boolean;
@@ -1958,6 +1959,7 @@ export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> exte
1958
1959
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
1959
1960
  position: "fix" | "rotating" | "controllable";
1960
1961
  webPageUrl: string;
1962
+ mediaServerUrl: string | null;
1961
1963
  } | {
1962
1964
  status: {
1963
1965
  led: boolean;
package/cjs/VapixAPI.d.ts CHANGED
@@ -17,15 +17,6 @@ export declare class VapixAPI<Client extends IClient<TResponse, any>> extends Ba
17
17
  bitRates: number[];
18
18
  }[]>;
19
19
  performAutofocus(options?: THttpRequestOptions): Promise<void>;
20
- checkSDCard(options?: THttpRequestOptions): Promise<{
21
- status: "OK" | "connected" | "disconnected";
22
- totalSize: number;
23
- freeSize: number;
24
- }>;
25
- mountSDCard(options?: THttpRequestOptions): Promise<number>;
26
- unmountSDCard(options?: THttpRequestOptions): Promise<number>;
27
- private _doSDCardMountAction;
28
- fetchSDCardJobProgress(jobId: number, options?: THttpRequestOptions): Promise<number>;
29
20
  downloadCameraReport(options?: THttpRequestOptions): Promise<string>;
30
21
  getSystemLog(options?: THttpRequestOptions): Promise<string>;
31
22
  getMaxFps(channel: number, options?: THttpRequestOptions): Promise<number>;
@@ -43,6 +34,15 @@ export declare class VapixAPI<Client extends IClient<TResponse, any>> extends Ba
43
34
  fetchRemoteDeviceInfo<T extends Record<string, any>>(payload: T, options?: THttpRequestOptions): Promise<any>;
44
35
  getHeaders(options?: THttpRequestOptions): Promise<Record<string, string>>;
45
36
  setHeaders(headers: Record<string, string>, options?: THttpRequestOptions): Promise<void>;
37
+ checkSDCard(options?: THttpRequestOptions): Promise<{
38
+ status: "OK" | "connected" | "disconnected";
39
+ totalSize: number;
40
+ freeSize: number;
41
+ }>;
42
+ mountSDCard(options?: THttpRequestOptions): Promise<number>;
43
+ unmountSDCard(options?: THttpRequestOptions): Promise<number>;
44
+ private _doSDCardMountAction;
45
+ fetchSDCardJobProgress(jobId: number, options?: THttpRequestOptions): Promise<number>;
46
46
  getParameter(paramNames: string | string[], options?: THttpRequestOptions): Promise<Record<string, string>>;
47
47
  setParameter(params: Record<string, string | number | boolean>, options?: THttpRequestOptions): Promise<void>;
48
48
  getGuardTourList(options?: THttpRequestOptions): Promise<{
package/cjs/VapixAPI.js CHANGED
@@ -98,65 +98,6 @@ class VapixAPI extends BasicAPI_1.BasicAPI {
98
98
  }, options);
99
99
  }
100
100
  }
101
- async checkSDCard(options) {
102
- const res = await this._postUrlEncoded('/axis-cgi/disks/list.cgi', {
103
- diskid: 'SD_DISK',
104
- }, options);
105
- const xmlText = await res.text();
106
- const parser = new fast_xml_parser_1.XMLParser({
107
- ignoreAttributes: false,
108
- attributeNamePrefix: '',
109
- allowBooleanAttributes: true,
110
- });
111
- const result = parser.parse(xmlText);
112
- const data = result.root.disks.disk;
113
- return VapixAPI_1.sdCardInfoSchema.parse({
114
- totalSize: parseInt(data.totalsize),
115
- freeSize: parseInt(data.freesize),
116
- status: VapixAPI_1.sdCardWatchedStatuses.includes(data.status) ? data.status : 'disconnected',
117
- });
118
- }
119
- mountSDCard(options) {
120
- return this._doSDCardMountAction('MOUNT', options);
121
- }
122
- unmountSDCard(options) {
123
- return this._doSDCardMountAction('UNMOUNT', options);
124
- }
125
- async _doSDCardMountAction(action, options) {
126
- const res = await this._postUrlEncoded('/axis-cgi/disks/mount.cgi', {
127
- action: action,
128
- diskid: 'SD_DISK',
129
- }, options);
130
- const textXml = await res.text();
131
- const parser = new fast_xml_parser_1.XMLParser({
132
- ignoreAttributes: false,
133
- attributeNamePrefix: '',
134
- allowBooleanAttributes: true,
135
- });
136
- const result = parser.parse(textXml);
137
- const job = result.root.job;
138
- if (job.result !== 'OK') {
139
- throw new errors_1.SDCardActionError(action, job.description);
140
- }
141
- return Number(job.jobid);
142
- }
143
- async fetchSDCardJobProgress(jobId, options) {
144
- const res = await this._postUrlEncoded('/axis-cgi/disks/job.cgi', {
145
- jobid: String(jobId),
146
- diskid: 'SD_DISK',
147
- }, options);
148
- const textXml = await res.text();
149
- const parser = new fast_xml_parser_1.XMLParser({
150
- ignoreAttributes: false,
151
- attributeNamePrefix: '',
152
- allowBooleanAttributes: true,
153
- });
154
- const job = parser.parse(textXml).root.job;
155
- if (job.result !== 'OK') {
156
- throw new errors_1.SDCardJobError(job.description);
157
- }
158
- return Number(job.progress);
159
- }
160
101
  downloadCameraReport(options) {
161
102
  return this._getText('/axis-cgi/serverreport.cgi', { mode: 'text' }, options);
162
103
  }
@@ -242,6 +183,65 @@ class VapixAPI extends BasicAPI_1.BasicAPI {
242
183
  const data = { apiVersion: '1.0', method: 'set', params: headers };
243
184
  await this._postJsonEncoded('/axis-cgi/customhttpheader.cgi', data, undefined, options);
244
185
  }
186
+ async checkSDCard(options) {
187
+ const res = await this._postUrlEncoded('/axis-cgi/disks/list.cgi', {
188
+ diskid: 'SD_DISK',
189
+ }, options);
190
+ const xmlText = await res.text();
191
+ const parser = new fast_xml_parser_1.XMLParser({
192
+ ignoreAttributes: false,
193
+ attributeNamePrefix: '',
194
+ allowBooleanAttributes: true,
195
+ });
196
+ const result = parser.parse(xmlText);
197
+ const data = result.root.disks.disk;
198
+ return VapixAPI_1.sdCardInfoSchema.parse({
199
+ totalSize: parseInt(data.totalsize),
200
+ freeSize: parseInt(data.freesize),
201
+ status: VapixAPI_1.sdCardWatchedStatuses.includes(data.status) ? data.status : 'disconnected',
202
+ });
203
+ }
204
+ mountSDCard(options) {
205
+ return this._doSDCardMountAction('MOUNT', options);
206
+ }
207
+ unmountSDCard(options) {
208
+ return this._doSDCardMountAction('UNMOUNT', options);
209
+ }
210
+ async _doSDCardMountAction(action, options) {
211
+ const res = await this._postUrlEncoded('/axis-cgi/disks/mount.cgi', {
212
+ action: action,
213
+ diskid: 'SD_DISK',
214
+ }, options);
215
+ const textXml = await res.text();
216
+ const parser = new fast_xml_parser_1.XMLParser({
217
+ ignoreAttributes: false,
218
+ attributeNamePrefix: '',
219
+ allowBooleanAttributes: true,
220
+ });
221
+ const result = parser.parse(textXml);
222
+ const job = result.root.job;
223
+ if (job.result !== 'OK') {
224
+ throw new errors_1.SDCardActionError(action, job.description);
225
+ }
226
+ return Number(job.jobid);
227
+ }
228
+ async fetchSDCardJobProgress(jobId, options) {
229
+ const res = await this._postUrlEncoded('/disks/job.cgi', {
230
+ jobid: String(jobId),
231
+ diskid: 'SD_DISK',
232
+ }, options);
233
+ const textXml = await res.text();
234
+ const parser = new fast_xml_parser_1.XMLParser({
235
+ ignoreAttributes: false,
236
+ attributeNamePrefix: '',
237
+ allowBooleanAttributes: true,
238
+ });
239
+ const job = parser.parse(textXml).root.job;
240
+ if (job.result !== 'OK') {
241
+ throw new errors_1.SDCardJobError(job.description);
242
+ }
243
+ return Number(job.progress);
244
+ }
245
245
  async getParameter(paramNames, options) {
246
246
  const response = await this._postUrlEncoded('/axis-cgi/param.cgi', {
247
247
  action: 'list',
@@ -2960,6 +2960,7 @@ export declare const streamSchema: z.ZodDiscriminatedUnion<"platform", [z.ZodObj
2960
2960
  direction: z.ZodNullable<z.ZodEnum<["N", "NE", "E", "SE", "S", "SW", "W", "NW"]>>;
2961
2961
  position: z.ZodUnion<[z.ZodLiteral<"fix">, z.ZodLiteral<"rotating">, z.ZodLiteral<"controllable">]>;
2962
2962
  webPageUrl: z.ZodString;
2963
+ mediaServerUrl: z.ZodNullable<z.ZodString>;
2963
2964
  }, "strip", z.ZodTypeAny, {
2964
2965
  status: {
2965
2966
  led: boolean;
@@ -3054,6 +3055,7 @@ export declare const streamSchema: z.ZodDiscriminatedUnion<"platform", [z.ZodObj
3054
3055
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
3055
3056
  position: "fix" | "rotating" | "controllable";
3056
3057
  webPageUrl: string;
3058
+ mediaServerUrl: string | null;
3057
3059
  }, {
3058
3060
  status: {
3059
3061
  led: boolean;
@@ -3148,6 +3150,7 @@ export declare const streamSchema: z.ZodDiscriminatedUnion<"platform", [z.ZodObj
3148
3150
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
3149
3151
  position: "fix" | "rotating" | "controllable";
3150
3152
  webPageUrl: string;
3153
+ mediaServerUrl: string | null;
3151
3154
  }>, z.ZodObject<{
3152
3155
  streamId: z.ZodString;
3153
3156
  enabled: z.ZodBoolean;
@@ -13323,6 +13326,7 @@ export declare const streamListSchema: z.ZodObject<{
13323
13326
  direction: z.ZodNullable<z.ZodEnum<["N", "NE", "E", "SE", "S", "SW", "W", "NW"]>>;
13324
13327
  position: z.ZodUnion<[z.ZodLiteral<"fix">, z.ZodLiteral<"rotating">, z.ZodLiteral<"controllable">]>;
13325
13328
  webPageUrl: z.ZodString;
13329
+ mediaServerUrl: z.ZodNullable<z.ZodString>;
13326
13330
  }, "strip", z.ZodTypeAny, {
13327
13331
  status: {
13328
13332
  led: boolean;
@@ -13417,6 +13421,7 @@ export declare const streamListSchema: z.ZodObject<{
13417
13421
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
13418
13422
  position: "fix" | "rotating" | "controllable";
13419
13423
  webPageUrl: string;
13424
+ mediaServerUrl: string | null;
13420
13425
  }, {
13421
13426
  status: {
13422
13427
  led: boolean;
@@ -13511,6 +13516,7 @@ export declare const streamListSchema: z.ZodObject<{
13511
13516
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
13512
13517
  position: "fix" | "rotating" | "controllable";
13513
13518
  webPageUrl: string;
13519
+ mediaServerUrl: string | null;
13514
13520
  }>, z.ZodObject<{
13515
13521
  streamId: z.ZodString;
13516
13522
  enabled: z.ZodBoolean;
@@ -20918,6 +20924,7 @@ export declare const streamListSchema: z.ZodObject<{
20918
20924
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
20919
20925
  position: "fix" | "rotating" | "controllable";
20920
20926
  webPageUrl: string;
20927
+ mediaServerUrl: string | null;
20921
20928
  } | {
20922
20929
  status: {
20923
20930
  led: boolean;
@@ -22669,6 +22676,7 @@ export declare const streamListSchema: z.ZodObject<{
22669
22676
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
22670
22677
  position: "fix" | "rotating" | "controllable";
22671
22678
  webPageUrl: string;
22679
+ mediaServerUrl: string | null;
22672
22680
  } | {
22673
22681
  status: {
22674
22682
  led: boolean;
@@ -24776,6 +24784,7 @@ export declare const isWindyStream: (stream: TStream) => stream is {
24776
24784
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
24777
24785
  position: "fix" | "rotating" | "controllable";
24778
24786
  webPageUrl: string;
24787
+ mediaServerUrl: string | null;
24779
24788
  };
24780
24789
  export type TYouTubeStream = z.infer<typeof youtubeSchema>;
24781
24790
  export declare const isYouTubeStream: (stream: TStream) => stream is {
@@ -32,10 +32,10 @@ export declare const oldStringStreamSchema: z.ZodObject<{
32
32
  userVapixParameters: string;
33
33
  forceStereo: string;
34
34
  avSyncMsec: string;
35
+ mediaServerUrl: string;
35
36
  audioSource: string;
36
37
  outputParameters: string;
37
38
  outputType: string;
38
- mediaServerUrl: string;
39
39
  inputType: string;
40
40
  inputUrl: string;
41
41
  streamDelay: string;
@@ -54,10 +54,10 @@ export declare const oldStringStreamSchema: z.ZodObject<{
54
54
  userVapixParameters: string;
55
55
  forceStereo: string;
56
56
  avSyncMsec: string;
57
+ mediaServerUrl: string;
57
58
  audioSource: string;
58
59
  outputParameters: string;
59
60
  outputType: string;
60
- mediaServerUrl: string;
61
61
  inputType: string;
62
62
  inputUrl: string;
63
63
  streamDelay: string;
@@ -102,10 +102,10 @@ export declare const oldStringStreamSchemaWithId: z.ZodObject<{
102
102
  userVapixParameters: string;
103
103
  forceStereo: string;
104
104
  avSyncMsec: string;
105
+ mediaServerUrl: string;
105
106
  audioSource: string;
106
107
  outputParameters: string;
107
108
  outputType: string;
108
- mediaServerUrl: string;
109
109
  inputType: string;
110
110
  inputUrl: string;
111
111
  streamDelay: string;
@@ -125,10 +125,10 @@ export declare const oldStringStreamSchemaWithId: z.ZodObject<{
125
125
  userVapixParameters: string;
126
126
  forceStereo: string;
127
127
  avSyncMsec: string;
128
+ mediaServerUrl: string;
128
129
  audioSource: string;
129
130
  outputParameters: string;
130
131
  outputType: string;
131
- mediaServerUrl: string;
132
132
  inputType: string;
133
133
  inputUrl: string;
134
134
  streamDelay: string;
@@ -171,10 +171,10 @@ export declare const oldStreamSchema: z.ZodObject<{
171
171
  userVapixParameters: string;
172
172
  forceStereo: 0 | 1;
173
173
  avSyncMsec: number;
174
+ mediaServerUrl: string;
174
175
  audioSource: string;
175
176
  outputParameters: string;
176
177
  outputType: "video" | "images" | "none";
177
- mediaServerUrl: string;
178
178
  inputType: "RTSP_URL" | "CSw" | "CRS";
179
179
  inputUrl: string;
180
180
  streamDelay: number | null;
@@ -193,10 +193,10 @@ export declare const oldStreamSchema: z.ZodObject<{
193
193
  userVapixParameters: string;
194
194
  forceStereo: 0 | 1;
195
195
  avSyncMsec: number;
196
+ mediaServerUrl: string;
196
197
  audioSource: string;
197
198
  outputParameters: string;
198
199
  outputType: "video" | "images" | "none";
199
- mediaServerUrl: string;
200
200
  inputType: "RTSP_URL" | "CSw" | "CRS";
201
201
  inputUrl: string;
202
202
  streamDelay: number | null;
@@ -348,6 +348,7 @@ export declare const windySchema: z.ZodObject<{
348
348
  direction: z.ZodNullable<z.ZodEnum<["N", "NE", "E", "SE", "S", "SW", "W", "NW"]>>;
349
349
  position: z.ZodUnion<[z.ZodLiteral<"fix">, z.ZodLiteral<"rotating">, z.ZodLiteral<"controllable">]>;
350
350
  webPageUrl: z.ZodString;
351
+ mediaServerUrl: z.ZodNullable<z.ZodString>;
351
352
  }, "strip", z.ZodTypeAny, {
352
353
  status: {
353
354
  led: boolean;
@@ -442,6 +443,7 @@ export declare const windySchema: z.ZodObject<{
442
443
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
443
444
  position: "fix" | "rotating" | "controllable";
444
445
  webPageUrl: string;
446
+ mediaServerUrl: string | null;
445
447
  }, {
446
448
  status: {
447
449
  led: boolean;
@@ -536,6 +538,7 @@ export declare const windySchema: z.ZodObject<{
536
538
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
537
539
  position: "fix" | "rotating" | "controllable";
538
540
  webPageUrl: string;
541
+ mediaServerUrl: string | null;
539
542
  }>;
540
543
  export type TWindyDirection = z.infer<typeof windySchema>['direction'];
541
544
  export type TWindyPosition = z.infer<typeof windySchema>['position'];
@@ -16,4 +16,5 @@ exports.windySchema = streamCommonTypes_1.streamCommonSchema.extend({
16
16
  direction: zod_1.default.enum(['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW']).nullable(),
17
17
  position: zod_1.default.union([zod_1.default.literal('fix'), zod_1.default.literal('rotating'), zod_1.default.literal('controllable')]),
18
18
  webPageUrl: zod_1.default.string(),
19
+ mediaServerUrl: zod_1.default.string().nullable(),
19
20
  });
package/esm/VapixAPI.js CHANGED
@@ -95,65 +95,6 @@ export class VapixAPI extends BasicAPI {
95
95
  }, options);
96
96
  }
97
97
  }
98
- async checkSDCard(options) {
99
- const res = await this._postUrlEncoded('/axis-cgi/disks/list.cgi', {
100
- diskid: 'SD_DISK',
101
- }, options);
102
- const xmlText = await res.text();
103
- const parser = new XMLParser({
104
- ignoreAttributes: false,
105
- attributeNamePrefix: '',
106
- allowBooleanAttributes: true,
107
- });
108
- const result = parser.parse(xmlText);
109
- const data = result.root.disks.disk;
110
- return sdCardInfoSchema.parse({
111
- totalSize: parseInt(data.totalsize),
112
- freeSize: parseInt(data.freesize),
113
- status: sdCardWatchedStatuses.includes(data.status) ? data.status : 'disconnected',
114
- });
115
- }
116
- mountSDCard(options) {
117
- return this._doSDCardMountAction('MOUNT', options);
118
- }
119
- unmountSDCard(options) {
120
- return this._doSDCardMountAction('UNMOUNT', options);
121
- }
122
- async _doSDCardMountAction(action, options) {
123
- const res = await this._postUrlEncoded('/axis-cgi/disks/mount.cgi', {
124
- action: action,
125
- diskid: 'SD_DISK',
126
- }, options);
127
- const textXml = await res.text();
128
- const parser = new XMLParser({
129
- ignoreAttributes: false,
130
- attributeNamePrefix: '',
131
- allowBooleanAttributes: true,
132
- });
133
- const result = parser.parse(textXml);
134
- const job = result.root.job;
135
- if (job.result !== 'OK') {
136
- throw new SDCardActionError(action, job.description);
137
- }
138
- return Number(job.jobid);
139
- }
140
- async fetchSDCardJobProgress(jobId, options) {
141
- const res = await this._postUrlEncoded('/axis-cgi/disks/job.cgi', {
142
- jobid: String(jobId),
143
- diskid: 'SD_DISK',
144
- }, options);
145
- const textXml = await res.text();
146
- const parser = new XMLParser({
147
- ignoreAttributes: false,
148
- attributeNamePrefix: '',
149
- allowBooleanAttributes: true,
150
- });
151
- const job = parser.parse(textXml).root.job;
152
- if (job.result !== 'OK') {
153
- throw new SDCardJobError(job.description);
154
- }
155
- return Number(job.progress);
156
- }
157
98
  downloadCameraReport(options) {
158
99
  return this._getText('/axis-cgi/serverreport.cgi', { mode: 'text' }, options);
159
100
  }
@@ -239,6 +180,65 @@ export class VapixAPI extends BasicAPI {
239
180
  const data = { apiVersion: '1.0', method: 'set', params: headers };
240
181
  await this._postJsonEncoded('/axis-cgi/customhttpheader.cgi', data, undefined, options);
241
182
  }
183
+ async checkSDCard(options) {
184
+ const res = await this._postUrlEncoded('/axis-cgi/disks/list.cgi', {
185
+ diskid: 'SD_DISK',
186
+ }, options);
187
+ const xmlText = await res.text();
188
+ const parser = new XMLParser({
189
+ ignoreAttributes: false,
190
+ attributeNamePrefix: '',
191
+ allowBooleanAttributes: true,
192
+ });
193
+ const result = parser.parse(xmlText);
194
+ const data = result.root.disks.disk;
195
+ return sdCardInfoSchema.parse({
196
+ totalSize: parseInt(data.totalsize),
197
+ freeSize: parseInt(data.freesize),
198
+ status: sdCardWatchedStatuses.includes(data.status) ? data.status : 'disconnected',
199
+ });
200
+ }
201
+ mountSDCard(options) {
202
+ return this._doSDCardMountAction('MOUNT', options);
203
+ }
204
+ unmountSDCard(options) {
205
+ return this._doSDCardMountAction('UNMOUNT', options);
206
+ }
207
+ async _doSDCardMountAction(action, options) {
208
+ const res = await this._postUrlEncoded('/axis-cgi/disks/mount.cgi', {
209
+ action: action,
210
+ diskid: 'SD_DISK',
211
+ }, options);
212
+ const textXml = await res.text();
213
+ const parser = new XMLParser({
214
+ ignoreAttributes: false,
215
+ attributeNamePrefix: '',
216
+ allowBooleanAttributes: true,
217
+ });
218
+ const result = parser.parse(textXml);
219
+ const job = result.root.job;
220
+ if (job.result !== 'OK') {
221
+ throw new SDCardActionError(action, job.description);
222
+ }
223
+ return Number(job.jobid);
224
+ }
225
+ async fetchSDCardJobProgress(jobId, options) {
226
+ const res = await this._postUrlEncoded('/disks/job.cgi', {
227
+ jobid: String(jobId),
228
+ diskid: 'SD_DISK',
229
+ }, options);
230
+ const textXml = await res.text();
231
+ const parser = new XMLParser({
232
+ ignoreAttributes: false,
233
+ attributeNamePrefix: '',
234
+ allowBooleanAttributes: true,
235
+ });
236
+ const job = parser.parse(textXml).root.job;
237
+ if (job.result !== 'OK') {
238
+ throw new SDCardJobError(job.description);
239
+ }
240
+ return Number(job.progress);
241
+ }
242
242
  async getParameter(paramNames, options) {
243
243
  const response = await this._postUrlEncoded('/axis-cgi/param.cgi', {
244
244
  action: 'list',
@@ -10,4 +10,5 @@ export const windySchema = streamCommonSchema.extend({
10
10
  direction: z.enum(['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW']).nullable(),
11
11
  position: z.union([z.literal('fix'), z.literal('rotating'), z.literal('controllable')]),
12
12
  webPageUrl: z.string(),
13
+ mediaServerUrl: z.string().nullable(),
13
14
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstreamerlib",
3
- "version": "4.0.0-beta.162",
3
+ "version": "4.0.0-beta.163",
4
4
  "description": "Helper library for CamStreamer ACAP applications.",
5
5
  "prettier": "@camstreamer/prettier-config",
6
6
  "engine": {
@@ -205,6 +205,7 @@ export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> exte
205
205
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
206
206
  position: "fix" | "rotating" | "controllable";
207
207
  webPageUrl: string;
208
+ mediaServerUrl: string | null;
208
209
  } | {
209
210
  status: {
210
211
  led: boolean;
@@ -1958,6 +1959,7 @@ export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> exte
1958
1959
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
1959
1960
  position: "fix" | "rotating" | "controllable";
1960
1961
  webPageUrl: string;
1962
+ mediaServerUrl: string | null;
1961
1963
  } | {
1962
1964
  status: {
1963
1965
  led: boolean;
@@ -17,15 +17,6 @@ export declare class VapixAPI<Client extends IClient<TResponse, any>> extends Ba
17
17
  bitRates: number[];
18
18
  }[]>;
19
19
  performAutofocus(options?: THttpRequestOptions): Promise<void>;
20
- checkSDCard(options?: THttpRequestOptions): Promise<{
21
- status: "OK" | "connected" | "disconnected";
22
- totalSize: number;
23
- freeSize: number;
24
- }>;
25
- mountSDCard(options?: THttpRequestOptions): Promise<number>;
26
- unmountSDCard(options?: THttpRequestOptions): Promise<number>;
27
- private _doSDCardMountAction;
28
- fetchSDCardJobProgress(jobId: number, options?: THttpRequestOptions): Promise<number>;
29
20
  downloadCameraReport(options?: THttpRequestOptions): Promise<string>;
30
21
  getSystemLog(options?: THttpRequestOptions): Promise<string>;
31
22
  getMaxFps(channel: number, options?: THttpRequestOptions): Promise<number>;
@@ -43,6 +34,15 @@ export declare class VapixAPI<Client extends IClient<TResponse, any>> extends Ba
43
34
  fetchRemoteDeviceInfo<T extends Record<string, any>>(payload: T, options?: THttpRequestOptions): Promise<any>;
44
35
  getHeaders(options?: THttpRequestOptions): Promise<Record<string, string>>;
45
36
  setHeaders(headers: Record<string, string>, options?: THttpRequestOptions): Promise<void>;
37
+ checkSDCard(options?: THttpRequestOptions): Promise<{
38
+ status: "OK" | "connected" | "disconnected";
39
+ totalSize: number;
40
+ freeSize: number;
41
+ }>;
42
+ mountSDCard(options?: THttpRequestOptions): Promise<number>;
43
+ unmountSDCard(options?: THttpRequestOptions): Promise<number>;
44
+ private _doSDCardMountAction;
45
+ fetchSDCardJobProgress(jobId: number, options?: THttpRequestOptions): Promise<number>;
46
46
  getParameter(paramNames: string | string[], options?: THttpRequestOptions): Promise<Record<string, string>>;
47
47
  setParameter(params: Record<string, string | number | boolean>, options?: THttpRequestOptions): Promise<void>;
48
48
  getGuardTourList(options?: THttpRequestOptions): Promise<{
@@ -2960,6 +2960,7 @@ export declare const streamSchema: z.ZodDiscriminatedUnion<"platform", [z.ZodObj
2960
2960
  direction: z.ZodNullable<z.ZodEnum<["N", "NE", "E", "SE", "S", "SW", "W", "NW"]>>;
2961
2961
  position: z.ZodUnion<[z.ZodLiteral<"fix">, z.ZodLiteral<"rotating">, z.ZodLiteral<"controllable">]>;
2962
2962
  webPageUrl: z.ZodString;
2963
+ mediaServerUrl: z.ZodNullable<z.ZodString>;
2963
2964
  }, "strip", z.ZodTypeAny, {
2964
2965
  status: {
2965
2966
  led: boolean;
@@ -3054,6 +3055,7 @@ export declare const streamSchema: z.ZodDiscriminatedUnion<"platform", [z.ZodObj
3054
3055
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
3055
3056
  position: "fix" | "rotating" | "controllable";
3056
3057
  webPageUrl: string;
3058
+ mediaServerUrl: string | null;
3057
3059
  }, {
3058
3060
  status: {
3059
3061
  led: boolean;
@@ -3148,6 +3150,7 @@ export declare const streamSchema: z.ZodDiscriminatedUnion<"platform", [z.ZodObj
3148
3150
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
3149
3151
  position: "fix" | "rotating" | "controllable";
3150
3152
  webPageUrl: string;
3153
+ mediaServerUrl: string | null;
3151
3154
  }>, z.ZodObject<{
3152
3155
  streamId: z.ZodString;
3153
3156
  enabled: z.ZodBoolean;
@@ -13323,6 +13326,7 @@ export declare const streamListSchema: z.ZodObject<{
13323
13326
  direction: z.ZodNullable<z.ZodEnum<["N", "NE", "E", "SE", "S", "SW", "W", "NW"]>>;
13324
13327
  position: z.ZodUnion<[z.ZodLiteral<"fix">, z.ZodLiteral<"rotating">, z.ZodLiteral<"controllable">]>;
13325
13328
  webPageUrl: z.ZodString;
13329
+ mediaServerUrl: z.ZodNullable<z.ZodString>;
13326
13330
  }, "strip", z.ZodTypeAny, {
13327
13331
  status: {
13328
13332
  led: boolean;
@@ -13417,6 +13421,7 @@ export declare const streamListSchema: z.ZodObject<{
13417
13421
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
13418
13422
  position: "fix" | "rotating" | "controllable";
13419
13423
  webPageUrl: string;
13424
+ mediaServerUrl: string | null;
13420
13425
  }, {
13421
13426
  status: {
13422
13427
  led: boolean;
@@ -13511,6 +13516,7 @@ export declare const streamListSchema: z.ZodObject<{
13511
13516
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
13512
13517
  position: "fix" | "rotating" | "controllable";
13513
13518
  webPageUrl: string;
13519
+ mediaServerUrl: string | null;
13514
13520
  }>, z.ZodObject<{
13515
13521
  streamId: z.ZodString;
13516
13522
  enabled: z.ZodBoolean;
@@ -20918,6 +20924,7 @@ export declare const streamListSchema: z.ZodObject<{
20918
20924
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
20919
20925
  position: "fix" | "rotating" | "controllable";
20920
20926
  webPageUrl: string;
20927
+ mediaServerUrl: string | null;
20921
20928
  } | {
20922
20929
  status: {
20923
20930
  led: boolean;
@@ -22669,6 +22676,7 @@ export declare const streamListSchema: z.ZodObject<{
22669
22676
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
22670
22677
  position: "fix" | "rotating" | "controllable";
22671
22678
  webPageUrl: string;
22679
+ mediaServerUrl: string | null;
22672
22680
  } | {
22673
22681
  status: {
22674
22682
  led: boolean;
@@ -24776,6 +24784,7 @@ export declare const isWindyStream: (stream: TStream) => stream is {
24776
24784
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
24777
24785
  position: "fix" | "rotating" | "controllable";
24778
24786
  webPageUrl: string;
24787
+ mediaServerUrl: string | null;
24779
24788
  };
24780
24789
  export type TYouTubeStream = z.infer<typeof youtubeSchema>;
24781
24790
  export declare const isYouTubeStream: (stream: TStream) => stream is {
@@ -32,10 +32,10 @@ export declare const oldStringStreamSchema: z.ZodObject<{
32
32
  userVapixParameters: string;
33
33
  forceStereo: string;
34
34
  avSyncMsec: string;
35
+ mediaServerUrl: string;
35
36
  audioSource: string;
36
37
  outputParameters: string;
37
38
  outputType: string;
38
- mediaServerUrl: string;
39
39
  inputType: string;
40
40
  inputUrl: string;
41
41
  streamDelay: string;
@@ -54,10 +54,10 @@ export declare const oldStringStreamSchema: z.ZodObject<{
54
54
  userVapixParameters: string;
55
55
  forceStereo: string;
56
56
  avSyncMsec: string;
57
+ mediaServerUrl: string;
57
58
  audioSource: string;
58
59
  outputParameters: string;
59
60
  outputType: string;
60
- mediaServerUrl: string;
61
61
  inputType: string;
62
62
  inputUrl: string;
63
63
  streamDelay: string;
@@ -102,10 +102,10 @@ export declare const oldStringStreamSchemaWithId: z.ZodObject<{
102
102
  userVapixParameters: string;
103
103
  forceStereo: string;
104
104
  avSyncMsec: string;
105
+ mediaServerUrl: string;
105
106
  audioSource: string;
106
107
  outputParameters: string;
107
108
  outputType: string;
108
- mediaServerUrl: string;
109
109
  inputType: string;
110
110
  inputUrl: string;
111
111
  streamDelay: string;
@@ -125,10 +125,10 @@ export declare const oldStringStreamSchemaWithId: z.ZodObject<{
125
125
  userVapixParameters: string;
126
126
  forceStereo: string;
127
127
  avSyncMsec: string;
128
+ mediaServerUrl: string;
128
129
  audioSource: string;
129
130
  outputParameters: string;
130
131
  outputType: string;
131
- mediaServerUrl: string;
132
132
  inputType: string;
133
133
  inputUrl: string;
134
134
  streamDelay: string;
@@ -171,10 +171,10 @@ export declare const oldStreamSchema: z.ZodObject<{
171
171
  userVapixParameters: string;
172
172
  forceStereo: 0 | 1;
173
173
  avSyncMsec: number;
174
+ mediaServerUrl: string;
174
175
  audioSource: string;
175
176
  outputParameters: string;
176
177
  outputType: "video" | "images" | "none";
177
- mediaServerUrl: string;
178
178
  inputType: "RTSP_URL" | "CSw" | "CRS";
179
179
  inputUrl: string;
180
180
  streamDelay: number | null;
@@ -193,10 +193,10 @@ export declare const oldStreamSchema: z.ZodObject<{
193
193
  userVapixParameters: string;
194
194
  forceStereo: 0 | 1;
195
195
  avSyncMsec: number;
196
+ mediaServerUrl: string;
196
197
  audioSource: string;
197
198
  outputParameters: string;
198
199
  outputType: "video" | "images" | "none";
199
- mediaServerUrl: string;
200
200
  inputType: "RTSP_URL" | "CSw" | "CRS";
201
201
  inputUrl: string;
202
202
  streamDelay: number | null;
@@ -348,6 +348,7 @@ export declare const windySchema: z.ZodObject<{
348
348
  direction: z.ZodNullable<z.ZodEnum<["N", "NE", "E", "SE", "S", "SW", "W", "NW"]>>;
349
349
  position: z.ZodUnion<[z.ZodLiteral<"fix">, z.ZodLiteral<"rotating">, z.ZodLiteral<"controllable">]>;
350
350
  webPageUrl: z.ZodString;
351
+ mediaServerUrl: z.ZodNullable<z.ZodString>;
351
352
  }, "strip", z.ZodTypeAny, {
352
353
  status: {
353
354
  led: boolean;
@@ -442,6 +443,7 @@ export declare const windySchema: z.ZodObject<{
442
443
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
443
444
  position: "fix" | "rotating" | "controllable";
444
445
  webPageUrl: string;
446
+ mediaServerUrl: string | null;
445
447
  }, {
446
448
  status: {
447
449
  led: boolean;
@@ -536,6 +538,7 @@ export declare const windySchema: z.ZodObject<{
536
538
  direction: "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | null;
537
539
  position: "fix" | "rotating" | "controllable";
538
540
  webPageUrl: string;
541
+ mediaServerUrl: string | null;
539
542
  }>;
540
543
  export type TWindyDirection = z.infer<typeof windySchema>['direction'];
541
544
  export type TWindyPosition = z.infer<typeof windySchema>['position'];