@vindral/web-sdk 3.4.3 → 4.0.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/core.js ADDED
@@ -0,0 +1,14 @@
1
+ import { A as C, b as I, C as _, c as O, e as D, D as T, I as a, a as A, N as s, V as r, f as F } from "./DwDXQwR0.js";
2
+ export {
3
+ C as AUTHENTICATION_EXPIRED_CODE,
4
+ I as AUTHENTICATION_FAILED_CODE,
5
+ _ as CHANNEL_NOT_FOUND_CODE,
6
+ O as CONNECTION_FAILED_AFTER_RETRIES_CODE,
7
+ D as CONNECTION_FAILED_CODE,
8
+ T as DISCONNECTED_BY_EDGE,
9
+ a as INACTIVITY_CODE,
10
+ A as Level,
11
+ s as NO_INCOMING_DATA,
12
+ r as Vindral,
13
+ F as VindralError
14
+ };
@@ -1,31 +1,3 @@
1
- type AudioCodec = "aac" | "opus" | "mp3";
2
- type VideoCodec = "h264" | "av1";
3
- /**
4
- * Log level
5
- * @enum
6
- */
7
- export declare const Level: {
8
- readonly CRITICAL: "critical";
9
- readonly ERROR: "error";
10
- readonly WARN: "warn";
11
- readonly INFO: "info";
12
- readonly DEBUG: "debug";
13
- readonly TRACE: "trace";
14
- };
15
- export type Level = (typeof Level)[keyof typeof Level];
16
- /**
17
- * Represents a timed metadata event
18
- */
19
- export interface Metadata {
20
- /**
21
- * The raw string content as it was ingested (if using JSON, it needs to be parsed on your end)
22
- */
23
- content: string;
24
- /**
25
- * Timestamp in ms
26
- */
27
- timestamp: number;
28
- }
29
1
  type MatchingKeys<TRecord, TMatch, K extends keyof TRecord = keyof TRecord> = K extends (TRecord[K] extends TMatch ? K : never) ? K : never;
30
2
  type VoidKeys<Record> = MatchingKeys<Record, void>;
31
3
  type EventListenerReturnType = (() => void) | void;
@@ -54,6 +26,23 @@ declare class Emitter<TEvents, TEmits = TEvents, ArgLessEvents extends VoidKeys<
54
26
  reset(): void;
55
27
  private add;
56
28
  }
29
+ declare const Levels: readonly [
30
+ "off",
31
+ "error",
32
+ "warn",
33
+ "info",
34
+ "debug",
35
+ "trace"
36
+ ];
37
+ export type Level = (typeof Levels)[number];
38
+ export declare const Level: {
39
+ ERROR: "error";
40
+ WARN: "warn";
41
+ INFO: "info";
42
+ DEBUG: "debug";
43
+ TRACE: "trace";
44
+ OFF: "off";
45
+ };
57
46
  interface MinMaxAverage {
58
47
  last: number;
59
48
  /**
@@ -69,6 +58,21 @@ interface MinMaxAverage {
69
58
  */
70
59
  min: number;
71
60
  }
