@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/react.d.ts CHANGED
@@ -17,6 +17,10 @@ interface Channel {
17
17
  * URLs to fetch thumbnail from
18
18
  */
19
19
  thumbnailUrls: string[];
20
+ /**
21
+ * Urls for timeshift if available
22
+ */
23
+ timeshiftUrls?: string[];
20
24
  }
21
25
  interface ClientOverrides {
22
26
  maxVideoBitRate?: number;
@@ -215,6 +219,10 @@ interface MoQConnectInfo {
215
219
  telemetry?: Telemetry;
216
220
  channels: ChannelWithCatalog[];
217
221
  edges: Edge[];
222
+ timeshift: {
223
+ urls: string[];
224
+ duration: string;
225
+ };
218
226
  }
219
227
  interface VindralConnectInfo {
220
228
  logsUrl?: string;
@@ -425,6 +433,14 @@ interface Options {
425
433
  * This can be used to provide user options to limit the video bandwidth usage.
426
434
  */
427
435
  maxVideoBitRate?: number;
436
+ /**
437
+ * Initial maximum bit rate cap applied when first connecting to a channel.
438
+ * This helps prevent buffering on initial connection by starting at a conservative bitrate.
439
+ * The client will adapt to higher bitrates as bandwidth allows if ABR is enabled.
440
+ *
441
+ * Default is 2.5 Mbps (2500000 bits per second).
442
+ */
443
+ maxInitialBitRate?: number;
428
444
  /**
429
445
  * Controls video element background behaviour while loading.
430
446
  * - If `false`, a black background will be shown.
@@ -437,6 +453,14 @@ interface Options {
437
453
  * Whether to start the player muted or to try to start playing audio automatically.
438
454
  */
439
455
  muted?: boolean;
456
+ /**
457
+ * Initial volume level for the player. A floating point value between 0-1.
458
+ * Default is 1 (100% volume).
459
+ *
460
+ * Note: Volume cannot be set on iOS devices due to system restrictions.
461
+ * The volume property is not settable in JavaScript on iOS, and reading it always returns 1.
462
+ */
463
+ volume?: number;
440
464
  /**
441
465
  * Provide a custom reconnect handler to control when the instance should stop trying to
442
466
  * reconnect. The reconnect handler should either return true to allow the reconnect or
@@ -723,6 +747,20 @@ interface IncomingDataModuleStatistics {
723
747
  */
724
748
  bytesReceived: number;
725
749
  }
750
+ interface JitterStatistics {
751
+ /** Minimum jitter in the recent window */
752
+ min: number;
753
+ /** Maximum jitter in the recent window for spike detection */
754
+ max: number;
755
+ /** Latest average jitter in ms (recent window) */
756
+ last: number;
757
+ /** Average jitter in ms (RFC 3550 style, smoothed with /16) */
758
+ average: number;
759
+ }
760
+ interface JitterModuleStatistics {
761
+ audioJitter: JitterStatistics | undefined;
762
+ videoJitter: JitterStatistics | undefined;
763
+ }
726
764
  interface MseModuleStatistics {
727
765
  quotaErrorCount: number;
728
766
  mediaSourceOpenTime: number;
@@ -746,11 +784,11 @@ interface QualityOfServiceModuleStatistics {
746
784
  */
747
785
  fatalQosCount: number;
748
786
  /**
749
- * Ratio of time being spent on different bitrates.
750
- * Example: `"timeSpentRatio": { "1160000": 0.2, "2260000": 0.8 }` shows 20% spent on 1.16 Mbps, 80% spent on 2.26 Mbps.
787
+ * Ratio of time being spent on different quality indexes. Index 0 is always the highest quality.
788
+ * Example: `"timeSpentRatio": { "0": 0.8, "1": 0.2 }` shows 80% spent on the best level, 20% on the next one.
751
789
  */
752
790
  timeSpentRatio: {
753
- [bitRate: string]: number;
791
+ [qualityIndex: string]: number;
754
792
  };
755
793
  }
756
794
  interface SyncModuleStatistics {
@@ -797,7 +835,7 @@ declare class UserAgentInformation {
797
835
  userAgent: string;
798
836
  };
799
837
  }
800
- type ModuleStatistics = AdaptivityStatistics & BufferTimeStatistics & ConnectionStatistics & ConstraintCapStatistics & DecoderStatistics & DocumentStateModulesStatistics & IncomingDataModuleStatistics & MseModuleStatistics & PlaybackModuleStatistics & QualityOfServiceModuleStatistics & RenditionsModuleStatistics & SyncModuleStatistics & TelemetryModuleStatistics & VideoPlayerStatistics;
838
+ type ModuleStatistics = AdaptivityStatistics & BufferTimeStatistics & ConnectionStatistics & ConstraintCapStatistics & DecoderStatistics & DocumentStateModulesStatistics & IncomingDataModuleStatistics & JitterModuleStatistics & MseModuleStatistics & PlaybackModuleStatistics & QualityOfServiceModuleStatistics & RenditionsModuleStatistics & SyncModuleStatistics & TelemetryModuleStatistics & VideoPlayerStatistics;
801
839
  type Statistics = ModuleStatistics & ReturnType<UserAgentInformation["getUserAgentInformation"]> & {
802
840
  /**
803
841
  * Version of the @vindral/web-sdk being used.
@@ -839,11 +877,14 @@ type Statistics = ModuleStatistics & ReturnType<UserAgentInformation["getUserAge
839
877
  */
840
878
  timeToFirstFrame?: number;
841
879
  iosMediaElementEnabled?: boolean;
880
+ /**
881
+ * Average bitrate for the entire session in bits/second.
882
+ */
883
+ averageBitRate?: number;
842
884
  };
843
885
  declare class Vindral extends Emitter<PublicVindralEvents> {
844
886
  #private;
845
887
  private static MAX_POOL_SIZE;
846
- private static INITIAL_MAX_BIT_RATE;
847
888
  private static DISCONNECT_TIMEOUT;
848
889
  private static REMOVE_CUE_THRESHOLD;
849
890
  /**
@@ -1303,6 +1344,10 @@ interface VolumeState {
1303
1344
  */
1304
1345
  volume: number;
1305
1346
  }
1347
+ interface TimeShiftInfo {
1348
+ urls: string[];
1349
+ duration: string;
1350
+ }
1306
1351
  interface PublicVindralEvents {
1307
1352
  /**
1308
1353
  * When an error that requires action has occured
@@ -1399,6 +1444,10 @@ interface PublicVindralEvents {
1399
1444
  * from external sources such as OS media shortcuts or other native UI outside of the browser.
1400
1445
  */
1401
1446
  ["volume state"]: Readonly<VolumeState>;
1447
+ /**
1448
+ * Emitted when the timeshift URLs are updated.
1449
+ */
1450
+ ["timeshift info"]: Readonly<TimeShiftInfo>;
1402
1451
  ["buffer state event"]: Readonly<BufferStateEvent>;
1403
1452
  ["initialized media"]: void;
1404
1453
  }
@@ -1589,11 +1638,29 @@ declare class AirPlaySender extends Emitter<AirPlaySenderEvents> {
1589
1638
  private getHlsUrl;
1590
1639
  private checkHlsUrl;
1591
1640
  }
1641
+ interface FullscreenEvents {
1642
+ ["on fullscreen change"]: boolean;
1643
+ }
1644
+ declare class Fullscreen extends Emitter<FullscreenEvents> {
1645
+ private container;
1646
+ constructor(container: HTMLElement);
1647
+ unload: () => void;
1648
+ request: () => Promise<void>;
1649
+ exit: () => Promise<void>;
1650
+ private onChange;
1651
+ isFullscreen: () => boolean;
1652
+ isSupported: () => boolean;
1653
+ isFullscreenApiSupported: () => boolean;
1654
+ static isFullscreenApiSupported: (element: HTMLElement) => boolean;
1655
+ private isInIframe;
1656
+ private get requestFn();
1657
+ private get exitFn();
1658
+ }
1592
1659
  type ControllerAttributes = (typeof Controller.observedAttributes)[number];
1593
1660
  declare class Controller extends HTMLElement {
1594
1661
  #private;
1595
1662
  static observedAttributes: readonly [
1596
- ...("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")[],
1663
+ ...("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")[],
1597
1664
  "url",
1598
1665
  "edge-url",
1599
1666
  "target-buffer-time",
@@ -1604,6 +1671,7 @@ declare class Controller extends HTMLElement {
1604
1671
  "min-buffer-time",
1605
1672
  "max-buffer-time",
1606
1673
  "max-audio-bit-rate",
1674
+ "max-initial-bit-rate",
1607
1675
  "burst-enabled",
1608
1676
  "mse-enabled",
1609
1677
  "mse-opus-enabled",
@@ -1634,7 +1702,9 @@ declare class Controller extends HTMLElement {
1634
1702
  attributeChangedCallback(name: ControllerAttributes, oldValue: string, newValue?: string): void;
1635
1703
  connectListener(component: HTMLElement): void;
1636
1704
  disconnectListener(component: HTMLElement): void;
1705
+ handleTimeShiftUpdate: (timeShift: string | false) => void;
1637
1706
  get instance(): Vindral | undefined;
1707
+ get fullscreen(): Fullscreen | undefined;
1638
1708
  get airPlay(): AirPlaySender | undefined;
1639
1709
  connect(): void;
1640
1710
  }
@@ -1720,7 +1790,7 @@ declare class PlayButton extends VindralButton {
1720
1790
  type PlayerAttributes = (typeof Player.observedAttributes)[number];
1721
1791
  declare class Player extends HTMLElement {
1722
1792
  #private;
1723
- 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")[];
1793
+ 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")[];
1724
1794
  constructor();
1725
1795
  connectedCallback(): void;
1726
1796
  disconnectedCallback(): void;
@@ -1786,6 +1856,20 @@ declare class ScrollOverlay extends HTMLElement {
1786
1856
  set visible(value: boolean);
1787
1857
  get visible(): boolean;
1788
1858
  }
1859
+ declare class VindralRange extends HTMLElement {
1860
+ #private;
1861
+ static observedAttributes: string[];
1862
+ range: HTMLInputElement;
1863
+ constructor();
1864
+ connectedCallback(): void;
1865
+ disconnectedCallback(): void;
1866
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
1867
+ enable(): void;
1868
+ disable(): void;
1869
+ handleEvent(event: Event): void;
1870
+ updateBar(): void;
1871
+ get keysUsed(): string[];
1872
+ }
1789
1873
  type UserInputPlayOverlayAttributes = (typeof VindralUserInputPlayOverlay.observedAttributes)[number];
1790
1874
  declare class VindralUserInputPlayOverlay extends HTMLElement {
1791
1875
  #private;
@@ -1815,20 +1899,6 @@ declare class VindralPlayOverlay extends HTMLElement {
1815
1899
  disconnectedCallback(): void;
1816
1900
  attributeChangedCallback(name: string, old: string | null, value: string | null): void;
1817
1901
  }
1818
- declare class VindralRange extends HTMLElement {
1819
- #private;
1820
- static observedAttributes: string[];
1821
- range: HTMLInputElement;
1822
- constructor();
1823
- connectedCallback(): void;
1824
- disconnectedCallback(): void;
1825
- attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
1826
- enable(): void;
1827
- disable(): void;
1828
- handleEvent(event: Event): void;
1829
- updateBar(): void;
1830
- get keysUsed(): string[];
1831
- }
1832
1902
  type VolumeRangeAttributes = (typeof VolumeRange.observedAttributes)[number];
1833
1903
  declare class VolumeRange extends VindralRange {
1834
1904
  #private;
@@ -1840,11 +1910,11 @@ declare class VolumeRange extends VindralRange {
1840
1910
  get volume(): string;
1841
1911
  get muted(): boolean;
1842
1912
  }
1843
- type CustomElement<T, K extends string> = DetailedHTMLProps<HtmlHTMLAttributes<T> & {
1913
+ type CustomElement<T, K extends string> = Partial<Omit<DetailedHTMLProps<HtmlHTMLAttributes<T>, T>, "class"> & {
1844
1914
  [Key in K]?: string;
1845
1915
  } & {
1846
1916
  class?: string;
1847
- }, T>;
1917
+ }>;
1848
1918
  /**
1849
1919
  * @ignore
1850
1920
  */