Hls class
The Hls
class is the core of the HLS.js library used to instantiate player instances.
Signature:
export default class Hls implements HlsEventEmitter
Implements: HlsEventEmitter
Constructors
Constructor |
Modifiers |
Description |
---|---|---|
Creates an instance of an HLS client that can attach to exactly one |
Properties
Property |
Modifiers |
Type |
Description |
---|---|---|---|
|
number | ||
|
Get the complete list of audio tracks across all media groups | ||
|
get the complete list of subtitle tracks across all media groups | ||
number |
index of the selected audio track (index in audio track lists) | ||
|
Get the list of selectable audio tracks | ||
number |
Capping/max level value that should be used by automatic level selection algorithm ( | ||
|
boolean |
True when automatic level selection enabled | |
number |
Returns the current bandwidth estimate in bits per second, when available. Otherwise, | ||
|
boolean |
returns true when all SourceBuffers are buffered to the end | |
|
boolean |
Returns state of fragment loading toggled by calling | |
boolean |
Whether level capping is enabled. Default value is set via | ||
|
The runtime configuration used by the player. At instantiation this is combination of | ||
number |
Index of quality level (variant) currently played | ||
|
Get the default configuration applied to new instances. | ||
|
number | null |
the rate at which the edge of the current live playlist is advancing or 1 if there is none | |
|
typeof ErrorDetails | ||
|
typeof ErrorTypes | ||
|
typeof Events | ||
|
number | ||
number |
Return "first level": like a default level, if not set, falls back to index of first level referenced in manifest | ||
|
boolean |
set to true when startLoad is called before MANIFEST_PARSED event | |
|
boolean |
Whether or not enough has been buffered to seek to start position or use | |
|
InterstitialsManager | null |
returns Interstitials Program Manager | |
|
number |
Estimated position (in seconds) of live edge (ie edge of live playlist plus time sync playlist advanced) | |
|
LevelDetails | null | ||
|
Level[] | ||
|
number | null |
Position (in seconds) of live sync point (ie edge of live position minus safety delay defined by ```hls.config.liveSyncDuration```) | |
number |
Return the quality level of the currently or last (of none is loaded currently) segment | ||
|
The logger functions used by this player instance, configured on player instantiation. | ||
boolean |
get mode for Low-Latency HLS loading | ||
|
BufferInfo | null | ||
|
number |
Level set manually (if any) | |
|
number |
max level selectable in auto mode according to autoLevelCapping | |
|
number | ||
|
number |
maximum distance from the edge before the player seeks forward to ```hls.liveSyncPosition``` configured using ```liveMaxLatencyDurationCount``` (multiple of target duration) or ```liveMaxLatencyDuration``` | |
|
HTMLMediaElement | null | ||
|
typeof MetadataSchema | ||
|
number |
min level selectable in auto mode according to config.minAutoBitrate | |
number |
next automatically selected quality level | ||
number |
Index of next quality level loaded as scheduled by stream controller. | ||
number |
get next quality level loaded | ||
string[] | null |
ContentSteering pathwayPriority getter/setter | ||
|
Date | null |
get the datetime value relative to media.currentTime for the active level Program Date Time if present | |
|
string | ||
number |
Return the desired start level for the first fragment that will be loaded. The default value of -1 indicates automatic start level selection. Setting hls.nextAutoLevel without setting a startLevel will result in the nextAutoLevel value being used for one fragment load. | ||
|
number |
Get the startPosition set on startLoad(position) or on autostart with config.startPosition | |
boolean |
Whether subtitle display is enabled or not | ||
number |
index of the selected subtitle track (index in subtitle track lists) | ||
|
get alternate subtitle tracks list from playlist | ||
number | null |
target distance from the edge as calculated by the latency controller | ||
|
number |
get time to first byte estimate {number} | |
|
string | null |
Gets the currently loaded URL | |
|
Partial<HlsConfig> |
The configuration object provided on player instantiation. | |
|
string |
Get the video-dev/hls.js package version. |
Methods
Method |
Modifiers |
Description |
---|---|---|
Attaches Hls.js to a media element | ||
Dispose of the instance | ||
Detach Hls.js from the media | ||
returns mediaCapabilities.decodingInfo for a variant/rendition | ||
|
Get the MediaSource global used for MSE playback (ManagedMediaSource, MediaSource, or WebKitMediaSource). | |
|
Check if the required MediaSource Extensions are available. | |
|
Check if MediaSource Extensions are available and isTypeSupported checks pass for any baseline codecs. | |
Set the source URL. Can be relative or absolute. | ||
Prevents stream controller from loading new segments until | ||
When the media-element fails, this allows to detach and then re-attach it as one call (convenience method). Automatic recovery of media-errors by this process is configurable. | ||
Resumes stream controller segment loading after | ||
Find and select the best matching audio track, making a level switch when a Group change is necessary. Updates | ||
Find and select the best matching subtitle track, making a level switch when a Group change is necessary. Updates | ||
Start loading data from the stream source. Depending on default config, client starts loading automatically when a source is set. | ||
Stop loading of any stream data. | ||
Swap through possible audio codecs in the stream (for example to switch from stereo to 5.1) | ||
Detach HTMLMediaElement, MediaSource, and SourceBuffers without reset, for attaching to another instance | ||