@vindral/web-sdk 2.0.23 → 2.0.24

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/index.d.ts CHANGED
@@ -75,12 +75,13 @@ interface InitSegment {
75
75
  }
76
76
  declare type MatchingKeys<TRecord, TMatch, K extends keyof TRecord = keyof TRecord> = K extends (TRecord[K] extends TMatch ? K : never) ? K : never;
77
77
  declare type VoidKeys<Record> = MatchingKeys<Record, void>;
78
+ declare type EventListenerReturnType = (() => void) | void;
78
79
  declare class Emitter<TEvents, TEmits = TEvents, ArgLessEvents extends VoidKeys<TEvents> = VoidKeys<TEvents>, ArgEvents extends Exclude<keyof TEvents, ArgLessEvents> = Exclude<keyof TEvents, ArgLessEvents>, ArgLessEmits extends VoidKeys<TEmits> = VoidKeys<TEmits>, ArgEmits extends Exclude<keyof TEmits, ArgLessEmits> = Exclude<keyof TEmits, ArgLessEmits>> {
79
80
  private listeners;
80
81
  emit<T extends ArgLessEmits>(eventName: T): void;
81
82
  emit<T extends ArgEmits>(eventName: T, args: TEmits[T]): void;
82
- off<T extends ArgLessEvents>(eventName: T, fn: () => void): void;
83
- off<T extends ArgEvents>(eventName: T, fn: (args: TEvents[T]) => void): void;
83
+ off<T extends ArgLessEvents>(eventName: T, fn: () => EventListenerReturnType): void;
84
+ off<T extends ArgEvents>(eventName: T, fn: (args: TEvents[T]) => EventListenerReturnType): void;
84
85
  on<T extends ArgLessEvents>(eventName: T, fn: () => void): void;
85
86
  on<T extends ArgEvents>(eventName: T, fn: (args: TEvents[T]) => void): void;
86
87
  once<T extends ArgLessEvents>(eventName: T, fn: () => void): void;
@@ -437,7 +438,7 @@ declare class BufferTimeModule {
437
438
  interface VindralErrorProps {
438
439
  isFatal: boolean;
439
440
  code: string;
440
- source?: Error;
441
+ source?: Error | MediaError;
441
442
  }
442
443
  export declare const CONNECTION_FAILED_CODE = "connection_failed";
443
444
  export declare const CONNECTION_FAILED_AFTER_RETRIES_CODE = "connection_failed_will_not_attempt_again";
@@ -448,24 +449,26 @@ export declare const NO_INCOMING_DATA = "no_incoming_data_error";
448
449
  export declare const INACTIVITY_CODE = "connection_inactivity";
449
450
  export declare const MISSING_INIT_SEGMENT = "missing_init_segment";
450
451
  export declare const NO_TRACK_CONTEXT = "no_track_context";
452
+ export declare const DISCONNECTED_BY_EDGE = "disconnected_by_edge";
451
453
  export declare class VindralError extends Error {
452
454
  private props;
453
455
  private extra;
454
456
  constructor(message: string, props: VindralErrorProps, extra?: {});
455
457
  code: () => string;
456
458
  isFatal: () => boolean;
457
- source: () => Error | undefined;
459
+ source: () => Error | MediaError | undefined;
458
460
  toStringifiable: () => Record<string, unknown>;
459
461
  }
460
- export declare const mediaElementError: (isFatal: boolean, mediaError: MediaError) => VindralError;
462
+ export declare const mediaElementError: (isFatal: boolean, source: MediaError) => VindralError;
461
463
  export declare const missingInitSegmentError: (renditionId: number, channelId: string) => VindralError;
462
464
  export declare const noTrackContextError: (type: "audio" | "video", renditionId: number, channelId: string) => VindralError;
463
465
  export declare const audioContextTimeoutError: () => VindralError;
464
- export declare const authenticationError: () => VindralError;
465
- export declare const authenticationExpiredError: () => VindralError;
466
- export declare const inactivityError: () => VindralError;
467
- export declare const channelNotFoundError: () => VindralError;
468
- export declare const noIncomingDataError: () => VindralError;
466
+ export declare const disconnectedFromEdgeServerError: (source?: VindralError | undefined) => VindralError;
467
+ export declare const authenticationError: (source?: Error | undefined) => VindralError;
468
+ export declare const authenticationExpiredError: (source?: Error | undefined) => VindralError;
469
+ export declare const inactivityError: (source?: Error | undefined) => VindralError;
470
+ export declare const channelNotFoundError: (source?: Error | undefined) => VindralError;
471
+ export declare const noIncomingDataError: (source?: Error | undefined) => VindralError;
469
472
  export declare const unableToConnectError: (source?: Error | undefined) => VindralError;
470
473
  export declare const unableToConnectAfterRetriesError: () => VindralError;
471
474
  declare type State = "connected" | "disconnected" | "connecting";
@@ -1174,6 +1177,8 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1174
1177
  private apiClient;
1175
1178
  private latestEmittedLanguages;
1176
1179
  private wakeLock;
1180
+ private cachedEdges;
1181
+ private shiftedEdges;
1177
1182
  private durationSessions;
1178
1183
  constructor(options: Options);
1179
1184
  attach: (container: HTMLElement) => void;
@@ -1242,6 +1247,7 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1242
1247
  private play;
1243
1248
  get uptime(): number;
1244
1249
  getStatistics: () => Statistics;
1250
+ private getRuntimeInfo;
1245
1251
  private onBufferEvent;
1246
1252
  private alignSizeAndBitRate;
1247
1253
  private get currentSubscription();
@@ -1257,14 +1263,17 @@ interface TelemetryModuleOptions {
1257
1263
  includeStats?: boolean;
1258
1264
  maxRetries?: number;
1259
1265
  maxErrorReports?: number;
1266
+ maxEvents?: number;
1260
1267
  }
1268
+ interface ShiftedEdgeEvent {
1269
+ code: "shifted_edge";
1270
+ edgeUrl: string;
1271
+ }
1272
+ declare type TelemetryEvent = ShiftedEdgeEvent;
1261
1273
  interface FlushOptions {
1262
1274
  isFinal?: boolean;
1263
1275
  initiator: StatsInitiator;
1264
1276
  }
1265
- interface TelemetryStatisticsSource {
1266
- getStatistics(): Statistics;
1267
- }
1268
1277
  interface TelemetryModuleListeners {
1269
1278
  ["visibilitystate"]: VisibilityState;
1270
1279
  ["pagehide"]: PageTransitionEvent;
@@ -1279,16 +1288,18 @@ declare class TelemetryModule {
1279
1288
  private timers;
1280
1289
  private emitter;
1281
1290
  private options;
1282
- private statisticsSource;
1291
+ private runtimeInfo;
1283
1292
  private unsentLines;
1284
1293
  private retries;
1285
1294
  private errorCount;
1295
+ private eventCount;
1286
1296
  private statsCount;
1287
1297
  private constructor();
1288
1298
  unload: () => void;
1289
- static create: (logger: Logger, emitter: Emitter<TelemetryModuleListeners, unknown>, options: TelemetryModuleOptions, statisticsSource: TelemetryStatisticsSource) => TelemetryModule;
1299
+ static create: (logger: Logger, emitter: Emitter<TelemetryModuleListeners, unknown>, options: TelemetryModuleOptions, runtimeInfo: () => Record<string, unknown>) => TelemetryModule;
1290
1300
  load: () => void;
1291
1301
  addStats: ({ isFinal, initiator }?: FlushOptions, extra?: Record<string, unknown>) => void;
1302
+ addEvent: (event: TelemetryEvent) => void;
1292
1303
  getStatistics: () => TelemetryModuleStatistics;
1293
1304
  private send;
1294
1305
  private onVisibilityChange;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vindral/web-sdk",
3
- "version": "2.0.23",
3
+ "version": "2.0.24",
4
4
  "homepage": "https://vindral.com",
5
5
  "description": "Web SDK for viewing Vindral streams",
6
6
  "license": "SEE LICENSE IN https://www.vindral.com/terms-conditions",