camstreamerlib 4.0.0-beta.121 → 4.0.0-beta.122

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.
@@ -2870,7 +2870,13 @@ export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> exte
2870
2870
  streamIdentifier?: string | undefined;
2871
2871
  }>;
2872
2872
  setStream(streamId: string, streamData: TStream, options?: THttpRequestOptions): Promise<void>;
2873
- isStreaming(streamId: string, options?: THttpRequestOptions): Promise<boolean>;
2873
+ getStreamStats(streamId: number, options?: THttpRequestOptions): Promise<{
2874
+ net_stats: string;
2875
+ stream_bytes_time_ms: number;
2876
+ stream_bytes: number;
2877
+ start_count: number;
2878
+ is_streaming: number;
2879
+ }>;
2874
2880
  setStreamEnabled(streamId: string, enabled: boolean, options?: THttpRequestOptions): Promise<void>;
2875
2881
  setStreamActive(streamId: string, active: boolean, options?: THttpRequestOptions): Promise<void>;
2876
2882
  listFiles(options?: THttpRequestOptions): Promise<{
@@ -91,9 +91,9 @@ class CamStreamerAPI extends BasicAPI_1.BasicAPI {
91
91
  stream_id: streamId,
92
92
  }, options);
93
93
  }
94
- async isStreaming(streamId, options) {
94
+ async getStreamStats(streamId, options) {
95
95
  const res = await this._getJson(`${BASE_PATH}/get_streamstat.cgi`, { stream_id: streamId }, options);
96
- return res.data.is_streaming === 1;
96
+ return CamStreamerAPI_1.streamStatsSchema.parse(res.data);
97
97
  }
98
98
  async setStreamEnabled(streamId, enabled, options) {
99
99
  await this._postUrlEncoded(`${BASE_PATH}/set_stream_enabled.cgi`, { stream_id: streamId, enabled: enabled ? 1 : 0 }, options);
@@ -20256,3 +20256,23 @@ export declare const audioLocalSchema: z.ZodObject<{
20256
20256
  storage: "flash" | "SD0";
20257
20257
  }>;
20258
20258
  export type TAudioLocalType = z.infer<typeof audioLocalSchema>;
20259
+ export declare const streamStatsSchema: z.ZodObject<{
20260
+ net_stats: z.ZodString;
20261
+ stream_bytes_time_ms: z.ZodNumber;
20262
+ stream_bytes: z.ZodNumber;
20263
+ start_count: z.ZodNumber;
20264
+ is_streaming: z.ZodNumber;
20265
+ }, "strip", z.ZodTypeAny, {
20266
+ net_stats: string;
20267
+ stream_bytes_time_ms: number;
20268
+ stream_bytes: number;
20269
+ start_count: number;
20270
+ is_streaming: number;
20271
+ }, {
20272
+ net_stats: string;
20273
+ stream_bytes_time_ms: number;
20274
+ stream_bytes: number;
20275
+ start_count: number;
20276
+ is_streaming: number;
20277
+ }>;
20278
+ export type TStreamStats = z.infer<typeof streamStatsSchema>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.audioLocalSchema = exports.audioUrlSchema = exports.audioFileListSchema = exports.audioFileSchema = exports.storageListSchema = exports.audioFileStorageTypeSchema = exports.AudioType = exports.isYoutubeRtmpStream = exports.isGameChangerStream = exports.isMicrosoftStream = exports.isMicrosoftAzureStream = exports.isIbmStream = exports.isDailymotionStream = exports.isWowzaStream = exports.isHlsPushStream = exports.isHlsPullStream = exports.isDaCastStream = exports.isSrtStream = exports.isChurchStream = exports.isTwitchStream = exports.isVimeoStream = exports.isYouTubeStream = exports.isWindyStream = exports.isSdCardStream = exports.isRtmpStream = exports.isMpegDvbStream = exports.isFacebookStream = exports.streamListSchema = exports.streamSchema = void 0;
3
+ exports.streamStatsSchema = exports.audioLocalSchema = exports.audioUrlSchema = exports.audioFileListSchema = exports.audioFileSchema = exports.storageListSchema = exports.audioFileStorageTypeSchema = exports.AudioType = exports.isYoutubeRtmpStream = exports.isGameChangerStream = exports.isMicrosoftStream = exports.isMicrosoftAzureStream = exports.isIbmStream = exports.isDailymotionStream = exports.isWowzaStream = exports.isHlsPushStream = exports.isHlsPullStream = exports.isDaCastStream = exports.isSrtStream = exports.isChurchStream = exports.isTwitchStream = exports.isVimeoStream = exports.isYouTubeStream = exports.isWindyStream = exports.isSdCardStream = exports.isRtmpStream = exports.isMpegDvbStream = exports.isFacebookStream = exports.streamListSchema = exports.streamSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const facebookSchema_1 = require("./facebookSchema");
6
6
  const windySchema_1 = require("./windySchema");
@@ -142,3 +142,10 @@ exports.audioLocalSchema = zod_1.z.object({
142
142
  name: zod_1.z.string(),
143
143
  storage: zod_1.z.enum(['flash', 'SD0']),
144
144
  });
145
+ exports.streamStatsSchema = zod_1.z.object({
146
+ net_stats: zod_1.z.string(),
147
+ stream_bytes_time_ms: zod_1.z.number(),
148
+ stream_bytes: zod_1.z.number(),
149
+ start_count: zod_1.z.number(),
150
+ is_streaming: zod_1.z.number(),
151
+ });
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { audioFileListSchema, storageListSchema, streamSchema, } from './types/CamStreamerAPI/CamStreamerAPI';
2
+ import { audioFileListSchema, storageListSchema, streamSchema, streamStatsSchema, } from './types/CamStreamerAPI/CamStreamerAPI';
3
3
  import { UtcTimeFetchError, WsAuthorizationError, MigrationError } from './errors/errors';
4
4
  import { oldStringStreamSchema, oldStringStreamSchemaWithId, } from './types/CamStreamerAPI/oldStreamSchema';
5
5
  import { BasicAPI } from './internal/BasicAPI';
@@ -88,9 +88,9 @@ export class CamStreamerAPI extends BasicAPI {
88
88
  stream_id: streamId,
89
89
  }, options);
90
90
  }
