@vindral/web-sdk 2.0.9 → 2.0.10

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
@@ -173,6 +173,62 @@ declare class LoggerInstance implements Logger {
173
173
  error: (message: string, meta?: Meta | undefined) => void;
174
174
  critical: (message: string, meta?: Meta | undefined) => void;
175
175
  }
176
+ export declare type PlayInitiator = "user input" | "programatically";
177
+ export interface PlaybackSource {
178
+ volume: number;
179
+ muted: boolean;
180
+ currentTime: number;
181
+ playbackRate?: number;
182
+ readonly seekTime: number;
183
+ readonly isSeeking: boolean;
184
+ play(initiator: PlayInitiator): Promise<void>;
185
+ }
186
+ interface MediaElementOptions {
187
+ autoplay: boolean;
188
+ muted: boolean;
189
+ type: "audio" | "video";
190
+ logger: Logger;
191
+ }
192
+ interface NeedsUserInputContext {
193
+ forAudio: boolean;
194
+ forVideo: boolean;
195
+ }
196
+ interface MediaElementEvents {
197
+ ["needs user input"]: NeedsUserInputContext;
198
+ ["buffer state"]: Readonly<BufferState>;
199
+ }
200
+ declare class MediaElement extends Emitter<MediaElementEvents> {
201
+ readonly element: HTMLMediaElement;
202
+ private logger;
203
+ private seekTimes;
204
+ private seekStartTime?;
205
+ private _userProvidedMuted;
206
+ private _userHasProvidedInput;
207
+ constructor({ type, autoplay, muted, logger }: MediaElementOptions);
208
+ attach: (container: HTMLElement) => void;
209
+ get seekTime(): number;
210
+ get isSeeking(): boolean;
211
+ get currentTime(): number;
212
+ set currentTime(value: number);
213
+ get playbackRate(): number;
214
+ set playbackRate(rate: number);
215
+ get volume(): number;
216
+ set volume(volume: number);
217
+ get muted(): boolean;
218
+ set muted(muted: boolean);
219
+ get userHasProvidedInput(): boolean;
220
+ get paused(): boolean;
221
+ getPlaybackRate: () => number;
222
+ getPlaybackState: () => PlaybackState;
223
+ setPlaybackRate: (rate: number) => void;
224
+ getBuffer: () => TimeRange[];
225
+ play: (initiator: PlayInitiator) => Promise<void>;
226
+ private _play;
227
+ private onEvent;
228
+ private onBufferStateChange;
229
+ private onSeekStart;
230
+ private onSeekEnd;
231
+ }
176
232
  declare type PlaybackState = "buffering" | "playing";
177
233
  declare type BufferStateEvent = "filled" | "drained";
