@vindral/web-sdk 3.3.4 → 3.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.
package/index.d.ts CHANGED
@@ -106,9 +106,15 @@ interface AudioRenditionProps {
106
106
  channels: number;
107
107
  sampleRate: number;
108
108
  }
109
+ interface TextRenditionProps {
110
+ codec: "webvtt";
111
+ kind: "subtitles" | "captions";
112
+ label?: string;
113
+ }
109
114
  type VideoRendition = VideoRenditionProps & RenditionProps;
110
115
  type AudioRendition = AudioRenditionProps & RenditionProps;
111
- type Rendition = VideoRendition | AudioRendition;
116
+ type TextRendition = TextRenditionProps & RenditionProps;
117
+ type Rendition = VideoRendition | AudioRendition | TextRendition;
112
118
  interface Size {
113
119
  width: number;
114
120
  height: number;
@@ -175,8 +181,6 @@ export interface Options {
175
181
  /**
176
182
  * Sets the maximum buffer time allowed. The vindral instance will automatically slowly increase
177
183
  * the buffer time if the use experiences to much buffering with the initial buffer time.
178
- *
179
- * Note: This is not yet implemented
180
184
  */
181
185
  maxBufferTime?: number;
182
186
  /**
@@ -212,7 +216,6 @@ export interface Options {
212
216
  *
213
217
  * Is enabled by default.
214
218
  *
215
- * Note: Opus generally provides better audio quality and is therefore recommended to keep enabled.
216
219
  */
217
220
  mseOpusEnabled?: boolean;
218
221
  /**
@@ -620,6 +623,73 @@ export declare class VindralError extends Error {
620
623
  */
621
624
  toStringifiable: () => Record<string, unknown>;
622
625
  }
626
+ interface AirPlaySenderEvents {
627
+ /**
628
+ * When airplay targets are available.
629
+ */
630
+ ["available"]: void;
631
+ /**
632
+ * When a connection has been established with an airplay target.
633
+ */
634
+ ["connected"]: void;
635
+ /**
636
+ * When the airplay target has lost or stopped a connection.
637
+ */
638
+ ["disconnected"]: void;
639
+ }
640
+ interface AirPlayConfig {
641
+ /**
642
+ * URL to use when connecting to the stream.
643
+ */
644
+ url: string;
645
+ /**
646
+ * Channel ID to connect to.
647
+ */
648
+ channelId: string;
649
+ /**
650
+ * A container to attach the video element in. This should be the same container that the vindral video element is attached to.
651
+ */
652
+ container: HTMLElement;
653
+ /**
654
+ * An authentication token to provide to the server when connecting - only needed for channels with authentication enabled
655
+ * Note: If not supplied when needed, an "Authentication Failed" error will be raised.
656
+ */
657
+ authenticationToken?: string;
658
+ }
659
+ declare class AirPlaySender extends Emitter<AirPlaySenderEvents> {
660
+ private config;
661
+ private hlsUrl;
662
+ private element;
663
+ private connectingTimeout?;
664
+ private browser;
665
+ constructor(config: AirPlayConfig);
666
+ /**
667
+ * True if the instance is casting right now.
668
+ */
669
+ get casting(): boolean;
670
+ /**
671
+ * Set the current channelId.
672
+ */
673
+ set channelId(channelId: string);
674
+ /**
675
+ * Update authentication token on an already established and authenticated connection.
676
+ */
677
+ updateAuthenticationToken: (_token: string) => void;
678
+ /**
679
+ * Fully unloads the instance. This disconnects the current listeners.
680
+ */
681
+ unload: () => void;
682
+ /**
683
+ * Show the AirPlay picker.
684
+ */
685
+ showPlaybackTargetPicker(): void;
686
+ /**
687
+ * Returns if AirPlay is supported.
688
+ */
689
+ static isAirPlaySupported(): boolean;
690
+ private onAirPlayAvailable;
691
+ private onAirPlayPlaybackChanged;
692
+ }
623
693
  type PlaybackState = "buffering" | "playing" | "paused";
624
694
  type BufferStateEvent = "filled" | "drained";
625
695
  interface PlaybackModuleStatistics {
@@ -737,6 +807,10 @@ export interface PublicVindralEvents {
737
807
  * When the available languages is changed
738
808
  */
739
809
  ["languages"]: ReadonlyArray<string>;
810
+ /**
811
+ * When the available text tracks are changed
812
+ */
813
+ ["text tracks"]: ReadonlyArray<string>;
740
814
  /**
741
815
  * When the available channels is changed
742
816
  */
@@ -1097,10 +1171,12 @@ export type Statistics = ModuleStatistics & ReturnType<UserAgentInformation["get
1097
1171
  * ```
1098
1172
  */
1099
1173
  export declare class Vindral extends Emitter<PublicVindralEvents> {
1174
+ #private;
1100
1175
  private static MAX_POOL_SIZE;
1101
1176
  private static INITIAL_MAX_BIT_RATE;
1102
1177
  private static PING_TIMEOUT;
1103
1178
  private static DISCONNECT_TIMEOUT;
1179
+ private static REMOVE_CUE_THRESHOLD;
1104
1180
  /**
1105
1181
  * Picture in picture
1106
1182
  */
@@ -1278,6 +1354,9 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1278
1354
  * Set the current language
1279
1355
  */
1280
1356
  set language(language: string | undefined);
1357
+ set textTrack(label: string | undefined);
1358
+ get textTracks(): string[];
1359
+ get textTrack(): string | undefined;
1281
1360
  /**
1282
1361
  * The current channelId
1283
1362
  */
@@ -1384,6 +1463,8 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1384
1463
  private estimateRTT;
1385
1464
  private connectHandler;
1386
1465
  private emitLanguagesIfChanged;
1466
+ private updateTextTracks;
1467
+ private cleanupTextTracks;
1387
1468
  private filterRenditions;
1388
1469
  /**
1389
1470
  * Patch the subscription with properties from the channel that isn't known until connection
@@ -1461,73 +1542,6 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1461
1542
  private timeToFirstFrame;
1462
1543
  private willUseMediaSource;
1463
1544
  }
1464
- interface AirPlaySenderEvents {
1465
- /**
1466
- * When airplay targets are available.
1467
- */
1468
- ["available"]: void;
1469
- /**
1470
- * When a connection has been established with an airplay target.
1471
- */
1472
- ["connected"]: void;
1473
- /**
1474
- * When the airplay target has lost or stopped a connection.
1475
- */
1476
- ["disconnected"]: void;
1477
- }
1478
- interface AirPlayConfig {
1479
- /**
1480
- * URL to use when connecting to the stream.
1481
- */
1482
- url: string;
1483
- /**
1484
- * Channel ID to connect to.
1485
- */
1486
- channelId: string;
1487
- /**
1488
- * A container to attach the video element in. This should be the same container that the vindral video element is attached to.
1489
- */
1490
- container: HTMLElement;
1491
- /**
1492
- * An authentication token to provide to the server when connecting - only needed for channels with authentication enabled
1493
- * Note: If not supplied when needed, an "Authentication Failed" error will be raised.
1494
- */
1495
- authenticationToken?: string;
1496
- }
1497
- declare class AirPlaySender extends Emitter<AirPlaySenderEvents> {
1498
- private config;
1499
- private hlsUrl;
1500
- private element;
1501
- private connectingTimeout?;
1502
- private browser;
1503
- constructor(config: AirPlayConfig);
1504
- /**
1505
- * True if the instance is casting right now.
1506
- */
1507
- get casting(): boolean;
1508
- /**
1509
- * Set the current channelId.
1510
- */
1511
- set channelId(channelId: string);
1512
- /**
1513
- * Update authentication token on an already established and authenticated connection.
1514
- */
1515
- updateAuthenticationToken: (_token: string) => void;
1516
- /**
1517
- * Fully unloads the instance. This disconnects the current listeners.
1518
- */
1519
- unload: () => void;
1520
- /**
1521
- * Show the AirPlay picker.
1522
- */
1523
- showPlaybackTargetPicker(): void;
1524
- /**
1525
- * Returns if AirPlay is supported.
1526
- */
1527
- static isAirPlaySupported(): boolean;
1528
- private onAirPlayAvailable;
1529
- private onAirPlayPlaybackChanged;
1530
- }
1531
1545
  /**
1532
1546
  * Available options when initializing the Player. Used for enabling/disabling features
1533
1547
  * and hiding/showing buttons in the control pane
@@ -1578,6 +1592,10 @@ export interface PlayerOptions {
1578
1592
  * Enable or disable language selector
1579
1593
  */
1580
1594
  languagesButtonEnabled?: boolean;
1595
+ /**
1596
+ * Enable or disable text track selector
1597
+ */
1598
+ textTracksButtonEnabled?: boolean;
1581
1599
  /**
1582
1600
  * Enable or disable one-to-one (real size, not filling the entire container)
1583
1601
  */
@@ -1612,7 +1630,7 @@ export interface PlayerOptions {
1612
1630
  playOverlayEnabled?: boolean;
1613
1631
  /**
1614
1632
  * Enable or disable the buffering overlay
1615
-
1633
+
1616
1634
  */
1617
1635
  bufferingOverlayEnabled?: boolean;
1618
1636
  }