Skip to content

Commit 66d523e

Browse files
authored
Merge pull request #7628 from krseager/improve-hls-js-documentation
Update API documentation
1 parent 3c94323 commit 66d523e

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

docs/API.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ See [API Reference](https://hlsjs-dev.video-dev.org/api-docs/) for a complete li
5050
- [`liveSyncDuration`](#livesyncduration)
5151
- [`liveMaxLatencyDuration`](#livemaxlatencyduration)
5252
- [`maxLiveSyncPlaybackRate`](#maxlivesyncplaybackrate)
53+
- [`timelineOffset`](#timelineoffset)
5354
- [`liveDurationInfinity`](#livedurationinfinity)
5455
- [`liveBackBufferLength` (deprecated)](#livebackbufferlength-deprecated)
5556
- [`preferManagedMediaSource`](#prefermanagedmediasource)
@@ -80,6 +81,7 @@ See [API Reference](https://hlsjs-dev.video-dev.org/api-docs/) for a complete li
8081
- [`fpsDroppedMonitoringPeriod`](#fpsdroppedmonitoringperiod)
8182
- [`fpsDroppedMonitoringThreshold`](#fpsdroppedmonitoringthreshold)
8283
- [`appendErrorMaxRetry`](#appenderrormaxretry)
84+
- [`ignorePlaylistParsingErrors`](#ignoreplaylistparsingerrors)
8385
- [`loader`](#loader)
8486
- [`fLoader`](#floader)
8587
- [`pLoader`](#ploader)
@@ -92,6 +94,7 @@ See [API Reference](https://hlsjs-dev.video-dev.org/api-docs/) for a complete li
9294
- [`bufferController`](#buffercontroller)
9395
- [`capLevelController`](#caplevelcontroller)
9496
- [`fpsController`](#fpscontroller)
97+
- [`errorController`](#errorcontroller)
9598
- [`timelineController`](#timelinecontroller)
9699
- [`enableDateRangeMetadataCues`](#enabledaterangemetadatacues)
97100
- [`enableEmsgMetadataCues`](#enableemsgmetadatacues)
@@ -122,6 +125,7 @@ See [API Reference](https://hlsjs-dev.video-dev.org/api-docs/) for a complete li
122125
- [`abrBandWidthUpFactor`](#abrbandwidthupfactor)
123126
- [`abrMaxWithRealBitrate`](#abrmaxwithrealbitrate)
124127
- [`minAutoBitrate`](#minautobitrate)
128+
- [`preserveManualLevelOnError`](#preservemanuallevelonerror)
125129
- [`emeEnabled`](#emeenabled)
126130
- [`widevineLicenseUrl` (deprecated)](#widevinelicenseurl-deprecated)
127131
- [`licenseXhrSetup`](#licensexhrsetup)
@@ -134,6 +138,9 @@ See [API Reference](https://hlsjs-dev.video-dev.org/api-docs/) for a complete li
134138
- [`enableInterstitialPlayback`](#enableinterstitialplayback)
135139
- [`interstitialAppendInPlace`](#interstitialappendinplace)
136140
- [`interstitialLiveLookAhead`](#interstitiallivelookahead)
141+
- [`assetPlayerId`](#assetplayerid)
142+
- [`primarySessionId`](#primarysessionid)
143+
- [`useMediaCapabilities`](#usemediacapabilities)
137144
- [Video Binding/Unbinding API](#video-bindingunbinding-api)
138145
- [`hls.attachMedia(HTMLMediaElement | MediaAttachingData)`](#hlsattachmediahtmlmediaelement--mediaattachingdata)
139146
- [`hls.detachMedia()`](#hlsdetachmedia)
@@ -798,6 +805,14 @@ When set to a value greater than `1`, the latency-controller will adjust `video.
798805

799806
The default value is `1`, which disables playback rate adjustment. Set `maxLiveSyncPlaybackRate` to a value greater than `1` to enable playback rate adjustment at the live edge.
800807

808+
### `timelineOffset`
809+
810+
(default: `undefined`)
811+
812+
An optional time offset in seconds applied to fragment start times and timeline calculations. This is useful for synchronizing timelines across multiple HLS instances, such as when using Interstitials or when coordinating playback with external systems.
813+
814+
When set, the offset is applied to fragment start positions, seek operations, and timeline calculations. The offset is stored in level details as `appliedTimelineOffset` and can be modified dynamically through the `InterstitialPlayer.timelineOffset` property for interstitial asset players.
815+
801816
### `liveDurationInfinity`
802817

803818
(default: `false`)
@@ -1099,6 +1114,14 @@ The ratio of frames dropped to frames elapsed within `fpsDroppedMonitoringPeriod
10991114
Max number of `sourceBuffer.appendBuffer()` retry upon error.
11001115
Such error could happen in loop with UHD streams, when internal buffer is full. (Quota Exceeding Error will be triggered). In that case we need to wait for the browser to evict some data before being able to append buffer correctly.
11011116

1117+
### `ignorePlaylistParsingErrors`
1118+
1119+
(default: `false`)
1120+
1121+
When set to `false`, playlist parsing errors will trigger `ERROR` events with `ErrorDetails.LEVEL_PARSING_ERROR`, allowing your application to handle them.
1122+
1123+
When set to `true`, playlist parsing errors will be ignored and playback will continue. The errors will still be logged but will not trigger error events.
1124+
11021125
### `loader`
11031126

11041127
(default: standard `XMLHttpRequest`-based URL loader)
@@ -1346,6 +1369,14 @@ Customized fps controller.
13461369
A class in charge of monitoring frame rate, that emits `FPS_DROP` events when frames dropped exceeds configured threshold.
13471370
Enable the default fps controller by setting `capLevelOnFPSDrop` to `true`.
13481371

1372+
### `errorController`
1373+
1374+
(default: internal error controller)
1375+
1376+
Customized error controller.
1377+
1378+
A class in charge of handling errors and error recovery logic. The error controller processes error events and implements recovery strategies such as level switching and fragment retry logic.
1379+
13491380
### `timelineController`
13501381

13511382
(default: internal track timeline controller)
@@ -1602,6 +1633,14 @@ then if config value is set to `true`, ABR will use 2.5 Mb/s for this quality le
16021633
Return the capping/min bandwidth value that could be used by automatic level selection algorithm.
16031634
Useful when browser or tab of the browser is not in the focus and bandwidth drops
16041635

1636+
### `preserveManualLevelOnError`
1637+
1638+
(default: `false`)
1639+
1640+
When set to `false`, if auto-level selection is disabled and a fragment error occurs, HLS.js will reset the manual level selection (`hls.loadLevel` will be set to `-1`), allowing automatic level selection to take over.
1641+
1642+
When set to `true`, the manual level selection will be preserved even when fragment errors occur, preventing automatic fallback to ABR.
1643+
16051644
### `emeEnabled`
16061645

16071646
(default: `false`)
@@ -1781,6 +1820,28 @@ The time (in seconds) ahead of the end of a live playlist to request scheduled I
17811820
17821821
The default value is `10`, meaning that HLS.js will begin requesting interstitial ASSET-LIST and ASSET-URIs whose START-DATE is within 10 seconds of the program-date-time at the end of the primary variant playlist while the forward buffer is within a target duration of the same range.
17831822
1823+
### `assetPlayerId`
1824+
1825+
(default: `undefined`)
1826+
1827+
An optional identifier string that is prefixed to debug logs for this HLS instance. This is particularly useful when multiple HLS instances are running simultaneously (such as when using Interstitials with asset players) to distinguish log messages from different players.
1828+
1829+
When set, the `assetPlayerId` is included in log messages and can be used to identify which HLS instance generated a particular log entry.
1830+
1831+
### `primarySessionId`
1832+
1833+
(default: `undefined`)
1834+
1835+
An optional identifier string used to identify the primary HLS session when working with Interstitials. This value is passed to interstitial asset URLs via the `_HLS_primary_id` query parameter, allowing the server to associate interstitial requests with the primary session.
1836+
1837+
This is primarily used internally by HLS.js when creating interstitial asset players, but can be set manually if you need to coordinate multiple HLS instances.
1838+
1839+
### `useMediaCapabilities`
1840+
1841+
(default value is `true` except in the light build or custom builds with setting the **USE_MEDIA_CAPABILITIES** flag to `false`.)
1842+
1843+
- get/set: Whether the MediaCapabilities API is used for level, track, and switch filtering. When enabled, HLS.js uses `navigator.mediaCapabilities.decodingInfo()` to determine if a level or track is supported before selection. Some devices may incorrectly report MediaCapabilities, leading to levels/tracks being filtered out that the device actually supports. Whether or not tracks are filtered automatically using this feature, you can manually remove unsupported levels using `hls.removeLevel(levelIndex)` after the manifest is parsed.
1844+
17841845
## Video Binding/Unbinding API
17851846
17861847
### `hls.attachMedia(HTMLMediaElement | MediaAttachingData)`

0 commit comments

Comments
 (0)