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.
Files changed (91) hide show
  1. package/cjs/CamOverlayAPI.d.ts +6 -6
  2. package/cjs/CamStreamerAPI.d.ts +270 -305
  3. package/cjs/CamStreamerAPI.js +12 -2
  4. package/cjs/CamSwitcherAPI.js +9 -63
  5. package/cjs/errors/errors.d.ts +4 -3
  6. package/cjs/errors/errors.js +3 -1
  7. package/cjs/index.d.ts +1 -0
  8. package/cjs/index.js +1 -0
  9. package/cjs/internal/constants.d.ts +1 -0
  10. package/cjs/internal/constants.js +2 -1
  11. package/cjs/internal/convertors.d.ts +6 -0
  12. package/cjs/internal/convertors.js +115 -0
  13. package/cjs/types/CamOverlayAPI/CamOverlayAPI.d.ts +21 -21
  14. package/cjs/types/CamOverlayAPI/customGraphicsSchema.d.ts +2 -2
  15. package/cjs/types/CamOverlayAPI/ptzCompassSchema.d.ts +4 -4
  16. package/cjs/types/CamStreamerAPI/CamStreamerAPI.d.ts +1501 -1976
  17. package/cjs/types/CamStreamerAPI/churchSchema.d.ts +27 -38
  18. package/cjs/types/CamStreamerAPI/daCastSchema.d.ts +27 -38
  19. package/cjs/types/CamStreamerAPI/dailymotionSchema.d.ts +27 -38
  20. package/cjs/types/CamStreamerAPI/facebookSchema.d.ts +27 -38
  21. package/cjs/types/CamStreamerAPI/gameChangerSchema.d.ts +27 -38
  22. package/cjs/types/CamStreamerAPI/hlsPullSchema.d.ts +27 -38
  23. package/cjs/types/CamStreamerAPI/hlsPushSchema.d.ts +27 -38
  24. package/cjs/types/CamStreamerAPI/ibmSchema.d.ts +27 -38
  25. package/cjs/types/CamStreamerAPI/microsoftAzureSchema.d.ts +27 -38
  26. package/cjs/types/CamStreamerAPI/microsoftStreamSchema.d.ts +27 -38
  27. package/cjs/types/CamStreamerAPI/mpegDvbSchema.d.ts +27 -38
  28. package/cjs/types/CamStreamerAPI/oldStreamSchema.d.ts +12 -12
  29. package/cjs/types/CamStreamerAPI/rtmpSchema.d.ts +27 -38
  30. package/cjs/types/CamStreamerAPI/rtmpSchema.js +1 -1
  31. package/cjs/types/CamStreamerAPI/sdCardSchema.d.ts +27 -38
  32. package/cjs/types/CamStreamerAPI/srtSchema.d.ts +27 -38
  33. package/cjs/types/CamStreamerAPI/streamCommonTypes.d.ts +88 -56
  34. package/cjs/types/CamStreamerAPI/streamCommonTypes.js +44 -9
  35. package/cjs/types/CamStreamerAPI/twitchSchema.d.ts +27 -38
  36. package/cjs/types/CamStreamerAPI/vimeoSchema.d.ts +27 -38
  37. package/cjs/types/CamStreamerAPI/windySchema.d.ts +27 -38
  38. package/cjs/types/CamStreamerAPI/wowzaSchema.d.ts +27 -38
  39. package/cjs/types/CamStreamerAPI/youtubeSchema.d.ts +27 -38
  40. package/cjs/types/CamSwitcherAPI.d.ts +8 -27
  41. package/cjs/types/CamSwitcherAPI.js +2 -9
  42. package/cjs/types/common.d.ts +19 -0
  43. package/cjs/types/common.js +8 -1
  44. package/cjs/types/ws/CamStreamerEvents.d.ts +44 -0
  45. package/cjs/types/ws/CamStreamerEvents.js +5 -0
  46. package/esm/CamStreamerAPI.js +12 -2
  47. package/esm/CamSwitcherAPI.js +8 -62
  48. package/esm/errors/errors.js +3 -1
  49. package/esm/index.js +1 -0
  50. package/esm/internal/constants.js +1 -0
  51. package/esm/internal/convertors.js +108 -0
  52. package/esm/types/CamStreamerAPI/rtmpSchema.js +1 -1
  53. package/esm/types/CamStreamerAPI/streamCommonTypes.js +44 -9
  54. package/esm/types/CamSwitcherAPI.js +1 -8
  55. package/esm/types/common.js +7 -0
  56. package/esm/types/ws/CamStreamerEvents.js +5 -0
  57. package/package.json +1 -1
  58. package/types/CamOverlayAPI.d.ts +6 -6
  59. package/types/CamStreamerAPI.d.ts +270 -305
  60. package/types/errors/errors.d.ts +4 -3
  61. package/types/index.d.ts +1 -0
  62. package/types/internal/constants.d.ts +1 -0
  63. package/types/internal/convertors.d.ts +6 -0
  64. package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +21 -21
  65. package/types/types/CamOverlayAPI/customGraphicsSchema.d.ts +2 -2
  66. package/types/types/CamOverlayAPI/ptzCompassSchema.d.ts +4 -4
  67. package/types/types/CamStreamerAPI/CamStreamerAPI.d.ts +1501 -1976
  68. package/types/types/CamStreamerAPI/churchSchema.d.ts +27 -38
  69. package/types/types/CamStreamerAPI/daCastSchema.d.ts +27 -38
  70. package/types/types/CamStreamerAPI/dailymotionSchema.d.ts +27 -38
  71. package/types/types/CamStreamerAPI/facebookSchema.d.ts +27 -38
  72. package/types/types/CamStreamerAPI/gameChangerSchema.d.ts +27 -38
  73. package/types/types/CamStreamerAPI/hlsPullSchema.d.ts +27 -38
  74. package/types/types/CamStreamerAPI/hlsPushSchema.d.ts +27 -38
  75. package/types/types/CamStreamerAPI/ibmSchema.d.ts +27 -38
  76. package/types/types/CamStreamerAPI/microsoftAzureSchema.d.ts +27 -38
  77. package/types/types/CamStreamerAPI/microsoftStreamSchema.d.ts +27 -38
  78. package/types/types/CamStreamerAPI/mpegDvbSchema.d.ts +27 -38
  79. package/types/types/CamStreamerAPI/oldStreamSchema.d.ts +12 -12
  80. package/types/types/CamStreamerAPI/rtmpSchema.d.ts +27 -38
  81. package/types/types/CamStreamerAPI/sdCardSchema.d.ts +27 -38
  82. package/types/types/CamStreamerAPI/srtSchema.d.ts +27 -38
  83. package/types/types/CamStreamerAPI/streamCommonTypes.d.ts +88 -56
  84. package/types/types/CamStreamerAPI/twitchSchema.d.ts +27 -38
  85. package/types/types/CamStreamerAPI/vimeoSchema.d.ts +27 -38
  86. package/types/types/CamStreamerAPI/windySchema.d.ts +27 -38
  87. package/types/types/CamStreamerAPI/wowzaSchema.d.ts +27 -38
  88. package/types/types/CamStreamerAPI/youtubeSchema.d.ts +27 -38
  89. package/types/types/CamSwitcherAPI.d.ts +8 -27
  90. package/types/types/common.d.ts +19 -0
  91. package/types/types/ws/CamStreamerEvents.d.ts +44 -0