91
- async isStreaming(streamId, options) {
91
+ async getStreamStats(streamId, options) {
92
92
  const res = await this._getJson(`${BASE_PATH}/get_streamstat.cgi`, { stream_id: streamId }, options);
93
- return res.data.is_streaming === 1;
93
+ return streamStatsSchema.parse(res.data);
94
94
  }
95
95
  async setStreamEnabled(streamId, enabled, options) {
96
96
  await this._postUrlEncoded(`${BASE_PATH}/set_stream_enabled.cgi`, { stream_id: streamId, enabled: enabled ? 1 : 0 }, options);
@@ -119,3 +119,10 @@ export const audioLocalSchema = z.object({
119
119
  name: z.string(),
120
120
  storage: z.enum(['flash', 'SD0']),
121
121
  });
122
+ export const streamStatsSchema = z.object({
123
+ net_stats: z.string(),
124
+ stream_bytes_time_ms: z.number(),
125
+ stream_bytes: z.number(),
126
+ start_count: z.number(),
127
+ is_streaming: z.number(),
128
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstreamerlib",
3
- "version": "4.0.0-beta.121",
3
+ "version": "4.0.0-beta.122",
4
4
  "description": "Helper library for CamStreamer ACAP applications.",
5
5
  "prettier": "@camstreamer/prettier-config",
6
6
  "engine": {
@@ -2870,7 +2870,13 @@ export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> exte
2870
2870
  streamIdentifier?: string | undefined;
2871
2871
  }>;
2872
2872
  setStream(streamId: string, streamData: TStream, options?: THttpRequestOptions): Promise<void>;
2873
- isStreaming(streamId: string, options?: THttpRequestOptions): Promise<boolean>;
2873
+ getStreamStats(streamId: number, options?: THttpRequestOptions): Promise<{
2874
+ net_stats: string;
2875
+ stream_bytes_time_ms: number;
2876
+ stream_bytes: number;
2877
+ start_count: number;
2878
+ is_streaming: number;
2879
+ }>;
2874
2880
  setStreamEnabled(streamId: string, enabled: boolean, options?: THttpRequestOptions): Promise<void>;
2875
2881
  setStreamActive(streamId: string, active: boolean, options?: THttpRequestOptions): Promise<void>;
2876
2882
  listFiles(options?: THttpRequestOptions): Promise<{
@@ -20256,3 +20256,23 @@ export declare const audioLocalSchema: z.ZodObject<{
20256
20256
  storage: "flash" | "SD0";
20257
20257
  }>;
20258
20258
  export type TAudioLocalType = z.infer<typeof audioLocalSchema>;
20259
+ export declare const streamStatsSchema: z.ZodObject<{
20260
+ net_stats: z.ZodString;
20261
+ stream_bytes_time_ms: z.ZodNumber;
20262
+ stream_bytes: z.ZodNumber;
20263
+ start_count: z.ZodNumber;
20264
+ is_streaming: z.ZodNumber;
20265
+ }, "strip", z.ZodTypeAny, {
20266
+ net_stats: string;
20267
+ stream_bytes_time_ms: number;
20268
+ stream_bytes: number;
20269
+ start_count: number;
20270
+ is_streaming: number;
20271
+ }, {
20272
+ net_stats: string;
20273
+ stream_bytes_time_ms: number;
20274
+ stream_bytes: number;
20275
+ start_count: number;
20276
+ is_streaming: number;
20277
+ }>;
20278
+ export type TStreamStats = z.infer<typeof streamStatsSchema>;