@ceeblue/web-utils 7.2.0 → 7.4.0

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.
@@ -1,3 +1,6 @@
1
+ import * as CML from '@svta/common-media-library';
2
+ export { CML };
3
+
1
4
  declare class BinaryReader {
2
5
  private _data;
3
6
  private _size;
@@ -19,7 +22,7 @@ declare class BinaryReader {
19
22
  read64(): number;
20
23
  readFloat(): number;
21
24
  readDouble(): number;
22
- read7Bit(bytes?: number): number;
25
+ read7Bit(): number;
23
26
  readString(): string;
24
27
  readHex(size: number): string;
25
28
  /**
@@ -136,7 +139,7 @@ interface ILog {
136
139
  /**
137
140
  * Intercept,redefine or redirect any log
138
141
  * If you clear args you intercept the log and nothing happen more after this call.
139
- * @param type log level
142
+ * @param level log level
140
143
  * @param args args
141
144
  * @returns
142
145
  */
@@ -144,7 +147,7 @@ interface ILog {
144
147
  /**
145
148
  * Change log level, default log level is {@link LogLevel.INFO},
146
149
  * Boolean can be user to lets pass all the logs with `true` or disables all the logs with `false`.
147
- * @note To debug production code without modifying it you can use a special query parameter
150
+ * @remarks To debug production code without modifying it you can use a special query parameter
148
151
  * called !cb-override-log-level to override this configuration.
149
152
  */
150
153
  level?: LogLevel | boolean;
@@ -353,6 +356,7 @@ declare enum Type {
353
356
  HESP = "HESP",
354
357
  WRTS = "WebRTS",
355
358
  WEBRTC = "WebRTC",
359
+ DIRECT_STREAMING = "DirectStreaming",
356
360
  META = "Meta",
357
361
  DATA = "Data"
358
362
  }
@@ -817,10 +821,12 @@ declare const SDP: {
817
821
  */
818
822
  declare const EMPTY_FUNCTION: () => void;
819
823
  /**
820
- * Returns an efficient timestamp in milliseconds elapsed since {@link performance.timeOrigin},
824
+ * Returns an efficient timestamp in milliseconds elapsed since performance.timeOrigin,
821
825
  * representing the start of the current JavaScript execution context.
822
826
  *
823
- * Note: Each Web Worker runs in a separate JS context, so timestamps
827
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Performance/timeOrigin
828
+ *
829
+ * @remarks Each Web Worker runs in a separate JS context, so timestamps
824
830
  * are not directly comparable between different workers. Use {@link unixTime}
825
831
  * for comparable timestamps across different Web Workers.
826
832
  */
@@ -956,11 +962,10 @@ declare function trimEnd(value: string, chars?: string): string;
956
962
  * Property lookup (e.g. `obj.Foo` or `obj.foo`) will resolve to the same underlying key, regardless of casing.
957
963
  * Only affects string-based property access (not symbols).
958
964
  *
959
- * @template T
960
- * @param {T} obj - The original object.
961
- * @returns {T} A proxied object with case-insensitive property access.
965
+ * @param obj - The original object.
966
+ * @returns A proxied object with case-insensitive property access.
962
967
  */
963
- declare function caseInsensitive<T extends Record<string, any>>(obj: any): T;
968
+ declare function caseInsensitive(obj: any): Record<string, any>;
964
969
 
965
970
  declare const Util_EMPTY_FUNCTION: typeof EMPTY_FUNCTION;
966
971
  declare const Util_caseInsensitive: typeof caseInsensitive;
@@ -1182,6 +1187,51 @@ declare namespace EpochTime {
1182
1187
  export { EpochTime_decodeTimestamp as decodeTimestamp, EpochTime_encodeTimestamp as encodeTimestamp, EpochTime_getLatency as getLatency };
1183
1188
  }
1184
1189
 
1190
+ /**
1191
+ * Copyright 2024 Ceeblue B.V.
1192
+ * This file is part of https://github.com/CeeblueTV/web-utils which is released under GNU Affero General Public License.
1193
+ * See file LICENSE or go to https://spdx.org/licenses/AGPL-3.0-or-later.html for full license details.
1194
+ */
1195
+
1196
+ /**
1197
+ * Collects variable names for player statistics metrics across different projects (e.g., wrts, webrtc).
1198
+ * Variables remain undefined if they are not present in the stats for the current project
1199
+ * (for example, 'latency' is undefined for webrtc).
1200
+ * Includes the toCmcd() method to convert stats into a CMCD payload.
1201
+ */
1202
+ declare class PlayerStats {
1203
+ protocol?: string;
1204
+ currentTime?: number;
1205
+ waitingData?: boolean;
1206
+ bufferAmount?: number;
1207
+ latency?: number;
1208
+ rtt?: number;
1209
+ jitter?: number;
1210
+ playbackSpeed?: number;
1211
+ playbackRate?: number;
1212
+ recvByteRate?: number;
1213
+ sendByteRate?: number;
1214
+ videoTrackId?: number;
1215
+ videoTrackBandwidth?: number;
1216
+ audioTrackId?: number;
1217
+ audioTrackBandwidth?: number;
1218
+ videoPerSecond?: number;
1219
+ audioPerSecond?: number;
1220
+ skippedVideoCount?: number;
1221
+ skippedAudioCount?: number;
1222
+ lostPacketCount?: number;
1223
+ nackCount?: number;
1224
+ stallCount?: number;
1225
+ /**
1226
+ * Converts the current {@link PlayerStats} snapshot into a CMCD (Common Media Client Data) payload.
1227
+ * @param url - The full URL of the media object.
1228
+ * @param trackId - The track ID for which to generate the CMCD payload.
1229
+ * @param prevStats - Optional previous {@link PlayerStats} snapshot to calculate deltas for incremental metrics since their last reset.
1230
+ * @returns A {@link CML.Cmcd} object representing the CMCD payload.
1231
+ */
1232
+ toCmcd(url: URL, trackId: number, prevStats?: PlayerStats): CML.Cmcd;
1233
+ }
1234
+
1185
1235
  /**
1186
1236
  * Copyright 2024 Ceeblue B.V.
1187
1237
  * This file is part of https://github.com/CeeblueTV/web-utils which is released under GNU Affero General Public License.
@@ -1279,4 +1329,4 @@ declare class UIMetrics {
1279
1329
 
1280
1330
  declare const VERSION: string;
1281
1331
 
1282
- export { BinaryReader, BinaryWriter, BitReader, ByteRate, Connect, EpochTime, EventEmitter, FixMap, type ILog, Log, LogLevel, Loggable, NetAddress, Numbers, Queue, SDP, UIMetrics, Util, VERSION, WebSocketReliable, type WebSocketReliableError, log };
1332
+ export { BinaryReader, BinaryWriter, BitReader, ByteRate, Connect, EpochTime, EventEmitter, FixMap, type ILog, Log, LogLevel, Loggable, NetAddress, Numbers, PlayerStats, Queue, SDP, UIMetrics, Util, VERSION, WebSocketReliable, type WebSocketReliableError, log };