@@ -32,6 +32,9 @@ class CamStreamerAPI {
32
32
  }
33
33
  return zod_1.z.number().parse(res.data);
34
34
  }
35
+ async getMaxFps(source = 0, options) {
36
+ return await this._getJson(`${BASE_PATH}/get_max_framerate.cgi`, { video_source: source.toString() }, options);
37
+ }
35
38
  async getStreamList(options) {
36
39
  const res = await this._getJson(`${BASE_PATH}/stream_list.cgi`, { action: 'get' }, options);
37
40
  const oldStreamListRecord = zod_1.z.record(zod_1.z.string(), oldStreamSchema_1.oldStringStreamSchema).safeParse(res.data);
@@ -44,6 +47,7 @@ class CamStreamerAPI {
44
47
  }
45
48
  const newStreamData = [];
46
49
  const oldStreamData = [];
50
+ const invalidStreamData = [];
47
51
  for (const streamData of res.data.streamList) {
48
52
  const newStreamParse = CamStreamerAPI_1.streamSchema.safeParse(streamData);
49
53
  if (newStreamParse.success) {
@@ -58,10 +62,10 @@ class CamStreamerAPI {
58
62
  });
59
63
  continue;
60
64
  }
61
- throw new Error('Failed to parse some stream entries');
65
+ invalidStreamData.push(streamData);
62
66
  }
63
67
  if (oldStreamData.length > 0) {
64
- throw new errors_1.MigrationError(newStreamData, oldStreamData);
68
+ throw new errors_1.MigrationError(newStreamData, oldStreamData, invalidStreamData);
65
69
  }
66
70
  return newStreamData;
67
71
  }
@@ -89,6 +93,12 @@ class CamStreamerAPI {
89
93
  const res = await this._getJson(`${BASE_PATH}/get_streamstat.cgi`, { stream_id: streamId }, options);
90
94
  return res.data.is_streaming === 1;
91
95
  }