61
+ type AudioCodec = "aac" | "opus" | "mp3";
62
+ type VideoCodec = "h264" | "av1";
63
+ /**
64
+ * Represents a timed metadata event
65
+ */
66
+ export interface Metadata {
67
+ /**
68
+ * The raw string content as it was ingested (if using JSON, it needs to be parsed on your end)
69
+ */
70
+ content: string;
71
+ /**
72
+ * Timestamp in ms
73
+ */
74
+ timestamp: number;
75
+ }
72
76
  export interface TimeRange {
73
77
  start: number;
74
78
  end: number;
@@ -465,125 +469,6 @@ export declare class ApiClient {
465
469
  private toChannels;
466
470
  private toChannel;
467
471
  }
468
- /**
469
- * Available events to listen to
470
- */
471
- export interface CastSenderEvents {
472
- /**
473
- * When a connection has been established with a CastReceiver
474
- */
475
- ["connected"]: void;
476
- /**
477
- * When a previous session has been resumed
478
- */
479
- ["resumed"]: void;
480
- /**
481
- * When a CastReceiver has lost or stopped a connection
482
- */
483
- ["disconnected"]: void;
484
- /**
485
- * When a connection attempt was initiated unsuccessfully
486
- */
487
- ["failed"]: void;
488
- /**
489
- * When the remote connection emits a metadata event
490
- */
491
- ["metadata"]: Metadata;
492
- /**
493
- * When the remote connection receives a server wallclock time event
494
- */
495
- ["server wallclock time"]: number;
496
- }
497
- /**
498
- * Used for initializing the CastSender
499
- */
500
- export interface CastConfig {
501
- /**
502
- * The [Vindral Options](./Options) to use for the Cast Receiver
503
- */
504
- options: Options;
505
- /**
506
- * URL to a background image.
507
- * Example: "https://via.placeholder.com/256x144"
508
- */
509
- background?: string;
510
- /**
511
- * Override this if you have your own custom receiver
512
- */
513
- receiverApplicationId?: string;
514
- }
515
- /**
516
- * CastSender handles initiation of and communication with the Google Cast Receiver
517
- */
518
- export declare class CastSender extends Emitter<CastSenderEvents> {
519
- private state;
520
- private config;
521
- private unloaded;
522
- constructor(config: CastConfig);
523
- /**
524
- * True if the instance is casting right now
525
- */
526
- get casting(): boolean;
527
- /**
528
- * The current volume
529
- */
530
- get volume(): number;
531
- /**
532
- * Set the current volume. Setting this to zero is equivalent to muting the video
533
- */
534
- set volume(volume: number);
535
- /**
536
- * The current language
537
- */
538
- get language(): string | undefined;
539
- /**
540
- * Set the current language
541
- */
542
- set language(language: string | undefined);
543
- /**
544
- * The current channelId
545
- */
546
- get channelId(): string;
547
- /**
548
- * Set the current channelId
549
- */
550
- set channelId(channelId: string);
551
- /**
552
- * Update authentication token on an already established and authenticated connection
553
- */
554
- updateAuthenticationToken: (token: string) => void;
555
- /**
556
- * Fully unloads the instance. This disconnects the current listener but lets the
557
- * cast session continue on the receiving device
558
- */
559
- unload: () => void;
560
- /**
561
- * Initiates the CastSender.
562
- * Will reject if Cast is not available on the device or the network.
563
- */
564
- init: () => Promise<void>;
565
- /**
566
- * Requests a session. It will open the native cast receiver chooser dialog
567
- */
568
- start: () => Promise<void>;
569
- /**
570
- * Stops a session. It will stop playback on device as well.
571
- */
572
- stop: () => void;
573
- /**
574
- * Returns a string representing the name of the Cast receiver device or undefined if no receiver exists
575
- */
576
- getReceiverName: () => string | undefined;
577
- private onGCastApiAvailable;
578
- private send;
579
- private onMessage;
580
- private onSessionStarted;
581
- private onSessionStateChanged;
582
- private getInstance;
583
- private getSession;
584
- private castLibrariesAdded;
585
- private verifyCastLibraries;
586
- }
587
472
  interface VindralErrorProps {
588
473
  isFatal: boolean;
589
474
  type?: ErrorType;
@@ -627,73 +512,6 @@ export declare class VindralError extends Error {
627
512
  */
628
513
  toStringifiable: () => Record<string, unknown>;
629
514
  }
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
- }
697
515
  type PlaybackState = "buffering" | "playing" | "paused";
698
516
  type BufferStateEvent = "filled" | "drained";
699
517
  interface PlaybackModuleStatistics {
@@ -975,8 +793,6 @@ interface DecoderStatistics {
975
793
  audioDecodeTime: MinMaxAverage;
976
794
  videoTransportTime: MinMaxAverage;
977
795
  }
978
- type ConnectionType = "bluetooth" | "cellular" | "ethernet" | "mixed" | "none" | "other" | "unknown" | "wifi" | "wimax";
979
- type EffectiveConnectionType = "2g" | "3g" | "4g" | "slow-2g";
980
796
  interface DocumentStateModulesStatistics {
981
797
  isVisible: boolean;
982
798
  isOnline: boolean;
@@ -1444,6 +1260,10 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1444
1260
  * The ranges are specified in milliseconds.
1445
1261
  */
1446
1262
  get audioBufferedRanges(): ReadonlyArray<TimeRange>;
1263
+ /**
1264
+ * The API client for calls to the public available endpoints of the Vindral Live CDN.
1265
+ */
1266
+ getApiClient(): ApiClient;
1447
1267
  get lastBufferEvent(): Readonly<BufferStateEvent>;
1448
1268
  get activeRatios(): Map<string, number>;
1449
1269
  get bufferingRatios(): Map<string, number>;
@@ -1555,6 +1375,192 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
1555
1375
  private timeToFirstFrame;
1556
1376
  private willUseMediaSource;
1557
1377
  }
1378
+ /**
1379
+ * Available events to listen to
1380
+ */
1381
+ export interface CastSenderEvents {
1382
+ /**
1383
+ * When a connection has been established with a CastReceiver
1384
+ */
1385
+ ["connected"]: void;
1386
+ /**
1387
+ * When a previous session has been resumed
1388
+ */
1389
+ ["resumed"]: void;
1390
+ /**
1391
+ * When a CastReceiver has lost or stopped a connection
1392
+ */
1393
+ ["disconnected"]: void;
1394
+ /**
1395
+ * When a connection attempt was initiated unsuccessfully
1396
+ */
1397
+ ["failed"]: void;
1398
+ /**
1399
+ * When the remote connection emits a metadata event
1400
+ */
1401
+ ["metadata"]: Metadata;
1402
+ /**
1403
+ * When the remote connection receives a server wallclock time event
1404
+ */
1405
+ ["server wallclock time"]: number;
1406
+ }
1407
+ /**
1408
+ * Used for initializing the CastSender
1409
+ */
1410
+ export interface CastConfig {
1411
+ /**
1412
+ * The [Vindral Options](./Options) to use for the Cast Receiver
1413
+ */
1414
+ options: Options;
1415
+ /**
1416
+ * URL to a background image.
1417
+ * Example: "https://via.placeholder.com/256x144"
1418
+ */
1419
+ background?: string;
1420
+ /**
1421
+ * Override this if you have your own custom receiver
1422
+ */
1423
+ receiverApplicationId?: string;
1424
+ }
1425
+ /**
1426
+ * CastSender handles initiation of and communication with the Google Cast Receiver
1427
+ */
1428
+ export declare class CastSender extends Emitter<CastSenderEvents> {
1429
+ private state;
1430
+ private config;
1431
+ private unloaded;
1432
+ constructor(config: CastConfig);
1433
+ /**
1434
+ * True if the instance is casting right now
1435
+ */
1436
+ get casting(): boolean;
1437
+ /**
1438
+ * The current volume
1439
+ */
1440
+ get volume(): number;
1441
+ /**
1442
+ * Set the current volume. Setting this to zero is equivalent to muting the video
1443
+ */
1444
+ set volume(volume: number);
1445
+ /**
1446
+ * The current language
1447
+ */
1448
+ get language(): string | undefined;
1449
+ /**
1450
+ * Set the current language
1451
+ */
1452
+ set language(language: string | undefined);
1453
+ /**
1454
+ * The current channelId
1455
+ */
1456
+ get channelId(): string;
1457
+ /**
1458
+ * Set the current channelId
1459
+ */
1460
+ set channelId(channelId: string);
1461
+ /**
1462
+ * Update authentication token on an already established and authenticated connection
1463
+ */
1464
+ updateAuthenticationToken: (token: string) => void;
1465
+ /**
1466
+ * Fully unloads the instance. This disconnects the current listener but lets the
1467
+ * cast session continue on the receiving device
1468
+ */
1469
+ unload: () => void;
1470
+ /**
1471
+ * Initiates the CastSender.
1472
+ * Will reject if Cast is not available on the device or the network.
1473
+ */
1474
+ init: () => Promise<void>;
1475
+ /**
1476
+ * Requests a session. It will open the native cast receiver chooser dialog
1477
+ */
1478
+ start: () => Promise<void>;
1479
+ /**
1480
+ * Stops a session. It will stop playback on device as well.
1481
+ */
1482
+ stop: () => void;
1483
+ /**
1484
+ * Returns a string representing the name of the Cast receiver device or undefined if no receiver exists
1485
+ */
1486
+ getReceiverName: () => string | undefined;
1487
+ private onGCastApiAvailable;
1488
+ private send;
1489
+ private onMessage;
1490
+ private onSessionStarted;
1491
+ private onSessionStateChanged;
1492
+ private getInstance;
1493
+ private getSession;
1494
+ private castLibrariesAdded;
1495
+ private verifyCastLibraries;
1496
+ }
1497
+ interface AirPlaySenderEvents {
1498
+ /**
1499
+ * When airplay targets are available.
1500
+ */
1501
+ ["available"]: void;
1502
+ /**
1503
+ * When a connection has been established with an airplay target.
1504
+ */
1505
+ ["connected"]: void;
1506
+ /**
1507
+ * When the airplay target has lost or stopped a connection.
1508
+ */
1509
+ ["disconnected"]: void;
1510
+ }
1511
+ interface AirPlayConfig {
1512
+ /**
1513
+ * URL to use when connecting to the stream.
1514
+ */
1515
+ url: string;
1516
+ /**
1517
+ * Channel ID to connect to.
1518
+ */
1519
+ channelId: string;
1520
+ /**
1521
+ * A container to attach the video element in. This should be the same container that the vindral video element is attached to.
1522
+ */
1523
+ container: HTMLElement;
1524
+ /**
1525
+ * An authentication token to provide to the server when connecting - only needed for channels with authentication enabled
1526
+ * Note: If not supplied when needed, an "Authentication Failed" error will be raised.
1527
+ */
1528
+ authenticationToken?: string;
1529
+ }
1530
+ declare class AirPlaySender extends Emitter<AirPlaySenderEvents> {
1531
+ private config;
1532
+ private hlsUrl;
1533
+ private element;
1534
+ private connectingTimeout?;
1535
+ constructor(config: AirPlayConfig);
1536
+ /**
1537
+ * True if the instance is casting right now.
1538
+ */
1539
+ get casting(): boolean;
1540
+ /**
1541
+ * Set the current channelId.
1542
+ */
1543
+ set channelId(channelId: string);
1544
+ /**
1545
+ * Update authentication token on an already established and authenticated connection.
1546
+ */
1547
+ updateAuthenticationToken: (_token: string) => void;
1548
+ /**
1549
+ * Fully unloads the instance. This disconnects the current listeners.
1550
+ */
1551
+ unload: () => void;
1552
+ /**
1553
+ * Show the AirPlay picker.
1554
+ */
1555
+ showPlaybackTargetPicker(): void;
1556
+ /**
1557
+ * Returns if AirPlay is supported.
1558
+ */
1559
+ static isAirPlaySupported(): boolean;
1560
+ private onAirPlayAvailable;
1561
+ private onAirPlayPlaybackChanged;
1562
+ private checkHlsUrl;
1563
+ }
1558
1564
  /**
1559
1565
  * Available options when initializing the Player. Used for enabling/disabling features
1560
1566
  * and hiding/showing buttons in the control pane