@vindral/web-sdk 2.0.23 → 2.0.26

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";
@@ -875,6 +878,7 @@ declare class MseModule {
875
878
  private quotaErrorCount;
876
879
  constructor(logger: Logger, emitter: Emitter<MseModuleListeners, MseModuleEvents>, mediaElement: HTMLMediaElement, tracks: Track[]);
877
880
  static create: (logger: Logger, emitter: Emitter<MseModuleListeners, MseModuleEvents>, mediaElement: HTMLMediaElement, tracks: Track[]) => Promise<MseModule>;
881
+ load: () => void;
878
882
  unload: () => void;
879
883
  getStatistics: () => MseModuleStatistics;
880
884
  private open;
@@ -1174,6 +1178,8 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1174
1178
  private apiClient;
1175
1179
  private latestEmittedLanguages;
1176
1180
  private wakeLock;
1181
+ private cachedEdges;
1182
+ private shiftedEdges;
1177
1183
  private durationSessions;
1178
1184
  constructor(options: Options);
1179
1185
  attach: (container: HTMLElement) => void;
@@ -1242,6 +1248,7 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1242
1248
  private play;
1243
1249
  get uptime(): number;
1244
1250
  getStatistics: () => Statistics;
1251
+ private getRuntimeInfo;
1245
1252
  private onBufferEvent;
1246
1253
  private alignSizeAndBitRate;
1247
1254
  private get currentSubscription();
@@ -1257,7 +1264,13 @@ interface TelemetryModuleOptions {
1257
1264
  includeStats?: boolean;
1258
1265
  maxRetries?: number;
1259
1266
  maxErrorReports?: number;
1267
+ maxEvents?: number;
1268
+ }
1269
+ interface ShiftedEdgeEvent {
1270
+ code: "shifted_edge";
1271
+ edgeUrl: string;
1260
1272
  }
1273
+ declare type TelemetryEvent = ShiftedEdgeEvent;
1261
1274
  interface FlushOptions {
1262
1275
  isFinal?: boolean;
1263
1276
  initiator: StatsInitiator;
@@ -1279,16 +1292,19 @@ declare class TelemetryModule {
1279
1292
  private timers;
1280
1293
  private emitter;
1281
1294
  private options;
1295
+ private runtimeInfo;
1282
1296
  private statisticsSource;
1283
1297
  private unsentLines;
1284
1298
  private retries;
1285
1299
  private errorCount;
1300
+ private eventCount;
1286
1301
  private statsCount;
1287
1302
  private constructor();
1288
1303
  unload: () => void;
1289
- static create: (logger: Logger, emitter: Emitter<TelemetryModuleListeners, unknown>, options: TelemetryModuleOptions, statisticsSource: TelemetryStatisticsSource) => TelemetryModule;
1304
+ static create: (logger: Logger, emitter: Emitter<TelemetryModuleListeners, unknown>, options: TelemetryModuleOptions, runtimeInfo: () => Record<string, unknown>, statisticsSource: TelemetryStatisticsSource) => TelemetryModule;
1290
1305
  load: () => void;
1291
1306
  addStats: ({ isFinal, initiator }?: FlushOptions, extra?: Record<string, unknown>) => void;
1307
+ addEvent: (event: TelemetryEvent) => void;
1292
1308
  getStatistics: () => TelemetryModuleStatistics;
1293
1309
  private send;
1294
1310
  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.26",
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",