96
+ async setStreamEnabled(streamId, enabled, options) {
97
+ await this._postUrlEncoded(`${BASE_PATH}/set_stream_enabled.cgi`, { stream_id: streamId, enabled: enabled ? 1 : 0 }, options);
98
+ }
99
+ async setStreamActive(streamId, active, options) {
100
+ await this._postUrlEncoded(`${BASE_PATH}/set_stream_active.cgi`, { stream_id: streamId, active: active ? 1 : 0 }, options);
101
+ }
92
102
  async listFiles(options) {
93
103
  const res = await this._getJson(`${BASE_PATH}/upload_audio.cgi`, { action: 'list' }, options);
94
104
  return CamStreamerAPI_1.audioFileListSchema.parse(res.data);
@@ -3,12 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CamSwitcherAPI = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const errors_1 = require("./errors/errors");
6
+ const convertors_1 = require("./internal/convertors");
6
7
  const utils_1 = require("./internal/utils");
7
8
  const CamSwitcherAPI_1 = require("./types/CamSwitcherAPI");
8
9
  const common_1 = require("./types/common");
9
10
  const VapixAPI_1 = require("./VapixAPI");
10
- const versionCompare_1 = require("./internal/versionCompare");
11
- const constants_1 = require("./internal/constants");
12
11
  const ProxyClient_1 = require("./internal/ProxyClient");
13
12
  const BASE_PATH = '/local/camswitcher/api';
14
13
  class CamSwitcherAPI {
@@ -139,7 +138,13 @@ class CamSwitcherAPI {
139
138
  return CamSwitcherAPI_1.clipListSchema.parse(res.data).clip_list;
140
139
  }
141
140
  setCamSwitchOptions(data, cameraFWVersion, options) {
142
- const bitrateVapixParams = parseBitrateOptionsToBitrateVapixParams(cameraFWVersion, data.bitrateMode, data);
141
+ const bitrateData = {
142
+ bitrateMode: data.bitrateMode,
143
+ maximumBitRate: data.maximumBitRate,
144
+ retentionTime: data.retentionTime,
145
+ bitRateLimit: data.bitRateLimit,
146
+ };
147
+ const bitrateVapixParams = (0, convertors_1.parseBitrateOptionsToVapixParams)(cameraFWVersion, data.bitrateMode, bitrateData);
143
148
  const saveData = {
144
149
  video: {
145
150
  resolution: data.resolution,
@@ -202,7 +207,7 @@ class CamSwitcherAPI {
202
207
  return saveData;
203
208
  }
204
209
  if (!(0, utils_1.isNullish)(saveData.video?.bitrateVapixParams)) {
205
- const bitrateOptions = parseVapixParamsToBitrateOptions(saveData.video.bitrateVapixParams);
210
+ const bitrateOptions = (0, convertors_1.parseVapixParamsToBitrateOptions)(saveData.video.bitrateVapixParams);
206
211
  saveData.video.bitrateMode = bitrateOptions.bitrateMode;
207
212
  saveData.video.maximumBitRate = bitrateOptions.maximumBitRate;
208
213
  saveData.video.retentionTime = bitrateOptions.retentionTime;
@@ -307,62 +312,3 @@ const CSW_PARAM_NAMES = {
307
312
  RTSP_TOKEN: 'Camswitcher.RTSPAccessToken',
308
313
  DEFAULT_PLAYLIST: 'Camswitcher.DefaultPlaylist',
309
314
  };
310
- const parseBitrateOptionsToBitrateVapixParams = (firmWareVersion, bitrateMode, cameraOptions) => {
311
- if (!(0, versionCompare_1.isFirmwareVersionAtLeast)(firmWareVersion, constants_1.FIRMWARE_WITH_BITRATE_MODES_SUPPORT)) {
312
- return `videomaxbitrate=${cameraOptions.maximumBitRate}`;
313
- }
314
- if (bitrateMode === undefined) {
315
- return '';
316
- }
317
- const data = {
318
- VBR: 'videobitratemode=vbr',
319
- MBR: `videobitratemode=mbr&videomaxbitrate=${cameraOptions.maximumBitRate}`,
320
- ABR: `videobitratemode=abr&videoabrtargetbitrate=${cameraOptions.maximumBitRate}&videoabrretentiontime=${cameraOptions.retentionTime}&videoabrmaxbitrate=${cameraOptions.bitRateLimit}`,
321
- };
322
- return data[bitrateMode];
323
- };
324
- const parseVapixParamsToBitrateOptions = (bitrateVapixParams) => {
325
- const params = {};
326
- const searchParams = new URLSearchParams(bitrateVapixParams);
327
- searchParams.forEach((value, key) => {
328
- params[key] = value;
329
- });
330
- const bitrateMode = params['videobitratemode'] !== undefined ? params['videobitratemode'].toUpperCase() : undefined;
331
- const hasLowerFw = bitrateMode === undefined && params['videomaxbitrate'] !== undefined;
332
- if (hasLowerFw) {
333
- const maximumBitRate = parseInt(params['videomaxbitrate'] ?? '0', 10);
334
- return {
335
- bitrateMode: 'MBR',
336
- maximumBitRate: maximumBitRate,
337
- retentionTime: 1,
338
- bitRateLimit: Math.floor(maximumBitRate * 1.1),
339
- };
340
- }
341
- if (bitrateMode === 'ABR') {
342
- const maximumBitRate = parseInt(params['videoabrtargetbitrate'] ?? '0', 10);
343
- const retentionTime = parseInt(params['videoabrretentiontime'] ?? '0', 10);
344
- const bitRateLimit = parseInt(params['videoabrmaxbitrate'] ?? '0', 10);
345
- return {
346
- bitrateMode,
347
- maximumBitRate,
348
- retentionTime,
349
- bitRateLimit,
350
- };
351
- }
352
- else if (bitrateMode === 'MBR') {
353
- const maximumBitRate = params['videomaxbitrate'] !== undefined ? parseInt(params['videomaxbitrate'], 10) : null;
354
- const oldMaximumBitrateParamValue = parseInt(params['videombrmaxbitrate'] ?? '0', 10);
355
- return {
356
- bitrateMode: bitrateMode,
357
- maximumBitRate: maximumBitRate ?? oldMaximumBitrateParamValue,
358
- retentionTime: 1,
359
- bitRateLimit: Math.floor(maximumBitRate ?? oldMaximumBitrateParamValue * 1.1),
360
- };
361
- }
362
- return {
363
- bitrateMode: bitrateMode,
364
- retentionTime: 1,
365
- maximumBitRate: 0,
366
- bitRateLimit: 0,
367
- };
368
- };
@@ -92,11 +92,12 @@ export declare class BadRequestError<T extends TResponse> extends ErrorWithRespo
92
92
  }
93
93
  export declare class MigrationError extends Error {
94
94
  readonly valid: TStream[];
95
- readonly invalid: (TOldStream & {
95
+ readonly old: (TOldStream & {
96
96
  id: number;
97
97
  })[];
98
- constructor(valid: TStream[], invalid: (TOldStream & {
98
+ readonly invalid: any[];
99
+ constructor(valid: TStream[], old: (TOldStream & {
99
100
  id: number;
100
- })[]);
101
+ })[], invalid?: any[]);
101
102
  }
102
103
  export {};
@@ -206,11 +206,13 @@ class BadRequestError extends ErrorWithResponse {
206
206
  exports.BadRequestError = BadRequestError;
207
207
  class MigrationError extends Error {
208
208
  valid;
209
+ old;
209
210
  invalid;
210
- constructor(valid, invalid) {
211
+ constructor(valid, old, invalid = []) {
211
212
  super('Migration to newer version is needed: some stream entries failed to parse.');
212
213
  this.name = 'MigrationError';
213
214
  this.valid = valid;
215
+ this.old = old;
214
216
  this.invalid = invalid;
215
217
  }
216
218
  }
package/cjs/index.d.ts 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';
package/cjs/index.js CHANGED
@@ -18,6 +18,7 @@ exports.VapixAPI = exports.CamScripterAPI = exports.PlaneTrackerEvents = exports
18
18
  __exportStar(require("./errors/errors"), exports);
19
19
  __exportStar(require("./internal/types"), exports);
20
20
  __exportStar(require("./internal/constants"), exports);
21
+ __exportStar(require("./internal/convertors"), exports);
21
22
  __exportStar(require("./internal/utils"), exports);
22
23
  __exportStar(require("./internal/versionCompare"), exports);
23
24
  __exportStar(require("./internal/ProxyClient"), exports);
@@ -1 +1,2 @@
1
1
  export declare const FIRMWARE_WITH_BITRATE_MODES_SUPPORT = "11.11.73";
2
+ export declare const FIRMWARE_WITH_OVERLAYS_SUPPORT = "10.7.0";
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FIRMWARE_WITH_BITRATE_MODES_SUPPORT = void 0;
3
+ exports.FIRMWARE_WITH_OVERLAYS_SUPPORT = exports.FIRMWARE_WITH_BITRATE_MODES_SUPPORT = void 0;
4
4
  exports.FIRMWARE_WITH_BITRATE_MODES_SUPPORT = '11.11.73';
5
+ exports.FIRMWARE_WITH_OVERLAYS_SUPPORT = '10.7.0';
@@ -0,0 +1,6 @@
1
+ import { TInternalVapixParameters } from '../types/CamStreamerAPI';
2
+ import { TBitrateMode, TBitrateVapixParams } from '../types/common';
3
+ export declare const parseBitrateOptionsToVapixParams: (firmWareVersion: string, bitrateMode: TBitrateMode | undefined, cameraOptions: Partial<TBitrateVapixParams>) => string;
4
+ export declare const parseVapixParamsToBitrateOptions: (bitrateVapixParams: string) => TBitrateVapixParams;
5
+ export declare const parseVideoOptionsToVapixParams: (firmWareVersion: string, video: TInternalVapixParameters) => string;
6
+ export declare const parseVapixParamsToVideoOptions: (internalVapixParams: string) => TInternalVapixParameters;
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseVapixParamsToVideoOptions = exports.parseVideoOptionsToVapixParams = exports.parseVapixParamsToBitrateOptions = exports.parseBitrateOptionsToVapixParams = void 0;
4
+ const constants_1 = require("./constants");
5
+ const versionCompare_1 = require("./versionCompare");
6
+ const parseBitrateOptionsToVapixParams = (firmWareVersion, bitrateMode, cameraOptions) => {
7
+ if (!(0, versionCompare_1.isFirmwareVersionAtLeast)(firmWareVersion, constants_1.FIRMWARE_WITH_BITRATE_MODES_SUPPORT)) {
8
+ return `videomaxbitrate=${cameraOptions.maximumBitRate}`;
9
+ }
10
+ if (bitrateMode === undefined) {
11
+ return '';
12
+ }
13
+ const data = {
14
+ VBR: 'videobitratemode=vbr',
15
+ MBR: `videobitratemode=mbr&videomaxbitrate=${cameraOptions.maximumBitRate}&videobitratepriority=framerate`,
16
+ ABR: `videobitratemode=abr&videoabrtargetbitrate=${cameraOptions.maximumBitRate}&videoabrretentiontime=${cameraOptions.retentionTime}&videoabrmaxbitrate=${cameraOptions.bitRateLimit}`,
17
+ };
18
+ return data[bitrateMode];
19
+ };
20
+ exports.parseBitrateOptionsToVapixParams = parseBitrateOptionsToVapixParams;
21
+ const parseVapixParamsToBitrateOptions = (bitrateVapixParams) => {
22
+ const params = {};
23
+ const searchParams = new URLSearchParams(bitrateVapixParams);
24
+ searchParams.forEach((value, key) => {
25
+ params[key] = value;
26
+ });
27
+ const bitrateMode = params['videobitratemode'] !== undefined ? params['videobitratemode'].toUpperCase() : undefined;
28
+ const hasLowerFw = bitrateMode === undefined && params['videomaxbitrate'] !== undefined;
29
+ if (hasLowerFw) {
30
+ const maximumBitRate = parseInt(params['videomaxbitrate'] ?? '0', 10);
31
+ return {
32
+ bitrateMode: 'MBR',
33
+ maximumBitRate: maximumBitRate,
34
+ retentionTime: 1,
35
+ bitRateLimit: Math.floor(maximumBitRate * 1.1),
36
+ };
37
+ }
38
+ if (bitrateMode === 'ABR') {
39
+ const maximumBitRate = parseInt(params['videoabrtargetbitrate'] ?? '0', 10);
40
+ const retentionTime = parseInt(params['videoabrretentiontime'] ?? '0', 10);
41
+ const bitRateLimit = parseInt(params['videoabrmaxbitrate'] ?? '0', 10);
42
+ return {
43
+ bitrateMode,
44
+ maximumBitRate,
45
+ retentionTime,
46
+ bitRateLimit,
47
+ };
48
+ }
49
+ else if (bitrateMode === 'MBR') {
50
+ const maximumBitRate = params['videomaxbitrate'] !== undefined ? parseInt(params['videomaxbitrate'], 10) : null;
51
+ const oldMaximumBitrateParamValue = parseInt(params['videombrmaxbitrate'] ?? '0', 10);
52
+ return {
53
+ bitrateMode: bitrateMode,
54
+ maximumBitRate: maximumBitRate ?? oldMaximumBitrateParamValue,
55
+ retentionTime: 1,
56
+ bitRateLimit: Math.floor(maximumBitRate ?? oldMaximumBitrateParamValue * 1.1),
57
+ };
58
+ }
59
+ return {
60
+ bitrateMode: bitrateMode,
61
+ retentionTime: 1,
62
+ maximumBitRate: 0,
63
+ bitRateLimit: 0,
64
+ };
65
+ };
66
+ exports.parseVapixParamsToBitrateOptions = parseVapixParamsToBitrateOptions;
67
+ const parseVideoOptionsToVapixParams = (firmWareVersion, video) => {
68
+ const bitrateParams = (0, exports.parseBitrateOptionsToVapixParams)(firmWareVersion, video.bitrateMode, {
69
+ maximumBitRate: video.maximumBitRate,
70
+ retentionTime: video.retentionTime,
71
+ bitRateLimit: video.bitRateLimit,
72
+ });
73
+ let overlaysParams = '';
74
+ if ((0, versionCompare_1.isFirmwareVersionAtLeast)(firmWareVersion, constants_1.FIRMWARE_WITH_OVERLAYS_SUPPORT)) {
75
+ overlaysParams = `&overlays=${video.overlays}`;
76
+ }
77
+ const nbrOfChannels = video.audio === 1 ? `&nbrOfChannels=${video.nbrOfChannels}` : '';
78
+ const audioParams = `audio=${video.audio}${nbrOfChannels}`;
79
+ const videoCodecParams = video.videoCodec === 'h264'
80
+ ? `videoCodec=${video.videoCodec}&h264Profile=${video.h264Profile}`
81
+ : `videoCodec=${video.videoCodec}`;
82
+ const videoParams = `camera=${video.camera}&resolution=${video.resolution}&fps=${video.fps}&compression=${video.compression}&videokeyframeinterval=${video.govLength}&${videoCodecParams}${overlaysParams}`;
83
+ return [videoParams, bitrateParams, audioParams].join('&');
84
+ };
85
+ exports.parseVideoOptionsToVapixParams = parseVideoOptionsToVapixParams;
86
+ const parseVapixParamsToVideoOptions = (internalVapixParams) => {
87
+ const bitrateOptions = (0, exports.parseVapixParamsToBitrateOptions)(internalVapixParams);
88
+ const params = {};
89
+ const searchParams = new URLSearchParams(internalVapixParams);
90
+ searchParams.forEach((value, key) => {
91
+ params[key] = value;
92
+ });
93
+ let h264Profile = undefined;
94
+ if (params['videoCodec'] === 'h264') {
95
+ h264Profile = (params['h264Profile'] ?? 'high');
96
+ }
97
+ let nbrOfChannels = undefined;
98
+ if (params['audio'] === '1') {
99
+ nbrOfChannels = parseInt(params['nbrOfChannels'] ?? '1');
100
+ }
101
+ return {
102
+ ...bitrateOptions,
103
+ camera: params['camera'] ?? '1',
104
+ resolution: params['resolution'] ?? '',
105
+ fps: parseInt(params['fps'] ?? '0', 10),
106
+ compression: parseInt(params['compression'] ?? '0', 10),
107
+ govLength: parseInt(params['videokeyframeinterval'] ?? '0', 10),
108
+ videoCodec: (params['videoCodec'] ?? 'h264'),
109
+ h264Profile,
110
+ audio: parseInt(params['audio'] ?? '0'),
111
+ nbrOfChannels,
112
+ overlays: params['overlays'],
113
+ };
114
+ };
115
+ exports.parseVapixParamsToVideoOptions = parseVapixParamsToVideoOptions;
@@ -230,12 +230,13 @@ export declare const servicesSchema: z.ZodDiscriminatedUnion<"name", [z.ZodObjec
230
230
  generalAddress: z.ZodOptional<z.ZodString>;
231
231
  showDegrees: z.ZodDefault<z.ZodBoolean>;
232
232
  }, "strip", z.ZodTypeAny, {
233
- type: "map" | "compass" | "image";
233
+ type: "map" | "image" | "compass";
234
234
  name: "ptzCompass";
235
235
  enabled: 0 | 1;
236
236
  id: number;
237
237
  width: number;
238
238
  height: number;
239
+ image: string;
239
240
  automationType: "manual" | "schedule" | "time" | `input${number}`;
240
241
  cameraList: number[];
241
242
  customName: string;
@@ -243,7 +244,6 @@ export declare const servicesSchema: z.ZodDiscriminatedUnion<"name", [z.ZodObjec
243
244
  pos_y: number;
244
245
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
245
246
  scale: number;
246
- image: string;
247
247
  northPan: number;
248
248
  cameraPosX: number;
249
249
  cameraPosY: number;
@@ -261,19 +261,19 @@ export declare const servicesSchema: z.ZodDiscriminatedUnion<"name", [z.ZodObjec
261
261
  generalIframeHeight?: number | undefined;
262
262
  generalAddress?: string | undefined;
263
263
  }, {
264
- type: "map" | "compass" | "image";
264
+ type: "map" | "image" | "compass";
265
265
  name: "ptzCompass";
266
266
  enabled: 0 | 1;
267
267
  id: number;
268
268
  width: number;
269
269
  height: number;
270
+ image: string;
270
271
  automationType: "manual" | "schedule" | "time" | `input${number}`;
271
272
  cameraList: number[];
272
273
  pos_x: number;
273
274
  pos_y: number;
274
275
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
275
276
  scale: number;
276
- image: string;
277
277
  northPan: number;
278
278
  cameraPosX: number;
279
279
  cameraPosY: number;
@@ -874,13 +874,13 @@ export declare const servicesSchema: z.ZodDiscriminatedUnion<"name", [z.ZodObjec
874
874
  id: number;
875
875
  width: number;
876
876
  height: number;
877
+ image: string;
877
878
  automationType: "manual" | "schedule" | "time" | `input${number}`;
878
879
  cameraList: number[];
879
880
  customName: string;
880
881
  pos_x: number;
881
882
  pos_y: number;
882
883
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
883
- image: string;
884
884
  clockFormat: "12h" | "24h";
885
885
  background: "custom" | "image";
886
886
  customAreaColor: string;
@@ -954,12 +954,12 @@ export declare const servicesSchema: z.ZodDiscriminatedUnion<"name", [z.ZodObjec
954
954
  id: number;
955
955
  width: number;
956
956
  height: number;
957
+ image: string;
957
958
  automationType: "manual" | "schedule" | "time" | `input${number}`;
958
959
  cameraList: number[];
959
960
  pos_x: number;
960
961
  pos_y: number;
961
962
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
962
- image: string;
963
963
  clockFormat: "12h" | "24h";
964
964
  background: "custom" | "image";
965
965
  customAreaColor: string;
@@ -1703,12 +1703,13 @@ export declare const serviceListSchema: z.ZodObject<{
1703
1703
  generalAddress: z.ZodOptional<z.ZodString>;
1704
1704
  showDegrees: z.ZodDefault<z.ZodBoolean>;
1705
1705
  }, "strip", z.ZodTypeAny, {
1706
- type: "map" | "compass" | "image";
1706
+ type: "map" | "image" | "compass";
1707
1707
  name: "ptzCompass";
1708
1708
  enabled: 0 | 1;
1709
1709
  id: number;
1710
1710
  width: number;
1711
1711
  height: number;
1712
+ image: string;
1712
1713
  automationType: "manual" | "schedule" | "time" | `input${number}`;
1713
1714
  cameraList: number[];
1714
1715
  customName: string;
@@ -1716,7 +1717,6 @@ export declare const serviceListSchema: z.ZodObject<{
1716
1717
  pos_y: number;
1717
1718
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
1718
1719
  scale: number;
1719
- image: string;
1720
1720
  northPan: number;
1721
1721
  cameraPosX: number;
1722
1722
  cameraPosY: number;
@@ -1734,19 +1734,19 @@ export declare const serviceListSchema: z.ZodObject<{
1734
1734
  generalIframeHeight?: number | undefined;
1735
1735
  generalAddress?: string | undefined;
1736
1736
  }, {
1737
- type: "map" | "compass" | "image";
1737
+ type: "map" | "image" | "compass";
1738
1738
  name: "ptzCompass";
1739
1739
  enabled: 0 | 1;
1740
1740
  id: number;
1741
1741
  width: number;
1742
1742
  height: number;
1743
+ image: string;
1743
1744
  automationType: "manual" | "schedule" | "time" | `input${number}`;
1744
1745
  cameraList: number[];
1745
1746
  pos_x: number;
1746
1747
  pos_y: number;
1747
1748
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
1748
1749
  scale: number;
1749
- image: string;
1750
1750
  northPan: number;
1751
1751
  cameraPosX: number;
1752
1752
  cameraPosY: number;
@@ -2347,13 +2347,13 @@ export declare const serviceListSchema: z.ZodObject<{
2347
2347
  id: number;
2348
2348
  width: number;
2349
2349
  height: number;
2350
+ image: string;
2350
2351
  automationType: "manual" | "schedule" | "time" | `input${number}`;
2351
2352
  cameraList: number[];
2352
2353
  customName: string;
2353
2354
  pos_x: number;
2354
2355
  pos_y: number;
2355
2356
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
2356
- image: string;
2357
2357
  clockFormat: "12h" | "24h";
2358
2358
  background: "custom" | "image";
2359
2359
  customAreaColor: string;
@@ -2427,12 +2427,12 @@ export declare const serviceListSchema: z.ZodObject<{
2427
2427
  id: number;
2428
2428
  width: number;
2429
2429
  height: number;
2430
+ image: string;
2430
2431
  automationType: "manual" | "schedule" | "time" | `input${number}`;
2431
2432
  cameraList: number[];
2432
2433
  pos_x: number;
2433
2434
  pos_y: number;
2434
2435
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
2435
- image: string;
2436
2436
  clockFormat: "12h" | "24h";
2437
2437
  background: "custom" | "image";
2438
2438
  customAreaColor: string;
@@ -3025,12 +3025,13 @@ export declare const serviceListSchema: z.ZodObject<{
3025
3025
  invertInput?: boolean | undefined;
3026
3026
  zIndex?: number | undefined;
3027
3027
  } | {
3028
- type: "map" | "compass" | "image";
3028
+ type: "map" | "image" | "compass";
3029
3029
  name: "ptzCompass";
3030
3030
  enabled: 0 | 1;
3031
3031
  id: number;
3032
3032
  width: number;
3033
3033
  height: number;
3034
+ image: string;
3034
3035
  automationType: "manual" | "schedule" | "time" | `input${number}`;
3035
3036
  cameraList: number[];
3036
3037
  customName: string;
@@ -3038,7 +3039,6 @@ export declare const serviceListSchema: z.ZodObject<{
3038
3039
  pos_y: number;
3039
3040
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
3040
3041
  scale: number;
3041
- image: string;
3042
3042
  northPan: number;
3043
3043
  cameraPosX: number;
3044
3044
  cameraPosY: number;
@@ -3148,13 +3148,13 @@ export declare const serviceListSchema: z.ZodObject<{
3148
3148
  id: number;
3149
3149
  width: number;
3150
3150
  height: number;
3151
+ image: string;
3151
3152
  automationType: "manual" | "schedule" | "time" | `input${number}`;
3152
3153
  cameraList: number[];
3153
3154
  customName: string;
3154
3155
  pos_x: number;
3155
3156
  pos_y: number;
3156
3157
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
3157
- image: string;
3158
3158
  clockFormat: "12h" | "24h";
3159
3159
  background: "custom" | "image";
3160
3160
  customAreaColor: string;
@@ -3436,19 +3436,19 @@ export declare const serviceListSchema: z.ZodObject<{
3436
3436
  customName?: string | undefined;
3437
3437
  zIndex?: number | undefined;
3438
3438
  } | {
3439
- type: "map" | "compass" | "image";
3439
+ type: "map" | "image" | "compass";
3440
3440
  name: "ptzCompass";
3441
3441
  enabled: 0 | 1;
3442
3442
  id: number;
3443
3443
  width: number;
3444
3444
  height: number;
3445
+ image: string;
3445
3446
  automationType: "manual" | "schedule" | "time" | `input${number}`;
3446
3447
  cameraList: number[];
3447
3448
  pos_x: number;
3448
3449
  pos_y: number;
3449
3450
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
3450
3451
  scale: number;
3451
- image: string;
3452
3452
  northPan: number;
3453
3453
  cameraPosX: number;
3454
3454
  cameraPosY: number;
@@ -3559,12 +3559,12 @@ export declare const serviceListSchema: z.ZodObject<{
3559
3559
  id: number;
3560
3560
  width: number;
3561
3561
  height: number;
3562
+ image: string;
3562
3563
  automationType: "manual" | "schedule" | "time" | `input${number}`;
3563
3564
  cameraList: number[];
3564
3565
  pos_x: number;
3565
3566
  pos_y: number;
3566
3567
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
3567
- image: string;
3568
3568
  clockFormat: "12h" | "24h";
3569
3569
  background: "custom" | "image";
3570
3570
  customAreaColor: string;
@@ -3825,13 +3825,13 @@ export declare const isCustomGraphics: (service: TService) => service is {
3825
3825
  id: number;
3826
3826
  width: number;
3827
3827
  height: number;
3828
+ image: string;
3828
3829
  automationType: "manual" | "schedule" | "time" | `input${number}`;
3829
3830
  cameraList: number[];
3830
3831
  customName: string;
3831
3832
  pos_x: number;
3832
3833
  pos_y: number;
3833
3834
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
3834
- image: string;
3835
3835
  clockFormat: "12h" | "24h";
3836
3836
  background: "custom" | "image";
3837
3837
  customAreaColor: string;
@@ -4001,12 +4001,13 @@ export declare const isPip: (service: TService) => service is {
4001
4001
  };
4002
4002
  export type TPtzCompass = z.infer<typeof ptzCompassSchema>;
4003
4003
  export declare const isPtzCompass: (service: TService) => service is {
4004
- type: "map" | "compass" | "image";
4004
+ type: "map" | "image" | "compass";
4005
4005
  name: "ptzCompass";
4006
4006
  enabled: 0 | 1;
4007
4007
  id: number;
4008
4008
  width: number;
4009
4009
  height: number;
4010
+ image: string;
4010
4011
  automationType: "manual" | "schedule" | "time" | `input${number}`;
4011
4012
  cameraList: number[];
4012
4013
  customName: string;
@@ -4014,7 +4015,6 @@ export declare const isPtzCompass: (service: TService) => service is {
4014
4015
  pos_y: number;
4015
4016
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
4016
4017
  scale: number;
4017
- image: string;
4018
4018
  northPan: number;
4019
4019
  cameraPosX: number;
4020
4020
  cameraPosY: number;
@@ -529,13 +529,13 @@ export declare const customGraphicsSchema: z.ZodObject<{
529
529
  id: number;
530
530
  width: number;
531
531
  height: number;
532
+ image: string;
532
533
  automationType: "manual" | "schedule" | "time" | `input${number}`;
533
534
  cameraList: number[];
534
535
  customName: string;
535
536
  pos_x: number;
536
537
  pos_y: number;
537
538
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
538
- image: string;
539
539
  clockFormat: "12h" | "24h";
540
540
  background: "custom" | "image";
541
541
  customAreaColor: string;
@@ -609,12 +609,12 @@ export declare const customGraphicsSchema: z.ZodObject<{
609
609
  id: number;
610
610
  width: number;
611
611
  height: number;
612
+ image: string;
612
613
  automationType: "manual" | "schedule" | "time" | `input${number}`;
613
614
  cameraList: number[];
614
615
  pos_x: number;
615
616
  pos_y: number;
616
617
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
617
- image: string;
618
618
  clockFormat: "12h" | "24h";
619
619
  background: "custom" | "image";
620
620
  customAreaColor: string;
@@ -32,12 +32,13 @@ export declare const ptzCompassSchema: z.ZodObject<{
32
32
  generalAddress: z.ZodOptional<z.ZodString>;
33
33
  showDegrees: z.ZodDefault<z.ZodBoolean>;
34
34
  }, "strip", z.ZodTypeAny, {
35
- type: "map" | "compass" | "image";
35
+ type: "map" | "image" | "compass";
36
36
  name: "ptzCompass";
37
37
  enabled: 0 | 1;
38
38
  id: number;
39
39
  width: number;
40
40
  height: number;
41
+ image: string;
41
42
  automationType: "manual" | "schedule" | "time" | `input${number}`;
42
43
  cameraList: number[];
43
44
  customName: string;
@@ -45,7 +46,6 @@ export declare const ptzCompassSchema: z.ZodObject<{
45
46
  pos_y: number;
46
47
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
47
48
  scale: number;
48
- image: string;
49
49
  northPan: number;
50
50
  cameraPosX: number;
51
51
  cameraPosY: number;
@@ -63,19 +63,19 @@ export declare const ptzCompassSchema: z.ZodObject<{
63
63
  generalIframeHeight?: number | undefined;
64
64
  generalAddress?: string | undefined;
65
65
  }, {
66
- type: "map" | "compass" | "image";
66
+ type: "map" | "image" | "compass";
67
67
  name: "ptzCompass";
68
68
  enabled: 0 | 1;
69
69
  id: number;
70
70
  width: number;
71
71
  height: number;
72
+ image: string;
72
73
  automationType: "manual" | "schedule" | "time" | `input${number}`;
73
74
  cameraList: number[];
74
75
  pos_x: number;
75
76
  pos_y: number;
76
77
  coordSystem: "top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right";
77
78
  scale: number;
78
- image: string;
79
79
  northPan: number;
80
80
  cameraPosX: number;
81
81
  cameraPosY: number;