@vindral/web-sdk 3.3.4 → 3.4.1

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;
@@ -164,6 +170,10 @@ export interface Options {
164
170
  * Note: Only needed when multiple languages are provided - if no language is specified, one will be automatically selected.
165
171
  */
166
172
  language?: string;
173
+ /**
174
+ * TextTrack to use initially - can be changed during during runtime on the vindral instance
175
+ */
176
+ textTrack?: string;
167
177
  /**
168
178
  * Sets the log level - defaults to info
169
179
  */
@@ -175,8 +185,6 @@ export interface Options {
175
185
  /**
176
186
  * Sets the maximum buffer time allowed. The vindral instance will automatically slowly increase
177
187
  * the buffer time if the use experiences to much buffering with the initial buffer time.
178
- *
179
- * Note: This is not yet implemented
180
188
  */
181
189
  maxBufferTime?: number;
182
190
  /**
@@ -212,7 +220,6 @@ export interface Options {
212
220
  *
213
221
  * Is enabled by default.
214
222
  *
215
- * Note: Opus generally provides better audio quality and is therefore recommended to keep enabled.
216
223
  */
217
224
  mseOpusEnabled?: boolean;
218
225
  /**
@@ -620,6 +627,73 @@ export declare class VindralError extends Error {
620
627
  */
621
628
  toStringifiable: () => Record<string, unknown>;
622
629
  }
630
+ interface AirPlaySenderEvents {
631
+ /**
632
+ * When airplay targets are available.
633
+ */
634
+ ["available"]: void;
635
+ /**
636
+ * When a connection has been established with an airplay target.
637
+ */
638
+ ["connected"]: void;
639
+ /**
640
+ * When the airplay target has lost or stopped a connection.
641
+ */
642
+ ["disconnected"]: void;
643
+ }
644
+ interface AirPlayConfig {
645
+ /**
646
+ * URL to use when connecting to the stream.
647
+ */
648
+ url: string;
649
+ /**
650
+ * Channel ID to connect to.
651
+ */
652
+ channelId: string;
653
+ /**
654
+ * A container to attach the video element in. This should be the same container that the vindral video element is attached to.
655
+ */
656
+ container: HTMLElement;
657
+ /**
658
+ * An authentication token to provide to the server when connecting - only needed for channels with authentication enabled
659
+ * Note: If not supplied when needed, an "Authentication Failed" error will be raised.
660
+ */
661
+ authenticationToken?: string;
662
+ }
663
+ declare class AirPlaySender extends Emitter<AirPlaySenderEvents> {
664
+ private config;
665
+ private hlsUrl;
666
+ private element;
667
+ private connectingTimeout?;
668
+ private browser;
669
+ constructor(config: AirPlayConfig);
670
+ /**
671
+ * True if the instance is casting right now.
672
+ */
673
+ get casting(): boolean;
674
+ /**
675
+ * Set the current channelId.
676
+ */
677
+ set channelId(channelId: string);
678
+ /**
679
+ * Update authentication token on an already established and authenticated connection.
680
+ */
681
+ updateAuthenticationToken: (_token: string) => void;
682
+ /**
683
+ * Fully unloads the instance. This disconnects the current listeners.
684
+ */
685
+ unload: () => void;
686
+ /**
687
+ * Show the AirPlay picker.
688
+ */
689
+ showPlaybackTargetPicker(): void;
690
+ /**
691
+ * Returns if AirPlay is supported.
692
+ */
693
+ static isAirPlaySupported(): boolean;
694
+ private onAirPlayAvailable;
695
+ private onAirPlayPlaybackChanged;
696
+ }
623
697
  type PlaybackState = "buffering" | "playing" | "paused";
624
698
  type BufferStateEvent = "filled" | "drained";
625
699
  interface PlaybackModuleStatistics {
@@ -737,6 +811,10 @@ export interface PublicVindralEvents {
737
811
  * When the available languages is changed
738
812
  */
739
813
  ["languages"]: ReadonlyArray<string>;
814
+ /**
815
+ * When the available text tracks are changed
816
+ */
817
+ ["text tracks"]: ReadonlyArray<string>;
740
818
  /**
741
819
  * When the available channels is changed
742
820
  */
@@ -1097,10 +1175,12 @@ export type Statistics = ModuleStatistics & ReturnType<UserAgentInformation["get
1097
1175
  * ```
1098
1176
  */
1099
1177
  export declare class Vindral extends Emitter<PublicVindralEvents> {
1178
+ #private;
1100
1179
  private static MAX_POOL_SIZE;
1101
1180
  private static INITIAL_MAX_BIT_RATE;
1102
1181
  private static PING_TIMEOUT;
1103
1182
  private static DISCONNECT_TIMEOUT;
1183
+ private static REMOVE_CUE_THRESHOLD;
1104
1184
  /**
1105
1185
  * Picture in picture
1106
1186
  */
@@ -1278,6 +1358,18 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1278
1358
  * Set the current language
1279
1359
  */
1280
1360
  set language(language: string | undefined);
1361
+ /**
1362
+ * Set the active text track
1363
+ */
1364
+ set textTrack(label: string | undefined);
1365
+ /**
1366
+ * Get the available text tracks
1367
+ */
1368
+ get textTracks(): string[];
1369
+ /**
1370
+ * Get the active text track
1371
+ */
1372
+ get textTrack(): string | undefined;
1281
1373
  /**
1282
1374
  * The current channelId
1283
1375
  */
@@ -1384,6 +1476,8 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1384
1476
  private estimateRTT;
1385
1477
  private connectHandler;
1386
1478
  private emitLanguagesIfChanged;
1479
+ private updateTextTracks;
1480
+ private cleanupTextTracks;
1387
1481
  private filterRenditions;
1388
1482
  /**
1389
1483
  * Patch the subscription with properties from the channel that isn't known until connection
@@ -1461,73 +1555,6 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1461
1555
  private timeToFirstFrame;
1462
1556
  private willUseMediaSource;
1463
1557
  }
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
1558
  /**
1532
1559
  * Available options when initializing the Player. Used for enabling/disabling features
1533
1560
  * and hiding/showing buttons in the control pane
@@ -1578,6 +1605,10 @@ export interface PlayerOptions {
1578
1605
  * Enable or disable language selector
1579
1606
  */
1580
1607
  languagesButtonEnabled?: boolean;
1608
+ /**
1609
+ * Enable or disable text track selector
1610
+ */
1611
+ textTracksButtonEnabled?: boolean;
1581
1612
  /**
1582
1613
  * Enable or disable one-to-one (real size, not filling the entire container)
1583
1614
  */
@@ -1612,7 +1643,7 @@ export interface PlayerOptions {
1612
1643
  playOverlayEnabled?: boolean;
1613
1644
  /**
1614
1645
  * Enable or disable the buffering overlay
1615
-
1646
+
1616
1647
  */
1617
1648
  bufferingOverlayEnabled?: boolean;
1618
1649
  }