@vindral/web-sdk 3.3.3 → 3.4.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/index.d.ts +105 -73
- package/index.js +1497 -1271
- package/index.umd.cjs +6 -6
- package/package.json +1 -1
- package/style.css +1 -1
package/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ declare class Emitter<TEvents, TEmits = TEvents, ArgLessEvents extends VoidKeys<
|
|
|
55
55
|
private add;
|
|
56
56
|
}
|
|
57
57
|
interface MinMaxAverage {
|
|
58
|
+
last: number;
|
|
58
59
|
/**
|
|
59
60
|
* Average value over a given interval.
|
|
60
61
|
*/
|
|
@@ -105,9 +106,15 @@ interface AudioRenditionProps {
|
|
|
105
106
|
channels: number;
|
|
106
107
|
sampleRate: number;
|
|
107
108
|
}
|
|
109
|
+
interface TextRenditionProps {
|
|
110
|
+
codec: "webvtt";
|
|
111
|
+
kind: "subtitles" | "captions";
|
|
112
|
+
label?: string;
|
|
113
|
+
}
|
|
108
114
|
type VideoRendition = VideoRenditionProps & RenditionProps;
|
|
109
115
|
type AudioRendition = AudioRenditionProps & RenditionProps;
|
|
110
|
-
type
|
|
116
|
+
type TextRendition = TextRenditionProps & RenditionProps;
|
|
117
|
+
type Rendition = VideoRendition | AudioRendition | TextRendition;
|
|
111
118
|
interface Size {
|
|
112
119
|
width: number;
|
|
113
120
|
height: number;
|
|
@@ -174,8 +181,6 @@ export interface Options {
|
|
|
174
181
|
/**
|
|
175
182
|
* Sets the maximum buffer time allowed. The vindral instance will automatically slowly increase
|
|
176
183
|
* the buffer time if the use experiences to much buffering with the initial buffer time.
|
|
177
|
-
*
|
|
178
|
-
* Note: This is not yet implemented
|
|
179
184
|
*/
|
|
180
185
|
maxBufferTime?: number;
|
|
181
186
|
/**
|
|
@@ -211,7 +216,6 @@ export interface Options {
|
|
|
211
216
|
*
|
|
212
217
|
* Is enabled by default.
|
|
213
218
|
*
|
|
214
|
-
* Note: Opus generally provides better audio quality and is therefore recommended to keep enabled.
|
|
215
219
|
*/
|
|
216
220
|
mseOpusEnabled?: boolean;
|
|
217
221
|
/**
|
|
@@ -619,6 +623,73 @@ export declare class VindralError extends Error {
|
|
|
619
623
|
*/
|
|
620
624
|
toStringifiable: () => Record<string, unknown>;
|
|
621
625
|
}
|
|
626
|
+
interface AirPlaySenderEvents {
|
|
627
|
+
/**
|
|
628
|
+
* When airplay targets are available.
|
|
629
|
+
*/
|
|
630
|
+
["available"]: void;
|
|
631
|
+
/**
|
|
632
|
+
* When a connection has been established with an airplay target.
|
|
633
|
+
*/
|
|
634
|
+
["connected"]: void;
|
|
635
|
+
/**
|
|
636
|
+
* When the airplay target has lost or stopped a connection.
|
|
637
|
+
*/
|
|
638
|
+
["disconnected"]: void;
|
|
639
|
+
}
|
|
640
|
+
interface AirPlayConfig {
|
|
641
|
+
/**
|
|
642
|
+
* URL to use when connecting to the stream.
|
|
643
|
+
*/
|
|
644
|
+
url: string;
|
|
645
|
+
/**
|
|
646
|
+
* Channel ID to connect to.
|
|
647
|
+
*/
|
|
648
|
+
channelId: string;
|
|
649
|
+
/**
|
|
650
|
+
* A container to attach the video element in. This should be the same container that the vindral video element is attached to.
|
|
651
|
+
*/
|
|
652
|
+
container: HTMLElement;
|
|
653
|
+
/**
|
|
654
|
+
* An authentication token to provide to the server when connecting - only needed for channels with authentication enabled
|
|
655
|
+
* Note: If not supplied when needed, an "Authentication Failed" error will be raised.
|
|
656
|
+
*/
|
|
657
|
+
authenticationToken?: string;
|
|
658
|
+
}
|
|
659
|
+
declare class AirPlaySender extends Emitter<AirPlaySenderEvents> {
|
|
660
|
+
private config;
|
|
661
|
+
private hlsUrl;
|
|
662
|
+
private element;
|
|
663
|
+
private connectingTimeout?;
|
|
664
|
+
private browser;
|
|
665
|
+
constructor(config: AirPlayConfig);
|
|
666
|
+
/**
|
|
667
|
+
* True if the instance is casting right now.
|
|
668
|
+
*/
|
|
669
|
+
get casting(): boolean;
|
|
670
|
+
/**
|
|
671
|
+
* Set the current channelId.
|
|
672
|
+
*/
|
|
673
|
+
set channelId(channelId: string);
|
|
674
|
+
/**
|
|
675
|
+
* Update authentication token on an already established and authenticated connection.
|
|
676
|
+
*/
|
|
677
|
+
updateAuthenticationToken: (_token: string) => void;
|
|
678
|
+
/**
|
|
679
|
+
* Fully unloads the instance. This disconnects the current listeners.
|
|
680
|
+
*/
|
|
681
|
+
unload: () => void;
|
|
682
|
+
/**
|
|
683
|
+
* Show the AirPlay picker.
|
|
684
|
+
*/
|
|
685
|
+
showPlaybackTargetPicker(): void;
|
|
686
|
+
/**
|
|
687
|
+
* Returns if AirPlay is supported.
|
|
688
|
+
*/
|
|
689
|
+
static isAirPlaySupported(): boolean;
|
|
690
|
+
private onAirPlayAvailable;
|
|
691
|
+
private onAirPlayPlaybackChanged;
|
|
692
|
+
}
|
|
622
693
|
type PlaybackState = "buffering" | "playing" | "paused";
|
|
623
694
|
type BufferStateEvent = "filled" | "drained";
|
|
624
695
|
interface PlaybackModuleStatistics {
|
|
@@ -736,6 +807,10 @@ export interface PublicVindralEvents {
|
|
|
736
807
|
* When the available languages is changed
|
|
737
808
|
*/
|
|
738
809
|
["languages"]: ReadonlyArray<string>;
|
|
810
|
+
/**
|
|
811
|
+
* When the available text tracks are changed
|
|
812
|
+
*/
|
|
813
|
+
["text tracks"]: ReadonlyArray<string>;
|
|
739
814
|
/**
|
|
740
815
|
* When the available channels is changed
|
|
741
816
|
*/
|
|
@@ -1096,10 +1171,12 @@ export type Statistics = ModuleStatistics & ReturnType<UserAgentInformation["get
|
|
|
1096
1171
|
* ```
|
|
1097
1172
|
*/
|
|
1098
1173
|
export declare class Vindral extends Emitter<PublicVindralEvents> {
|
|
1174
|
+
#private;
|
|
1099
1175
|
private static MAX_POOL_SIZE;
|
|
1100
1176
|
private static INITIAL_MAX_BIT_RATE;
|
|
1101
1177
|
private static PING_TIMEOUT;
|
|
1102
1178
|
private static DISCONNECT_TIMEOUT;
|
|
1179
|
+
private static REMOVE_CUE_THRESHOLD;
|
|
1103
1180
|
/**
|
|
1104
1181
|
* Picture in picture
|
|
1105
1182
|
*/
|
|
@@ -1277,6 +1354,9 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
|
|
|
1277
1354
|
* Set the current language
|
|
1278
1355
|
*/
|
|
1279
1356
|
set language(language: string | undefined);
|
|
1357
|
+
set textTrack(label: string | undefined);
|
|
1358
|
+
get textTracks(): string[];
|
|
1359
|
+
get textTrack(): string | undefined;
|
|
1280
1360
|
/**
|
|
1281
1361
|
* The current channelId
|
|
1282
1362
|
*/
|
|
@@ -1285,6 +1365,10 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
|
|
|
1285
1365
|
* Set the current channelId
|
|
1286
1366
|
*
|
|
1287
1367
|
* Possible channels to set are available from [[channels]]
|
|
1368
|
+
*
|
|
1369
|
+
* Note that the following scenarios are not possible right now:
|
|
1370
|
+
* - switching channel from a channel with audio to a channel without audio (unless audio only mode is active)
|
|
1371
|
+
* - switching channel from a channel with video to a channel without video (unless video only mode is active)
|
|
1288
1372
|
*/
|
|
1289
1373
|
set channelId(channelId: string);
|
|
1290
1374
|
/**
|
|
@@ -1379,6 +1463,8 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
|
|
|
1379
1463
|
private estimateRTT;
|
|
1380
1464
|
private connectHandler;
|
|
1381
1465
|
private emitLanguagesIfChanged;
|
|
1466
|
+
private updateTextTracks;
|
|
1467
|
+
private cleanupTextTracks;
|
|
1382
1468
|
private filterRenditions;
|
|
1383
1469
|
/**
|
|
1384
1470
|
* Patch the subscription with properties from the channel that isn't known until connection
|
|
@@ -1456,73 +1542,6 @@ export declare class Vindral extends Emitter<PublicVindralEvents> {
|
|
|
1456
1542
|
private timeToFirstFrame;
|
|
1457
1543
|
private willUseMediaSource;
|
|
1458
1544
|
}
|
|
1459
|
-
interface AirPlaySenderEvents {
|
|
1460
|
-
/**
|
|
1461
|
-
* When airplay targets are available.
|
|
1462
|
-
*/
|
|
1463
|
-
["available"]: void;
|
|
1464
|
-
/**
|
|
1465
|
-
* When a connection has been established with an airplay target.
|
|
1466
|
-
*/
|
|
1467
|
-
["connected"]: void;
|
|
1468
|
-
/**
|
|
1469
|
-
* When the airplay target has lost or stopped a connection.
|
|
1470
|
-
*/
|
|
1471
|
-
["disconnected"]: void;
|
|
1472
|
-
}
|
|
1473
|
-
interface AirPlayConfig {
|
|
1474
|
-
/**
|
|
1475
|
-
* URL to use when connecting to the stream.
|
|
1476
|
-
*/
|
|
1477
|
-
url: string;
|
|
1478
|
-
/**
|
|
1479
|
-
* Channel ID to connect to.
|
|
1480
|
-
*/
|
|
1481
|
-
channelId: string;
|
|
1482
|
-
/**
|
|
1483
|
-
* A container to attach the video element in. This should be the same container that the vindral video element is attached to.
|
|
1484
|
-
*/
|
|
1485
|
-
container: HTMLElement;
|
|
1486
|
-
/**
|
|
1487
|
-
* An authentication token to provide to the server when connecting - only needed for channels with authentication enabled
|
|
1488
|
-
* Note: If not supplied when needed, an "Authentication Failed" error will be raised.
|
|
1489
|
-
*/
|
|
1490
|
-
authenticationToken?: string;
|
|
1491
|
-
}
|
|
1492
|
-
declare class AirPlaySender extends Emitter<AirPlaySenderEvents> {
|
|
1493
|
-
private config;
|
|
1494
|
-
private hlsUrl;
|
|
1495
|
-
private element;
|
|
1496
|
-
private connectingTimeout?;
|
|
1497
|
-
private browser;
|
|
1498
|
-
constructor(config: AirPlayConfig);
|
|
1499
|
-
/**
|
|
1500
|
-
* True if the instance is casting right now.
|
|
1501
|
-
*/
|
|
1502
|
-
get casting(): boolean;
|
|
1503
|
-
/**
|
|
1504
|
-
* Set the current channelId.
|
|
1505
|
-
*/
|
|
1506
|
-
set channelId(channelId: string);
|
|
1507
|
-
/**
|
|
1508
|
-
* Update authentication token on an already established and authenticated connection.
|
|
1509
|
-
*/
|
|
1510
|
-
updateAuthenticationToken: (_token: string) => void;
|
|
1511
|
-
/**
|
|
1512
|
-
* Fully unloads the instance. This disconnects the current listeners.
|
|
1513
|
-
*/
|
|
1514
|
-
unload: () => void;
|
|
1515
|
-
/**
|
|
1516
|
-
* Show the AirPlay picker.
|
|
1517
|
-
*/
|
|
1518
|
-
showPlaybackTargetPicker(): void;
|
|
1519
|
-
/**
|
|
1520
|
-
* Returns if AirPlay is supported.
|
|
1521
|
-
*/
|
|
1522
|
-
static isAirPlaySupported(): boolean;
|
|
1523
|
-
private onAirPlayAvailable;
|
|
1524
|
-
private onAirPlayPlaybackChanged;
|
|
1525
|
-
}
|
|
1526
1545
|
/**
|
|
1527
1546
|
* Available options when initializing the Player. Used for enabling/disabling features
|
|
1528
1547
|
* and hiding/showing buttons in the control pane
|
|
@@ -1573,6 +1592,10 @@ export interface PlayerOptions {
|
|
|
1573
1592
|
* Enable or disable language selector
|
|
1574
1593
|
*/
|
|
1575
1594
|
languagesButtonEnabled?: boolean;
|
|
1595
|
+
/**
|
|
1596
|
+
* Enable or disable text track selector
|
|
1597
|
+
*/
|
|
1598
|
+
textTracksButtonEnabled?: boolean;
|
|
1576
1599
|
/**
|
|
1577
1600
|
* Enable or disable one-to-one (real size, not filling the entire container)
|
|
1578
1601
|
*/
|
|
@@ -1601,6 +1624,15 @@ export interface PlayerOptions {
|
|
|
1601
1624
|
* Enable or disable the AirPlay button
|
|
1602
1625
|
*/
|
|
1603
1626
|
airPlayButtonEnabled?: boolean;
|
|
1627
|
+
/**
|
|
1628
|
+
* Enable or disable the play overlay
|
|
1629
|
+
*/
|
|
1630
|
+
playOverlayEnabled?: boolean;
|
|
1631
|
+
/**
|
|
1632
|
+
* Enable or disable the buffering overlay
|
|
1633
|
+
|
|
1634
|
+
*/
|
|
1635
|
+
bufferingOverlayEnabled?: boolean;
|
|
1604
1636
|
}
|
|
1605
1637
|
/**
|
|
1606
1638
|
* Represents a Vindral player
|
|
@@ -1629,8 +1661,8 @@ export declare class Player {
|
|
|
1629
1661
|
private options;
|
|
1630
1662
|
private state;
|
|
1631
1663
|
private playerElement;
|
|
1632
|
-
private bufferingOverlay
|
|
1633
|
-
private playOverlay
|
|
1664
|
+
private bufferingOverlay?;
|
|
1665
|
+
private playOverlay?;
|
|
1634
1666
|
private castOverlay;
|
|
1635
1667
|
private channelSelectionList?;
|
|
1636
1668
|
private bar;
|