camstreamerlib 4.0.30 → 4.0.31-e0ed433

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.
@@ -144,7 +144,24 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> exte
144
144
  setSecondaryAudioSettings(settings: TSecondaryAudioSettings, options?: THttpRequestOptions): Promise<void>;
145
145
  setDefaultPlaylist(playlistId: string, options?: THttpRequestOptions): Promise<void>;
146
146
  setPermanentRtspUrlToken(token: string, options?: THttpRequestOptions): Promise<void>;
147
- getCamSwitchOptions(options?: THttpRequestOptions): Promise<any>;
147
+ getCamSwitchOptions(options?: THttpRequestOptions): Promise<{
148
+ resolution?: string | undefined;
149
+ compression?: number | undefined;
150
+ bitrateMode?: "VBR" | "MBR" | "ABR" | undefined;
151
+ maximumBitRate?: number | undefined;
152
+ retentionTime?: number | undefined;
153
+ bitRateLimit?: number | undefined;
154
+ fps?: number | undefined;
155
+ govLength?: number | undefined;
156
+ h264Profile?: "high" | "main" | "baseline" | undefined;
157
+ keyboard?: {
158
+ none: string | null;
159
+ fromSource: string | null;
160
+ } | undefined;
161
+ bitrateVapixParams?: string | null | undefined;
162
+ audioSampleRate?: number | undefined;
163
+ audioChannelCount?: 1 | 2 | undefined;
164
+ }>;
148
165
  getGlobalAudioSettings(options?: THttpRequestOptions): Promise<{
149
166
  type: "source" | "fromSource";
150
167
  source: string;
@@ -204,28 +204,38 @@ class CamSwitcherAPI extends BasicAPI_1.BasicAPI {
204
204
  async getCamSwitchOptions(options) {
205
205
  const saveData = await this.getParamFromCameraAndJSONParse(CSW_PARAM_NAMES.SETTINGS, options);
206
206
  if ((0, utils_1.isNullish)(saveData.video)) {
207
- return saveData;
207
+ return CamSwitcherAPI_1.cameraOptionsSchema.parse({
208
+ audioSampleRate: saveData.audio?.sampleRate,
209
+ audioChannelCount: saveData.audio?.channelCount,
210
+ keyboard: saveData.keyboard,
211
+ });
208
212
  }
209
- if (!(0, utils_1.isNullish)(saveData.video?.bitrateVapixParams)) {
213
+ const settings = {
214
+ audioSampleRate: saveData.audio?.sampleRate,
215
+ audioChannelCount: saveData.audio?.channelCount,
216
+ keyboard: saveData.keyboard,
217
+ fps: saveData.video.fps,
218
+ resolution: saveData.video.resolution,
219
+ h264Profile: saveData.video.h264Profile,
220
+ compression: saveData.video.compression,
221
+ govLength: saveData.video.govLength,
222
+ bitrateVapixParams: saveData.video.bitrateVapixParams,
223
+ };
224
+ if (!(0, utils_1.isNullish)(saveData.video.bitrateVapixParams)) {
210
225
  const bitrateOptions = (0, convertors_1.parseVapixParamsToBitrateOptions)(saveData.video.bitrateVapixParams);
211
- saveData.video.bitrateMode = bitrateOptions.bitrateMode;
212
- saveData.video.maximumBitRate = bitrateOptions.maximumBitRate;
213
- saveData.video.retentionTime = bitrateOptions.retentionTime;
214
- saveData.video.bitRateLimit = bitrateOptions.bitRateLimit;
226
+ settings.bitrateMode = bitrateOptions.bitrateMode;
227
+ settings.maximumBitRate = bitrateOptions.maximumBitRate;
228
+ settings.retentionTime = bitrateOptions.retentionTime;
229
+ settings.bitRateLimit = bitrateOptions.bitRateLimit;
215
230
  }
216
- if (!(0, utils_1.isNullish)(saveData.video?.bitrateLimit)) {
217
- saveData.video.maximumBitRate = saveData.video.bitrateLimit;
218
- saveData.video.bitrateMode = 'MBR';
231
+ if (!(0, utils_1.isNullish)(saveData.video.bitrateLimit)) {
232
+ settings.maximumBitRate = saveData.video.bitrateLimit;
233
+ settings.bitrateMode = 'MBR';
219
234
  }
220
- if (!(0, utils_1.isNullish)(saveData.video?.videoClipQuality)) {
221
- saveData.video.maximumBitRate = saveData.video.videoClipQuality;
235
+ if (!(0, utils_1.isNullish)(saveData.video.videoClipQuality)) {
236
+ settings.maximumBitRate = saveData.video.videoClipQuality;
222
237
  }
223
- return {
224
- ...saveData.video,
225
- audioSampleRate: saveData.audio.sampleRate,
226
- audioChannelCount: saveData.audio.channelCount,
227
- keyboard: saveData.keyboard,
228
- };
238
+ return CamSwitcherAPI_1.cameraOptionsSchema.parse(settings);
229
239
  }
230
240
  async getGlobalAudioSettings(options) {
231
241
  const settings = {
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { AddNewClipError, ParameterNotFoundError } from './errors/errors';
3
3
  import { parseBitrateOptionsToVapixParams, parseVapixParamsToBitrateOptions } from './internal/convertors';
4
4
  import { isClip, isNullish } from './internal/utils';
5
- import { storageInfoListSchema, outputInfoSchema, audioPushInfoSchema, clipListSchema, playlistQueueSchema, streamSaveLoadSchema, clipSaveLoadSchema, playlistSaveLoadSchema, trackerSaveLoadSchema, secondaryAudioSettingsSchema, globalAudioSettingsSchema, clipFilesListSchema, } from './types/CamSwitcherAPI';
5
+ import { storageInfoListSchema, outputInfoSchema, audioPushInfoSchema, clipListSchema, playlistQueueSchema, streamSaveLoadSchema, clipSaveLoadSchema, playlistSaveLoadSchema, trackerSaveLoadSchema, secondaryAudioSettingsSchema, globalAudioSettingsSchema, clipFilesListSchema, cameraOptionsSchema, } from './types/CamSwitcherAPI';
6
6
  import { networkCameraListSchema, } from './types/common';
7
7
  import { VapixAPI } from './VapixAPI';
8
8
  import { BasicAPI } from './internal/BasicAPI';
@@ -201,28 +201,38 @@ export class CamSwitcherAPI extends BasicAPI {
201
201
  async getCamSwitchOptions(options) {
202
202
  const saveData = await this.getParamFromCameraAndJSONParse(CSW_PARAM_NAMES.SETTINGS, options);
203
203
  if (isNullish(saveData.video)) {
204
- return saveData;
204
+ return cameraOptionsSchema.parse({
205
+ audioSampleRate: saveData.audio?.sampleRate,
206
+ audioChannelCount: saveData.audio?.channelCount,
207
+ keyboard: saveData.keyboard,
208
+ });
205
209
  }
206
- if (!isNullish(saveData.video?.bitrateVapixParams)) {
210
+ const settings = {
211
+ audioSampleRate: saveData.audio?.sampleRate,
212
+ audioChannelCount: saveData.audio?.channelCount,
213
+ keyboard: saveData.keyboard,
214
+ fps: saveData.video.fps,
215
+ resolution: saveData.video.resolution,
216
+ h264Profile: saveData.video.h264Profile,
217
+ compression: saveData.video.compression,
218
+ govLength: saveData.video.govLength,
219
+ bitrateVapixParams: saveData.video.bitrateVapixParams,
220
+ };
221
+ if (!isNullish(saveData.video.bitrateVapixParams)) {
207
222
  const bitrateOptions = parseVapixParamsToBitrateOptions(saveData.video.bitrateVapixParams);
208
- saveData.video.bitrateMode = bitrateOptions.bitrateMode;
209
- saveData.video.maximumBitRate = bitrateOptions.maximumBitRate;
210
- saveData.video.retentionTime = bitrateOptions.retentionTime;
211
- saveData.video.bitRateLimit = bitrateOptions.bitRateLimit;
223
+ settings.bitrateMode = bitrateOptions.bitrateMode;
224
+ settings.maximumBitRate = bitrateOptions.maximumBitRate;
225
+ settings.retentionTime = bitrateOptions.retentionTime;
226
+ settings.bitRateLimit = bitrateOptions.bitRateLimit;
212
227
  }
213
- if (!isNullish(saveData.video?.bitrateLimit)) {
214
- saveData.video.maximumBitRate = saveData.video.bitrateLimit;
215
- saveData.video.bitrateMode = 'MBR';
228
+ if (!isNullish(saveData.video.bitrateLimit)) {
229
+ settings.maximumBitRate = saveData.video.bitrateLimit;
230
+ settings.bitrateMode = 'MBR';
216
231
  }
217
- if (!isNullish(saveData.video?.videoClipQuality)) {
218
- saveData.video.maximumBitRate = saveData.video.videoClipQuality;
232
+ if (!isNullish(saveData.video.videoClipQuality)) {
233
+ settings.maximumBitRate = saveData.video.videoClipQuality;
219
234
  }
220
- return {
221
- ...saveData.video,
222
- audioSampleRate: saveData.audio.sampleRate,
223
- audioChannelCount: saveData.audio.channelCount,
224
- keyboard: saveData.keyboard,
225
- };
235
+ return cameraOptionsSchema.parse(settings);
226
236
  }
227
237
  async getGlobalAudioSettings(options) {
228
238
  const settings = {
package/package.json CHANGED
@@ -1,110 +1,110 @@
1
1
  {
2
- "name": "camstreamerlib",
3
- "version": "4.0.30",
4
- "description": "Helper library for CamStreamer ACAP applications.",
5
- "prettier": "@camstreamer/prettier-config",
6
- "engine": {
7
- "node": ">=18.0.0"
2
+ "name": "camstreamerlib",
3
+ "version": "4.0.31-e0ed433",
4
+ "description": "Helper library for CamStreamer ACAP applications.",
5
+ "prettier": "@camstreamer/prettier-config",
6
+ "engine": {
7
+ "node": ">=18.0.0"
8
+ },
9
+ "dependencies": {
10
+ "adm-zip": "^0.6.0",
11
+ "eventemitter2": "^5.0.1",
12
+ "fast-xml-parser": "^5.3.6",
13
+ "type-fest": "^4.41.0",
14
+ "undici": "^6.28.0",
15
+ "ws": "^8.18.0",
16
+ "zod": "^3.25.76"
17
+ },
18
+ "devDependencies": {
19
+ "@camstreamer/eslint-config": "^1.0.2",
20
+ "@camstreamer/prettier-config": "^2.0.4",
21
+ "@types/adm-zip": "^0.5.5",
22
+ "@types/jest": "^28.0.0",
23
+ "@types/node": "^18.19.127",
24
+ "@types/ws": "^8.5.10",
25
+ "@typescript-eslint/eslint-plugin": "^6.8.0",
26
+ "@typescript-eslint/parser": "^6.8.0",
27
+ "eslint": "^8.51.0",
28
+ "eslint-plugin-deprecation": "^2.0.0",
29
+ "eslint-plugin-unused-imports": "^3.0.0",
30
+ "jest": "^28.1.3",
31
+ "npm-run-all": "^4.1.5",
32
+ "prettier": "^2.7.1",
33
+ "ts-jest": "^28.0.0",
34
+ "ts-node": "^10.7.0",
35
+ "typescript": "5.3.3"
36
+ },
37
+ "overrides": {
38
+ "js-yaml": "^4.2.0"
39
+ },
40
+ "scripts": {
41
+ "clean": "rimraf dist/*",
42
+ "build": "npm-run-all clean build:cjs build:esm copyPackage",
43
+ "build:cjs": "tsc --project tsconfig.cjs.json",
44
+ "build:esm": "tsc --project tsconfig.esm.json",
45
+ "copyPackage": "cp -f LICENSE dist/ && cp -f README.md dist/ && cp -f package.json dist/",
46
+ "publishPackage": "./publish.sh",
47
+ "lint": "eslint \"src/**/*.ts\"",
48
+ "lint:fix": "eslint \"src/**/*.ts\" --fix",
49
+ "pretty": "prettier --write \"./{{src,doc}/**/*.{ts,tsx,md},README.md}\"",
50
+ "pretty:check": "prettier --check \"./{{src,doc}/**/*.{ts,tsx,md},README.md}\"",
51
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
52
+ "audit": "npm audit --audit-level=high"
53
+ },
54
+ "files": [
55
+ "/**/*.js",
56
+ "/**/*.ts"
57
+ ],
58
+ "main": "./cjs/index.js",
59
+ "module": "./esm/index.js",
60
+ "types": "types/index.d.ts",
61
+ "exports": {
62
+ ".": {
63
+ "import": "./esm/index.js",
64
+ "require": "./cjs/index.js",
65
+ "types": "./types/index.d.ts"
8
66
  },
9
- "dependencies": {
10
- "adm-zip": "^0.6.0",
11
- "eventemitter2": "^5.0.1",
12
- "fast-xml-parser": "^5.3.6",
13
- "type-fest": "^4.41.0",
14
- "undici": "^6.28.0",
15
- "ws": "^8.18.0",
16
- "zod": "^3.25.76"
67
+ "./web": {
68
+ "import": "./esm/web/index.js",
69
+ "require": "./cjs/web/index.js",
70
+ "types": "./types/web/index.d.ts"
17
71
  },
18
- "devDependencies": {
19
- "@camstreamer/eslint-config": "^1.0.2",
20
- "@camstreamer/prettier-config": "^2.0.4",
21
- "@types/adm-zip": "^0.5.5",
22
- "@types/jest": "^28.0.0",
23
- "@types/node": "^18.19.127",
24
- "@types/ws": "^8.5.10",
25
- "@typescript-eslint/eslint-plugin": "^6.8.0",
26
- "@typescript-eslint/parser": "^6.8.0",
27
- "eslint": "^8.51.0",
28
- "eslint-plugin-deprecation": "^2.0.0",
29
- "eslint-plugin-unused-imports": "^3.0.0",
30
- "jest": "^28.1.3",
31
- "npm-run-all": "^4.1.5",
32
- "prettier": "^2.7.1",
33
- "ts-jest": "^28.0.0",
34
- "ts-node": "^10.7.0",
35
- "typescript": "5.3.3"
72
+ "./node": {
73
+ "import": "./esm/node/index.js",
74
+ "require": "./cjs/node/index.js",
75
+ "types": "./types/node/index.d.ts"
36
76
  },
37
- "overrides": {
38
- "js-yaml": "^4.2.0"
77
+ "./cjs/index": {
78
+ "import": "./esm/index.js",
79
+ "require": "./cjs/index.js",
80
+ "types": "./types/index.d.ts"
39
81
  },
40
- "scripts": {
41
- "clean": "rimraf dist/*",
42
- "build": "npm-run-all clean build:cjs build:esm copyPackage",
43
- "build:cjs": "tsc --project tsconfig.cjs.json",
44
- "build:esm": "tsc --project tsconfig.esm.json",
45
- "copyPackage": "cp -f LICENSE dist/ && cp -f README.md dist/ && cp -f package.json dist/",
46
- "publishPackage": "./publish.sh",
47
- "lint": "eslint \"src/**/*.ts\"",
48
- "lint:fix": "eslint \"src/**/*.ts\" --fix",
49
- "pretty": "prettier --write \"./{{src,doc}/**/*.{ts,tsx,md},README.md}\"",
50
- "pretty:check": "prettier --check \"./{{src,doc}/**/*.{ts,tsx,md},README.md}\"",
51
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
52
- "audit": "npm audit --audit-level=high"
82
+ "./cjs/node": {
83
+ "import": "./esm/node/index.js",
84
+ "require": "./cjs/node/index.js",
85
+ "types": "./types/node/index.js"
53
86
  },
54
- "files": [
55
- "/**/*.js",
56
- "/**/*.ts"
57
- ],
58
- "main": "./cjs/index.js",
59
- "module": "./esm/index.js",
60
- "types": "types/index.d.ts",
61
- "exports": {
62
- ".": {
63
- "import": "./esm/index.js",
64
- "require": "./cjs/index.js",
65
- "types": "./types/index.d.ts"
66
- },
67
- "./web": {
68
- "import": "./esm/web/index.js",
69
- "require": "./cjs/web/index.js",
70
- "types": "./types/web/index.d.ts"
71
- },
72
- "./node": {
73
- "import": "./esm/node/index.js",
74
- "require": "./cjs/node/index.js",
75
- "types": "./types/node/index.d.ts"
76
- },
77
- "./cjs/index": {
78
- "import": "./esm/index.js",
79
- "require": "./cjs/index.js",
80
- "types": "./types/index.d.ts"
81
- },
82
- "./cjs/node": {
83
- "import": "./esm/node/index.js",
84
- "require": "./cjs/node/index.js",
85
- "types": "./types/node/index.js"
86
- },
87
- "./cjs/node/index": {
88
- "import": "./esm/node/index.js",
89
- "require": "./cjs/node/index.js",
90
- "types": "./types/node/index.js"
91
- }
92
- },
93
- "repository": {
94
- "type": "git",
95
- "url": "git+https://github.com/CamStreamer/CamStreamerLib.git"
96
- },
97
- "keywords": [
98
- "CamStreamer",
99
- "CamOverlay",
100
- "CamScripter",
101
- "Camera",
102
- "Axis"
103
- ],
104
- "author": "CamStreamer s.r.o",
105
- "license": "ISC",
106
- "bugs": {
107
- "url": "https://github.com/CamStreamer/CamStreamerLib/issues"
108
- },
109
- "homepage": "https://github.com/CamStreamer/CamStreamerLib#readme"
87
+ "./cjs/node/index": {
88
+ "import": "./esm/node/index.js",
89
+ "require": "./cjs/node/index.js",
90
+ "types": "./types/node/index.js"
91
+ }
92
+ },
93
+ "repository": {
94
+ "type": "git",
95
+ "url": "git+https://github.com/CamStreamer/CamStreamerLib.git"
96
+ },
97
+ "keywords": [
98
+ "CamStreamer",
99
+ "CamOverlay",
100
+ "CamScripter",
101
+ "Camera",
102
+ "Axis"
103
+ ],
104
+ "author": "CamStreamer s.r.o",
105
+ "license": "ISC",
106
+ "bugs": {
107
+ "url": "https://github.com/CamStreamer/CamStreamerLib/issues"
108
+ },
109
+ "homepage": "https://github.com/CamStreamer/CamStreamerLib#readme"
110
110
  }
@@ -144,7 +144,24 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> exte
144
144
  setSecondaryAudioSettings(settings: TSecondaryAudioSettings, options?: THttpRequestOptions): Promise<void>;
145
145
  setDefaultPlaylist(playlistId: string, options?: THttpRequestOptions): Promise<void>;
146
146
  setPermanentRtspUrlToken(token: string, options?: THttpRequestOptions): Promise<void>;
147
- getCamSwitchOptions(options?: THttpRequestOptions): Promise<any>;
147
+ getCamSwitchOptions(options?: THttpRequestOptions): Promise<{
148
+ resolution?: string | undefined;
149
+ compression?: number | undefined;
150
+ bitrateMode?: "VBR" | "MBR" | "ABR" | undefined;
151
+ maximumBitRate?: number | undefined;
152
+ retentionTime?: number | undefined;
153
+ bitRateLimit?: number | undefined;
154
+ fps?: number | undefined;
155
+ govLength?: number | undefined;
156
+ h264Profile?: "high" | "main" | "baseline" | undefined;
157
+ keyboard?: {
158
+ none: string | null;
159
+ fromSource: string | null;
160
+ } | undefined;
161
+ bitrateVapixParams?: string | null | undefined;
162
+ audioSampleRate?: number | undefined;
163
+ audioChannelCount?: 1 | 2 | undefined;
164
+ }>;
148
165
  getGlobalAudioSettings(options?: THttpRequestOptions): Promise<{
149
166
  type: "source" | "fromSource";
150
167
  source: string;