178
234
  declare type BufferState = {
@@ -182,6 +238,7 @@ declare type BufferState = {
182
238
  };
183
239
  interface PlaybackModuleListeners {
184
240
  ["buffer state"]: Readonly<BufferState>;
241
+ ["needs user input"]: NeedsUserInputContext;
185
242
  }
186
243
  interface PlaybackModuleEvents {
187
244
  ["buffer state event"]: Readonly<BufferStateEvent>;
@@ -193,6 +250,8 @@ interface ClockSource {
193
250
  }
194
251
  interface PlaybackModuleStatistics {
195
252
  bufferTime: number;
253
+ needsInputForAudioCount: number;
254
+ needsInputForVideoCount: number;
196
255
  }
197
256
  declare class PlaybackModule {
198
257
  private emitter;
@@ -203,6 +262,8 @@ declare class PlaybackModule {
203
262
  private targetBufferTime;
204
263
  private lastBufferStateEvent;
205
264
  private firstFrameTime?;
265
+ private needsInputForAudioCount;
266
+ private needsInputForVideoCount;
206
267
  constructor(emitter: Emitter<PlaybackModuleListeners, PlaybackModuleEvents>, logger: Logger, clockSource: ClockSource, targetBufferTime: number);
207
268
  static create: (emitter: Emitter<PlaybackModuleListeners, PlaybackModuleEvents>, logger: Logger, clockSource: ClockSource, targetBufferTime: number) => PlaybackModule;
208
269
  unload: () => void;
@@ -214,6 +275,7 @@ declare class PlaybackModule {
214
275
  getFirstFrameTime: () => number | undefined;
215
276
  getStatistics: () => PlaybackModuleStatistics;
216
277
  private onBufferedStateChanged;
278
+ private onNeedsUserInput;
217
279
  }
218
280
  declare type Direction = "upgrade" | "downgrade" | "double downgrade" | "reconnect";
219
281
  interface QualityOfServiceConfig {
@@ -269,10 +331,6 @@ declare class AdaptivityModule {
269
331
  private tooMuchTimeBuffering;
270
332
  private tooManyBufferingEvents;
271
333
  }
272
- interface NeedsUserInputContext {
273
- forAudio: boolean;
274
- forVideo: boolean;
275
- }
276
334
  interface AudioPlayerModuleListeners {
277
335
  ["decoded frame"]: Readonly<DecodedSample>;
278
336
  }
@@ -300,6 +358,7 @@ declare class AudioPlayerModule {
300
358
  private clockSource;
301
359
  private clockDelta?;
302
360
  private startTimeIsInvalidated;
361
+ private lastSampleTimestamp;
303
362
  get volume(): number;
304
363
  set volume(volume: number);
305
364
  get seekTime(): number;
@@ -332,6 +391,8 @@ export declare const AUTHENTICATION_EXPIRED_CODE = "authentication_expired";
332
391
  export declare const CHANNEL_NOT_FOUND_CODE = "channel_not_found";
333
392
  export declare const NO_INCOMING_DATA = "no_incoming_data_error";
334
393
  export declare const INACTIVITY_CODE = "connection_inactivity";
394
+ export declare const MISSING_INIT_SEGMENT = "missing_init_segment";
395
+ export declare const NO_TRACK_CONTEXT = "no_track_context";
335
396
  export declare class VindralError extends Error {
336
397
  private props;
337
398
  private extra;
@@ -342,6 +403,8 @@ export declare class VindralError extends Error {
342
403
  toStringifiable: () => Record<string, unknown>;
343
404
  }
344
405
  export declare const mediaElementError: (isFatal: boolean, mediaError: MediaError) => VindralError;
406
+ export declare const missingInitSegmentError: (renditionId: number, channelId: string) => VindralError;
407
+ export declare const noTrackContextError: (type: "audio" | "video", renditionId: number, channelId: string) => VindralError;
345
408
  export declare const audioContextTimeoutError: () => VindralError;
346
409
  export declare const authenticationError: () => VindralError;
347
410
  export declare const authenticationExpiredError: () => VindralError;
@@ -351,9 +414,11 @@ export declare const noIncomingDataError: () => VindralError;
351
414
  export declare const unableToConnectError: (source?: Error | undefined) => VindralError;
352
415
  export declare const unableToConnectAfterRetriesError: () => VindralError;
353
416
  declare type State = "connected" | "disconnected" | "connecting";
417
+ declare type ContextSwitchState = "completed" | "started";
354
418
  interface ConnectionModuleListeners {
355
419
  ["send signal"]: Readonly<string>;
356
420
  ["disconnect"]: void;
421
+ ["reconnect"]: string;
357
422
  }
358
423
  interface ConnectionModuleEvents {
359
424
  ["received signal"]: Readonly<Signal>;
@@ -361,6 +426,8 @@ interface ConnectionModuleEvents {
361
426
  ["connection state"]: Readonly<State>;
362
427
  ["rtt"]: number;
363
428
  ["error"]: Readonly<VindralError>;
429
+ ["context switch complete"]: Readonly<void>;
430
+ ["context switch started"]: Readonly<void>;
364
431
  }
365
432
  interface ConnectOptions {
366
433
  connectHandler: () => Promise<string>;
@@ -374,6 +441,7 @@ interface ConnectionStatistics {
374
441
  }
375
442
  declare class ConnectionModule {
376
443
  private static PING_INTERVAL;
444
+ private static MAX_MISSED_PINGS;
377
445
  private static TLS_ROUNDTRIPS;
378
446
  private timers;
379
447
  private emitter;
@@ -386,6 +454,7 @@ declare class ConnectionModule {
386
454
  private connectCount;
387
455
  private _firstConnectionTime?;
388
456
  private _lastConnectionTime?;
457
+ private missedPings;
389
458
  private contextSwitchesInProgress;
390
459
  private contextSwitchesCompleted;
391
460
  private buffer;
@@ -482,6 +551,7 @@ declare class RenditionsModule {
482
551
  setRenditions: (channelId: ChannelId, renditions: Rendition[]) => void;
483
552
  getLanguages: () => ReadonlyArray<string>;
484
553
  getVideoRendition: (renditionId: number, channelId?: string) => Readonly<VideoRendition> | undefined;
554
+ getAudioRenditions: (channelId: ChannelId) => Readonly<AudioRendition[]> | undefined;
485
555
  getAudioRendition: (renditionId: number, channelId?: string) => Readonly<AudioRendition> | undefined;
486
556
  getRendition: (renditionId: number, channelId?: string) => Readonly<Rendition> | undefined;
487
557
  getStatistics: () => RenditionsModuleStatistics;
@@ -614,6 +684,10 @@ declare class DecoderModule {
614
684
  }
615
685
  type ConnectionType = "bluetooth" | "cellular" | "ethernet" | "mixed" | "none" | "other" | "unknown" | "wifi" | "wimax";
616
686
  type EffectiveConnectionType = "2g" | "3g" | "4g" | "slow-2g";
687
+ interface DocumentState {
688
+ readonly isVisible: boolean;
689
+ readonly isOnline: boolean;
690
+ }
617
691
  interface DocumentStateEvents {
618
692
  ["page active"]: boolean;
619
693
  ["pagehide"]: PageTransitionEvent;
@@ -631,7 +705,7 @@ interface DocumentStateModulesStatistics {
631
705
  navigatorSaveData?: boolean;
632
706
  navigatorDownlink?: number;
633
707
  }
634
- declare class DocumentStateModule {
708
+ declare class DocumentStateModule implements DocumentState {
635
709
  private emitter;
636
710
  private isVisibleCount;
637
711
  private isHiddenCount;
@@ -644,6 +718,8 @@ declare class DocumentStateModule {
644
718
  load: () => void;
645
719
  unsuspend: () => void;
646
720
  getStatistics: () => DocumentStateModulesStatistics;
721
+ get isOnline(): boolean;
722
+ get isVisible(): boolean;
647
723
  private onOnline;
648
724
  private onOffline;
649
725
  private onPageHide;
@@ -656,6 +732,7 @@ interface IncomingDataModuleListeners {
656
732
  }
657
733
  interface IncomingDataModuleEvents {
658
734
  ["no data timeout"]: number;
735
+ ["reconnect"]: string;
659
736
  ["error"]: Readonly<VindralError>;
660
737
  }
661
738
  interface IncomingDataModuleStatistics {
@@ -902,7 +979,7 @@ declare class SyncModule {
902
979
  readonly catchupRate: 1.05;
903
980
  readonly slowdownRate: 0.95;
904
981
  };
905
- readonly maxTimeSyncDifferenceTolerance = 150;
982
+ readonly maxTimeSyncDifferenceTolerance = 20;
906
983
  private timers;
907
984
  private rtt;
908
985
  private channelSyncInfo;
@@ -926,7 +1003,9 @@ declare class SyncModule {
926
1003
  getCurrentChannelId: () => string | undefined;
927
1004
  updateChannelSyncInfo(channelId: string, syncInfo: SyncInfo): void;
928
1005
  getLiveEdgeTime: (channelId: string) => number | undefined;
1006
+ getLiveEdgeTimeLatencyAdjusted: (channelId: string) => number | undefined;
929
1007
  getWallclockTime: (channelId: string) => number | undefined;
1008
+ getWallclockTimeLatencyAdjusted: (channelId: string) => number | undefined;
930
1009
  get serverCurrentTime(): number;
931
1010
  processSample: <T extends SyncSample>(sample: T) => T;
932
1011
  getStatistics: () => SyncModuleStatistics;
@@ -990,6 +1069,7 @@ export declare type Statistics = ModuleStatistics & UserAgentInformation & {
990
1069
  };
991
1070
  export declare class Vindral extends Emitter<PublicVindralEvents> {
992
1071
  private static INITIAL_MAX_BIT_RATE;
1072
+ private static PING_TIMEOUT;
993
1073
  readonly pictureInPicture: {
994
1074
  enter: () => Promise<void>;
995
1075
  exit: () => Promise<void>;
@@ -1009,6 +1089,7 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1009
1089
  private createdAt;
1010
1090
  private hasCalledConnect;
1011
1091
  private apiClient;
1092
+ private latestEmittedLanguages;
1012
1093
  private durationSessions;
1013
1094
  constructor(options: Options);
1014
1095
  attach: (container: HTMLElement) => void;
@@ -1022,6 +1103,8 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1022
1103
  get connectionState(): Readonly<State>;
1023
1104
  get playbackState(): Readonly<PlaybackState>;
1024
1105
  get bufferFullness(): number;
1106
+ get sizeBasedResolutionCapEnabled(): boolean;
1107
+ set sizeBasedResolutionCapEnabled(enabled: boolean);
1025
1108
  get abrEnabled(): boolean;
1026
1109
  set abrEnabled(enabled: boolean);
1027
1110
  get serverEdgeTime(): number | undefined;
@@ -1039,12 +1122,10 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1039
1122
  set channelId(channelId: string);
1040
1123
  get maxSize(): Size;
1041
1124
  set maxSize(size: Size);
1042
- get maxBitRate(): number;
1043
- set maxBitRate(bitRate: number);
1044
- get maxVideoBitrate(): number;
1045
- set maxVideoBitrate(bitRate: number);
1046
- get maxAudioBitrate(): number;
1047
- set maxAudioBitrate(bitRate: number);
1125
+ get maxVideoBitRate(): number;
1126
+ set maxVideoBitRate(bitRate: number);
1127
+ get maxAudioBitRate(): number;
1128
+ set maxAudioBitRate(bitRate: number);
1048
1129
  get renditionLevels(): ReadonlyArray<RenditionLevel>;
1049
1130
  get currentRenditionLevel(): Readonly<RenditionLevel> | undefined;
1050
1131
  get targetRenditionLevel(): Readonly<RenditionLevel> | undefined;
@@ -1061,7 +1142,9 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1061
1142
  connect: () => void;
1062
1143
  getCastOptions: () => Options;
1063
1144
  private connectionInfo;
1145
+ private estimateRTT;
1064
1146
  private connectHandler;
1147
+ private emitLanguagesIfChanged;
1065
1148
  private filterRenditions;
1066
1149
  private patchSubscription;
1067
1150
  private isSupportedVideoCodecProfile;
@@ -1136,6 +1219,16 @@ declare class TimerModule {
1136
1219
  setInterval: (callback: (...args: unknown[]) => void, interval: number, ...args: unknown[]) => number;
1137
1220
  unload: () => void;
1138
1221
  }
1222
+ declare class UnpauseModule {
1223
+ private logger;
1224
+ private element;
1225
+ private documentState;
1226
+ private timers;
1227
+ private constructor();
1228
+ static create: (logger: Logger, element: MediaElement, documentState: DocumentState) => UnpauseModule;
1229
+ unload: () => void;
1230
+ private unpause;
1231
+ }
1139
1232
  interface VideoPlayerModuleListeners {
1140
1233
  ["decoded frame"]: Readonly<DecodedSample>;
1141
1234
  }
@@ -1185,6 +1278,7 @@ export interface Modules {
1185
1278
  telemetry?: TelemetryModule;
1186
1279
  documentState: DocumentStateModule;
1187
1280
  incomingData: IncomingDataModule;
1281
+ unpause?: UnpauseModule;
1188
1282
  }
1189
1283
  export interface ReconnectState {
1190
1284
  reconnectRetries: number;
@@ -1221,15 +1315,6 @@ export interface Options {
1221
1315
  advanced?: AdvancedOptions;
1222
1316
  media?: Media;
1223
1317
  }
1224
- export interface PlaybackSource {
1225
- volume: number;
1226
- muted: boolean;
1227
- currentTime: number;
1228
- playbackRate?: number;
1229
- readonly seekTime: number;
1230
- readonly isSeeking: boolean;
1231
- play(): Promise<void>;
1232
- }
1233
1318
  export interface PublicVindralEvents {
1234
1319
  ["error"]: Readonly<VindralError>;
1235
1320
  ["needs user input"]: NeedsUserInputContext;
@@ -1240,6 +1325,7 @@ export interface PublicVindralEvents {
1240
1325
  ["rendition level"]: Readonly<RenditionLevel>;
1241
1326
  ["languages"]: ReadonlyArray<string>;
1242
1327
  ["channels"]: ReadonlyArray<Channel>;
1328
+ ["context switch"]: Readonly<ContextSwitchState>;
1243
1329
  ["server wallclock time"]: Readonly<number>;
1244
1330
  ["buffer state event"]: Readonly<BufferStateEvent>;
1245
1331
  ["initialized media"]: void;
@@ -1472,12 +1558,22 @@ export interface PlayerOptions {
1472
1558
  fullscreenButtonEnabled?: boolean;
1473
1559
  pipButtonEnabled?: boolean;
1474
1560
  channelSelectionEnabled?: boolean;
1561
+ channelSelectionOptions?: {
1562
+ barButton?: {
1563
+ enabled?: boolean;
1564
+ thumbnails?: boolean;
1565
+ };
1566
+ list?: {
1567
+ enabled?: boolean;
1568
+ };
1569
+ };
1475
1570
  renditionLevelsEnabled?: boolean;
1476
1571
  languagesButtonEnabled?: boolean;
1477
1572
  oneToOneButtonEnabled?: boolean;
1478
1573
  hideTimeout?: number;
1479
1574
  castBackground?: string;
1480
1575
  castReceiverApplicationId?: string;
1576
+ thumbnailUpdateInterval?: number;
1481
1577
  }
1482
1578
  export interface PlayerState {
1483
1579
  isBuffering: boolean;
@@ -1492,9 +1588,11 @@ export declare class Player {
1492
1588
  private playerElement;
1493
1589
  private bufferingOverlay;
1494
1590
  private playOverlay;
1591
+ private channelSelectionList?;
1495
1592
  private bar;
1496
1593
  private stateInterval?;
1497
1594
  private showBufferingTimeout?;
1595
+ private thumbnailModule?;
1498
1596
  constructor(optionsOrInstance: Options | Vindral, playerOptions?: PlayerOptions);
1499
1597
  unload: () => void;
1500
1598
  attach: (container: HTMLElement) => void;
@@ -1509,6 +1607,7 @@ export declare class Player {
1509
1607
  private lockOrientation;
1510
1608
  private unlockOrientation;
1511
1609
  private checkState;
1610
+ private needsThumbnails;
1512
1611
  private bumpInteractTime;
1513
1612
  }
1514
1613
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vindral/web-sdk",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
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",