@vindral/web-sdk 4.1.4 → 4.1.5-10-g4a74bcc5

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.1.4",
2
+ "version": "4.1.5-10-g4a74bcc5",
3
3
  "name": "@vindral/web-sdk",
4
4
  "main": "./legacy.umd.js",
5
5
  "module": "./legacy.es.js",
package/player.d.ts CHANGED
@@ -15,6 +15,10 @@ interface Channel {
15
15
  * URLs to fetch thumbnail from
16
16
  */
17
17
  thumbnailUrls: string[];
18
+ /**
19
+ * Urls for timeshift if available
20
+ */
21
+ timeshiftUrls?: string[];
18
22
  }
19
23
  interface ClientOverrides {
20
24
  maxVideoBitRate?: number;
@@ -213,6 +217,10 @@ interface MoQConnectInfo {
213
217
  telemetry?: Telemetry;
214
218
  channels: ChannelWithCatalog[];
215
219
  edges: Edge[];
220
+ timeshift: {
221
+ urls: string[];
222
+ duration: string;
223
+ };
216
224
  }
217
225
  interface VindralConnectInfo {
218
226
  logsUrl?: string;
@@ -423,6 +431,14 @@ interface Options {
423
431
  * This can be used to provide user options to limit the video bandwidth usage.
424
432
  */
425
433
  maxVideoBitRate?: number;
434
+ /**
435
+ * Initial maximum bit rate cap applied when first connecting to a channel.
436
+ * This helps prevent buffering on initial connection by starting at a conservative bitrate.
437
+ * The client will adapt to higher bitrates as bandwidth allows if ABR is enabled.
438
+ *
439
+ * Default is 2.5 Mbps (2500000 bits per second).
440
+ */
441
+ maxInitialBitRate?: number;
426
442
  /**
427
443
  * Controls video element background behaviour while loading.
428
444
  * - If `false`, a black background will be shown.
@@ -435,6 +451,14 @@ interface Options {
435
451
  * Whether to start the player muted or to try to start playing audio automatically.
436
452
  */
437
453
  muted?: boolean;
454
+ /**
455
+ * Initial volume level for the player. A floating point value between 0-1.
456
+ * Default is 1 (100% volume).
457
+ *
458
+ * Note: Volume cannot be set on iOS devices due to system restrictions.
459
+ * The volume property is not settable in JavaScript on iOS, and reading it always returns 1.
460
+ */
461
+ volume?: number;
438
462
  /**
439
463
  * Provide a custom reconnect handler to control when the instance should stop trying to
440
464
  * reconnect. The reconnect handler should either return true to allow the reconnect or
@@ -721,6 +745,20 @@ interface IncomingDataModuleStatistics {
721
745
  */
722
746
  bytesReceived: number;
723
747
  }
748
+ interface JitterStatistics {
749
+ /** Minimum jitter in the recent window */
750
+ min: number;
751
+ /** Maximum jitter in the recent window for spike detection */
752
+ max: number;
753
+ /** Latest average jitter in ms (recent window) */
754
+ last: number;
755
+ /** Average jitter in ms (RFC 3550 style, smoothed with /16) */
756
+ average: number;
757
+ }
758
+ interface JitterModuleStatistics {
759
+ audioJitter: JitterStatistics | undefined;
760
+ videoJitter: JitterStatistics | undefined;
761
+ }
724
762
  interface MseModuleStatistics {
725
763
  quotaErrorCount: number;
726
764
  mediaSourceOpenTime: number;
@@ -744,11 +782,11 @@ interface QualityOfServiceModuleStatistics {
744
782
  */
745
783
  fatalQosCount: number;
746
784
  /**
747
- * Ratio of time being spent on different bitrates.
748
- * Example: `"timeSpentRatio": { "1160000": 0.2, "2260000": 0.8 }` shows 20% spent on 1.16 Mbps, 80% spent on 2.26 Mbps.
785
+ * Ratio of time being spent on different quality indexes. Index 0 is always the highest quality.
786
+ * Example: `"timeSpentRatio": { "0": 0.8, "1": 0.2 }` shows 80% spent on the best level, 20% on the next one.
749
787
  */
750
788
  timeSpentRatio: {
751
- [bitRate: string]: number;
789
+ [qualityIndex: string]: number;
752
790
  };
753
791
  }
754
792
  interface SyncModuleStatistics {
@@ -795,7 +833,7 @@ declare class UserAgentInformation {
795
833
  userAgent: string;
796
834
  };
797
835
  }
798
- type ModuleStatistics = AdaptivityStatistics & BufferTimeStatistics & ConnectionStatistics & ConstraintCapStatistics & DecoderStatistics & DocumentStateModulesStatistics & IncomingDataModuleStatistics & MseModuleStatistics & PlaybackModuleStatistics & QualityOfServiceModuleStatistics & RenditionsModuleStatistics & SyncModuleStatistics & TelemetryModuleStatistics & VideoPlayerStatistics;
836
+ type ModuleStatistics = AdaptivityStatistics & BufferTimeStatistics & ConnectionStatistics & ConstraintCapStatistics & DecoderStatistics & DocumentStateModulesStatistics & IncomingDataModuleStatistics & JitterModuleStatistics & MseModuleStatistics & PlaybackModuleStatistics & QualityOfServiceModuleStatistics & RenditionsModuleStatistics & SyncModuleStatistics & TelemetryModuleStatistics & VideoPlayerStatistics;
799
837
  type Statistics = ModuleStatistics & ReturnType<UserAgentInformation["getUserAgentInformation"]> & {
800
838
  /**
801
839
  * Version of the @vindral/web-sdk being used.
@@ -837,11 +875,14 @@ type Statistics = ModuleStatistics & ReturnType<UserAgentInformation["getUserAge
837
875
  */
838
876
  timeToFirstFrame?: number;
839
877
  iosMediaElementEnabled?: boolean;
878
+ /**
879
+ * Average bitrate for the entire session in bits/second.
880
+ */
881
+ averageBitRate?: number;
840
882
  };
841
883
  declare class Vindral extends Emitter<PublicVindralEvents> {
842
884
  #private;
843
885
  private static MAX_POOL_SIZE;
844
- private static INITIAL_MAX_BIT_RATE;
845
886
  private static DISCONNECT_TIMEOUT;
846
887
  private static REMOVE_CUE_THRESHOLD;
847
888
  /**
@@ -1301,6 +1342,10 @@ interface VolumeState {
1301
1342
  */
1302
1343
  volume: number;
1303
1344
  }
1345
+ interface TimeShiftInfo {
1346
+ urls: string[];
1347
+ duration: string;
1348
+ }
1304
1349
  interface PublicVindralEvents {
1305
1350
  /**
1306
1351
  * When an error that requires action has occured
@@ -1397,6 +1442,10 @@ interface PublicVindralEvents {
1397
1442
  * from external sources such as OS media shortcuts or other native UI outside of the browser.
1398
1443
  */
1399
1444
  ["volume state"]: Readonly<VolumeState>;
1445
+ /**
1446
+ * Emitted when the timeshift URLs are updated.
1447
+ */
1448
+ ["timeshift info"]: Readonly<TimeShiftInfo>;
1400
1449
  ["buffer state event"]: Readonly<BufferStateEvent>;
1401
1450
  ["initialized media"]: void;
1402
1451
  }
@@ -1580,11 +1629,29 @@ declare class AirPlaySender extends Emitter<AirPlaySenderEvents> {
1580
1629
  private getHlsUrl;
1581
1630
  private checkHlsUrl;
1582
1631
  }
1632
+ interface FullscreenEvents {
1633
+ ["on fullscreen change"]: boolean;
1634
+ }
1635
+ declare class Fullscreen extends Emitter<FullscreenEvents> {
1636
+ private container;
1637
+ constructor(container: HTMLElement);
1638
+ unload: () => void;
1639
+ request: () => Promise<void>;
1640
+ exit: () => Promise<void>;
1641
+ private onChange;
1642
+ isFullscreen: () => boolean;
1643
+ isSupported: () => boolean;
1644
+ isFullscreenApiSupported: () => boolean;
1645
+ static isFullscreenApiSupported: (element: HTMLElement) => boolean;
1646
+ private isInIframe;
1647
+ private get requestFn();
1648
+ private get exitFn();
1649
+ }
1583
1650
  type ControllerAttributes = (typeof Controller.observedAttributes)[number];
1584
1651
  export declare class Controller extends HTMLElement {
1585
1652
  #private;
1586
1653
  static observedAttributes: readonly [
1587
- ...("language" | "channels" | "buffering" | "paused" | "volume" | "muted" | "user-interacting" | "is-casting" | "cast-available" | "cast-receiver-name" | "ui-locked" | "hide-ui-on-pause" | "is-fullscreen" | "is-fullscreen-fallback" | "rendition-levels" | "rendition-level" | "max-video-bit-rate" | "channel-id" | "channel-group-id" | "pip-available" | "is-pip" | "airplay-available" | "is-airplaying" | "media" | "languages" | "text-tracks" | "text-track" | "needs-user-input-video" | "needs-user-input-audio" | "authentication-token" | "volume-level" | "cast" | "airplay" | "pip" | "fullscreen" | "vu-meter" | "poster-src")[],
1654
+ ...("language" | "channels" | "buffering" | "paused" | "volume" | "muted" | "duration" | "user-interacting" | "is-casting" | "cast-available" | "cast-receiver-name" | "ui-locked" | "hide-ui-on-pause" | "is-fullscreen" | "is-fullscreen-fallback" | "rendition-levels" | "rendition-level" | "max-video-bit-rate" | "max-initial-bit-rate" | "channel-id" | "channel-group-id" | "pip-available" | "is-pip" | "airplay-available" | "is-airplaying" | "media" | "languages" | "text-tracks" | "text-track" | "needs-user-input-video" | "needs-user-input-audio" | "authentication-token" | "volume-level" | "cast" | "airplay" | "pip" | "fullscreen" | "vu-meter" | "poster-src" | "timeshift")[],
1588
1655
  "url",
1589
1656
  "edge-url",
1590
1657
  "target-buffer-time",
@@ -1595,6 +1662,7 @@ export declare class Controller extends HTMLElement {
1595
1662
  "min-buffer-time",
1596
1663
  "max-buffer-time",
1597
1664
  "max-audio-bit-rate",
1665
+ "max-initial-bit-rate",
1598
1666
  "burst-enabled",
1599
1667
  "mse-enabled",
1600
1668
  "mse-opus-enabled",
@@ -1625,7 +1693,9 @@ export declare class Controller extends HTMLElement {
1625
1693
  attributeChangedCallback(name: ControllerAttributes, oldValue: string, newValue?: string): void;
1626
1694
  connectListener(component: HTMLElement): void;
1627
1695
  disconnectListener(component: HTMLElement): void;
1696
+ handleTimeShiftUpdate: (timeShift: string | false) => void;
1628
1697
  get instance(): Vindral | undefined;
1698
+ get fullscreen(): Fullscreen | undefined;
1629
1699
  get airPlay(): AirPlaySender | undefined;
1630
1700
  connect(): void;
1631
1701
  }
@@ -1704,7 +1774,7 @@ export declare class PlayButton extends VindralButton {
1704
1774
  }
1705
1775
  export declare class Player extends HTMLElement {
1706
1776
  #private;
1707
- static observedAttributes: readonly ("title" | "advanced" | "poster" | "language" | "channels" | "buffering" | "paused" | "volume" | "muted" | "user-interacting" | "is-casting" | "cast-available" | "cast-receiver-name" | "ui-locked" | "hide-ui-on-pause" | "is-fullscreen" | "is-fullscreen-fallback" | "rendition-levels" | "rendition-level" | "max-video-bit-rate" | "channel-id" | "channel-group-id" | "pip-available" | "is-pip" | "airplay-available" | "is-airplaying" | "media" | "languages" | "text-tracks" | "text-track" | "needs-user-input-video" | "needs-user-input-audio" | "authentication-token" | "volume-level" | "cast" | "airplay" | "pip" | "fullscreen" | "vu-meter" | "poster-src" | "url" | "offline" | "edge-url" | "target-buffer-time" | "cast-receiver-id" | "cast-background" | "log-level" | "max-size" | "min-buffer-time" | "max-buffer-time" | "max-audio-bit-rate" | "burst-enabled" | "mse-enabled" | "mse-opus-enabled" | "ios-background-play-enabled" | "ios-wake-lock-enabled" | "ios-media-element-enabled" | "abr-enabled" | "size-based-resolution-cap-enabled" | "telemetry-enabled" | "video-codecs" | "drm-headers" | "drm-queryparams" | "drm-widevine-video-robustness" | "drm-widevine-audio-robustness" | "drm-playready-video-robustness" | "drm-playready-audio-robustness" | "webtransport-enabled" | "reconnect-retries" | "auto-instance-enabled" | "refresh-poster-enabled" | "stream-poll-enabled")[];
1777
+ static observedAttributes: readonly ("title" | "advanced" | "poster" | "language" | "channels" | "buffering" | "paused" | "volume" | "muted" | "duration" | "user-interacting" | "is-casting" | "cast-available" | "cast-receiver-name" | "ui-locked" | "hide-ui-on-pause" | "is-fullscreen" | "is-fullscreen-fallback" | "rendition-levels" | "rendition-level" | "max-video-bit-rate" | "max-initial-bit-rate" | "channel-id" | "channel-group-id" | "pip-available" | "is-pip" | "airplay-available" | "is-airplaying" | "media" | "languages" | "text-tracks" | "text-track" | "needs-user-input-video" | "needs-user-input-audio" | "authentication-token" | "volume-level" | "cast" | "airplay" | "pip" | "fullscreen" | "vu-meter" | "poster-src" | "timeshift" | "url" | "offline" | "edge-url" | "target-buffer-time" | "cast-receiver-id" | "cast-background" | "log-level" | "max-size" | "min-buffer-time" | "max-buffer-time" | "max-audio-bit-rate" | "burst-enabled" | "mse-enabled" | "mse-opus-enabled" | "ios-background-play-enabled" | "ios-wake-lock-enabled" | "ios-media-element-enabled" | "abr-enabled" | "size-based-resolution-cap-enabled" | "telemetry-enabled" | "video-codecs" | "drm-headers" | "drm-queryparams" | "drm-widevine-video-robustness" | "drm-widevine-audio-robustness" | "drm-playready-video-robustness" | "drm-playready-audio-robustness" | "webtransport-enabled" | "reconnect-retries" | "auto-instance-enabled" | "refresh-poster-enabled" | "stream-poll-enabled")[];
1708
1778
  constructor();
1709
1779
  connectedCallback(): void;
1710
1780
  disconnectedCallback(): void;
@@ -1767,6 +1837,20 @@ export declare class ScrollOverlay extends HTMLElement {
1767
1837
  set visible(value: boolean);
1768
1838
  get visible(): boolean;
1769
1839
  }
1840
+ declare class VindralRange extends HTMLElement {
1841
+ #private;
1842
+ static observedAttributes: string[];
1843
+ range: HTMLInputElement;
1844
+ constructor();
1845
+ connectedCallback(): void;
1846
+ disconnectedCallback(): void;
1847
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
1848
+ enable(): void;
1849
+ disable(): void;
1850
+ handleEvent(event: Event): void;
1851
+ updateBar(): void;
1852
+ get keysUsed(): string[];
1853
+ }
1770
1854
  declare class VindralUserInputPlayOverlay extends HTMLElement {
1771
1855
  #private;
1772
1856
  static observedAttributes: string[];
@@ -1793,20 +1877,6 @@ declare class VindralPlayOverlay extends HTMLElement {
1793
1877
  disconnectedCallback(): void;
1794
1878
  attributeChangedCallback(name: string, old: string | null, value: string | null): void;
1795
1879
  }
1796
- declare class VindralRange extends HTMLElement {
1797
- #private;
1798
- static observedAttributes: string[];
1799
- range: HTMLInputElement;
1800
- constructor();
1801
- connectedCallback(): void;
1802
- disconnectedCallback(): void;
1803
- attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
1804
- enable(): void;
1805
- disable(): void;
1806
- handleEvent(event: Event): void;
1807
- updateBar(): void;
1808
- get keysUsed(): string[];
1809
- }
1810
1880
  export declare class VolumeRange extends VindralRange {
1811
1881
  #private;
1812
1882
  static observedAttributes: string[];