@vindral/web-sdk 3.4.4 → 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/B7jz034g.js +147 -0
- package/BTxJOjm9.js +32 -0
- package/BzSm3HsC.js +312 -0
- package/C291RiDK.js +127 -0
- package/DwDXQwR0.js +6037 -0
- package/README.md +74 -30
- package/api-client.d.ts +151 -0
- package/api-client.js +4 -0
- package/cast-sender.d.ts +396 -0
- package/cast-sender.js +230 -0
- package/core.d.ts +1364 -0
- package/core.js +14 -0
- package/{index.d.ts → legacy.d.ts} +202 -204
- package/legacy.es.js +7724 -0
- package/legacy.umd.js +59 -0
- package/package.json +25 -9
- package/player.d.ts +1583 -0
- package/player.js +3310 -0
- package/vindral-player-component.js +2 -0
- package/index.js +0 -7716
- package/index.umd.cjs +0 -59
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,18 +1,3 @@
|
|
|
1
|
-
type AudioCodec = "aac" | "opus" | "mp3";
|
|
2
|
-
type VideoCodec = "h264" | "av1";
|
|
3
|
-
/**
|
|
4
|
-
* Represents a timed metadata event
|
|
5
|
-
*/
|
|
6
|
-
export interface Metadata {
|
|
7
|
-
/**
|
|
8
|
-
* The raw string content as it was ingested (if using JSON, it needs to be parsed on your end)
|
|
9
|
-
*/
|
|
10
|
-
content: string;
|
|
11
|
-
/**
|
|
12
|
-
* Timestamp in ms
|
|
13
|
-
*/
|
|
14
|
-
timestamp: number;
|
|
15
|
-
}
|
|
16
1
|
type MatchingKeys<TRecord, TMatch, K extends keyof TRecord = keyof TRecord> = K extends (TRecord[K] extends TMatch ? K : never) ? K : never;
|
|
17
2
|
type VoidKeys<Record> = MatchingKeys<Record, void>;
|
|
18
3
|
type EventListenerReturnType = (() => void) | void;
|
|
@@ -73,6 +58,21 @@ interface MinMaxAverage {
|
|
|
73
58
|
*/
|
|
74
59
|
min: number;
|
|
75
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
|
+
}
|
|
76
76
|
export interface TimeRange {
|
|
77
77
|
start: number;
|
|
78
78
|
end: number;
|
|
@@ -469,125 +469,6 @@ export declare class ApiClient {
|
|
|
469
469
|
private toChannels;
|
|
470
470
|
private toChannel;
|
|
471
471
|
}
|
|
472
|
-
/**
|
|
473
|
-
* Available events to listen to
|
|
474
|
-
*/
|
|
475
|
-
export interface CastSenderEvents {
|
|
476
|
-
/**
|
|
477
|
-
* When a connection has been established with a CastReceiver
|
|
478
|
-
*/
|
|
479
|
-
["connected"]: void;
|
|
480
|
-
/**
|
|
481
|
-
* When a previous session has been resumed
|
|
482
|
-
*/
|
|
483
|
-
["resumed"]: void;
|
|
484
|
-
/**
|
|
485
|
-
* When a CastReceiver has lost or stopped a connection
|
|
486
|
-
*/
|
|
487
|
-
["disconnected"]: void;
|
|
488
|
-
/**
|
|
489
|
-
* When a connection attempt was initiated unsuccessfully
|
|
490
|
-
*/
|
|
491
|
-
["failed"]: void;
|
|
492
|
-
/**
|
|
493
|
-
* When the remote connection emits a metadata event
|
|
494
|
-
*/
|
|
495
|
-
["metadata"]: Metadata;
|
|
496
|
-
/**
|
|
497
|
-
* When the remote connection receives a server wallclock time event
|
|
498
|
-
*/
|
|
499
|
-
["server wallclock time"]: number;
|
|
500
|
-
}
|
|
501
|
-
/**
|
|
502
|
-
* Used for initializing the CastSender
|
|
503
|
-
*/
|
|
504
|
-
export interface CastConfig {
|
|
505
|
-
/**
|
|
506
|
-
* The [Vindral Options](./Options) to use for the Cast Receiver
|
|
507
|
-
*/
|
|
508
|
-
options: Options;
|
|
509
|
-
/**
|
|
510
|
-
* URL to a background image.
|
|
511
|
-
* Example: "https://via.placeholder.com/256x144"
|
|
512
|
-
*/
|
|
513
|
-
background?: string;
|
|
514
|
-
/**
|
|
515
|
-
* Override this if you have your own custom receiver
|
|
516
|
-
*/
|
|
517
|
-
receiverApplicationId?: string;
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* CastSender handles initiation of and communication with the Google Cast Receiver
|
|
521
|
-
*/
|
|
522
|
-
export declare class CastSender extends Emitter<CastSenderEvents> {
|
|
523
|
-
private state;
|
|
524
|
-
private config;
|
|
525
|
-
private unloaded;
|
|
526
|
-
constructor(config: CastConfig);
|
|
527
|
-
/**
|
|
528
|
-
* True if the instance is casting right now
|
|
529
|
-
*/
|
|
530
|
-
get casting(): boolean;
|
|
531
|
-
/**
|
|
532
|
-
* The current volume
|
|
533
|
-
*/
|
|
534
|
-
get volume(): number;
|
|
535
|
-
/**
|
|
536
|
-
* Set the current volume. Setting this to zero is equivalent to muting the video
|
|
537
|
-
*/
|
|
538
|
-
set volume(volume: number);
|
|
539
|
-
/**
|
|
540
|
-
* The current language
|
|
541
|
-
*/
|
|
542
|
-
get language(): string | undefined;
|
|
543
|
-
/**
|
|
544
|
-
* Set the current language
|
|
545
|
-
*/
|
|
546
|
-
set language(language: string | undefined);
|
|
547
|
-
/**
|
|
548
|
-
* The current channelId
|
|
549
|
-
*/
|
|
550
|
-
get channelId(): string;
|
|
551
|
-
/**
|
|
552
|
-
* Set the current channelId
|
|
553
|
-
*/
|
|
554
|
-
set channelId(channelId: string);
|
|
555
|
-
/**
|
|
556
|
-
* Update authentication token on an already established and authenticated connection
|
|
557
|
-
*/
|
|
558
|
-
updateAuthenticationToken: (token: string) => void;
|
|
559
|
-
/**
|
|
560
|
-
* Fully unloads the instance. This disconnects the current listener but lets the
|
|
561
|
-
* cast session continue on the receiving device
|
|
562
|
-
*/
|
|
563
|
-
unload: () => void;
|
|
564
|
-
/**
|
|
565
|
-
* Initiates the CastSender.
|
|
566
|
-
* Will reject if Cast is not available on the device or the network.
|
|
567
|
-
*/
|
|
568
|
-
init: () => Promise<void>;
|
|
569
|
-
/**
|
|
570
|
-
* Requests a session. It will open the native cast receiver chooser dialog
|
|
571
|
-
*/
|
|
572
|
-
start: () => Promise<void>;
|
|
573
|
-
/**
|
|
574
|
-
* Stops a session. It will stop playback on device as well.
|
|
575
|
-
*/
|
|
576
|
-
stop: () => void;
|
|
577
|
-
/**
|
|
578
|
-
* Returns a string representing the name of the Cast receiver device or undefined if no receiver exists
|
|
579
|
-
*/
|
|
580
|
-
getReceiverName: () => string | undefined;
|
|
581
|
-
private onGCastApiAvailable;
|
|
582
|
-
private send;
|
|
583
|
-
private onMessage;
|
|
584
|
-
private onSessionStarted;
|
|
585
|
-
private onSessionStateChanged;
|
|
586
|
-
private getInstance;
|
|
587
|
-
private getSession;
|
|
588
|
-
private castLibrariesAdded;
|
|
589
|
-
private verifyCastLibraries;
|
|
590
|
-
}
|
|
591
472
|
interface VindralErrorProps {
|
|
592
473
|
isFatal: boolean;
|
|
593
474
|
type?: ErrorType;
|
|
@@ -631,73 +512,6 @@ export declare class VindralError extends Error {
|
|
|
631
512
|
*/
|
|
632
513
|
toStringifiable: () => Record<string, unknown>;
|
|
633
514
|
}
|
|
634
|
-
interface AirPlaySenderEvents {
|
|
635
|
-
/**
|
|
636
|
-
* When airplay targets are available.
|
|
637
|
-
*/
|
|
638
|
-
["available"]: void;
|
|
639
|
-
/**
|
|
640
|
-
* When a connection has been established with an airplay target.
|
|
641
|
-
*/
|
|
642
|
-
["connected"]: void;
|
|
643
|
-
/**
|
|
644
|
-
* When the airplay target has lost or stopped a connection.
|
|
645
|
-
*/
|
|
646
|
-
["disconnected"]: void;
|
|
647
|
-
}
|
|
648
|
-
interface AirPlayConfig {
|
|
649
|
-
/**
|
|
650
|
-
* URL to use when connecting to the stream.
|
|
651
|
-
*/
|
|
652
|
-
url: string;
|
|
653
|
-
/**
|
|
654
|
-
* Channel ID to connect to.
|
|
655
|
-
*/
|
|
656
|
-
channelId: string;
|
|
657
|
-
/**
|
|
658
|
-
* A container to attach the video element in. This should be the same container that the vindral video element is attached to.
|
|
659
|
-
*/
|
|
660
|
-
container: HTMLElement;
|
|
661
|
-
/**
|
|
662
|
-
* An authentication token to provide to the server when connecting - only needed for channels with authentication enabled
|
|
663
|
-
* Note: If not supplied when needed, an "Authentication Failed" error will be raised.
|
|
664
|
-
*/
|
|
665
|
-
authenticationToken?: string;
|
|
666
|
-
}
|
|
667
|
-
declare class AirPlaySender extends Emitter<AirPlaySenderEvents> {
|
|
668
|
-
private config;
|
|
669
|
-
private hlsUrl;
|
|
670
|
-
private element;
|
|
671
|
-
private connectingTimeout?;
|
|
672
|
-
constructor(config: AirPlayConfig);
|
|
673
|
-
/**
|
|
674
|
-
* True if the instance is casting right now.
|
|
675
|
-
*/
|
|
676
|
-
get casting(): boolean;
|
|
677
|
-
/**
|
|
678
|
-
* Set the current channelId.
|
|
679
|
-
*/
|
|
680
|
-
set channelId(channelId: string);
|
|
681
|
-
/**
|
|
682
|
-
* Update authentication token on an already established and authenticated connection.
|
|
683
|
-
*/
|
|
684
|
-
updateAuthenticationToken: (_token: string) => void;
|
|
685
|
-
/**
|
|
686
|
-
* Fully unloads the instance. This disconnects the current listeners.
|
|
687
|
-
*/
|
|
688
|
-
unload: () => void;
|
|
689
|
-
/**
|
|
690
|
-
* Show the AirPlay picker.
|
|
691
|
-
*/
|
|
692
|
-
showPlaybackTargetPicker(): void;
|
|
693
|
-
/**
|
|
694
|
-
* Returns if AirPlay is supported.
|
|
695
|
-
*/
|
|
696
|
-
static isAirPlaySupported(): boolean;
|
|
697
|
-
private onAirPlayAvailable;
|
|
698
|
-
private onAirPlayPlaybackChanged;
|
|
699
|
-
private checkHlsUrl;
|
|
700
|
-
}
|
|
701
515
|
type PlaybackState = "buffering" | "playing" | "paused";
|
|
702
516
|
type BufferStateEvent = "filled" | "drained";
|
|
703
517
|
interface PlaybackModuleStatistics {
|
|
@@ -874,7 +688,7 @@ declare const defaultOptions: {
|
|
|
874
688
|
muted: boolean;
|
|
875
689
|
minBufferTime: number;
|
|
876
690
|
maxBufferTime: number;
|
|
877
|
-
logLevel:
|
|
691
|
+
logLevel: Level;
|
|
878
692
|
maxSize: Size;
|
|
879
693
|
maxVideoBitRate: number;
|
|
880
694
|
maxAudioBitRate: number;
|
|
@@ -979,8 +793,6 @@ interface DecoderStatistics {
|
|
|
979
793
|
audioDecodeTime: MinMaxAverage;
|
|
980
794
|
videoTransportTime: MinMaxAverage;
|
|
981
795
|
}
|
|
982
|
-
type ConnectionType = "bluetooth" | "cellular" | "ethernet" | "mixed" | "none" | "other" | "unknown" | "wifi" | "wimax";
|
|
983
|
-
type EffectiveConnectionType = "2g" | "3g" | "4g" | "slow-2g";
|
|
984
796
|
interface DocumentStateModulesStatistics {
|
|
985
797
|
isVisible: boolean;
|
|
986
798
|
isOnline: boolean;
|
|
@@ -1563,6 +1375,192 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
|
|
|
1563
1375
|
private timeToFirstFrame;
|
|
1564
1376
|
private willUseMediaSource;
|
|
1565
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
|
+
}
|
|
1566
1564
|
/**
|
|
1567
1565
|
* Available options when initializing the Player. Used for enabling/disabling features
|
|
1568
1566
|
* and hiding/showing buttons in the control pane
|