The Hls instance that plays the content.
The <video> element hls is attached to.
Current playback time in seconds.
Total duration of the content in seconds.
Live per the PLAYLIST, not per the media duration.
video.duration cannot answer this on hls.js: the engine sets it to Infinity for live
only when liveDurationInfinity is configured, and that defaults to false — so a live
stream normally reports a finite duration equal to the playlist edge. latestLevelDetails
carries the real answer, taken straight from the absence of #EXT-X-ENDLIST.
Cast and optional-chained because latestLevelDetails is newer than the hls.js this
adapter must keep compiling against; an older build returns undefined and the core falls
back to its duration proxy.
The closest-to-live position hls.js will actually hold — null on VOD.
hls.js is the one engine that pre-computes this, so there is no offset arithmetic
here: its own hls.liveSyncPosition is already liveEdge - targetLatency, clamped
into the seekable window by the latency controller itself.
The explicit liveness gate is NOT redundant, despite what hls.js's own docstring
suggests ("@returns null prior to loading live Playlist"). On VOD the getter returns
a NUMBER, not null: targetLatency falls back to liveSyncDurationCount * targetduration
(3 x segment duration by default) whenever holdBack is absent, which is exactly the
VOD case, and estimateLiveEdge() needs only levelDetails — which VOD has. The
result is a plausible-looking position roughly 3 segments from the end of the asset.
Handing that to the resume clamp would drag every VOD resume backwards, breaking the
one guarantee this feature is supposed to keep: VOD is untouched.
latestLevelDetails.live is the authoritative flag and is public API.
Whether the player is muted.
Settable so the SDK can sync mute state between content and ad players.
Whether the player is currently paused.
Playback rate, 1 being normal speed.
Proxies the element rather than remembering what was written. hls.js drives this property
itself when maxLiveSyncPlaybackRate is configured, nudging the rate to hold live latency,
and the SDK needs to see that so it can stop competing rather than fight it.
Playback rate (1 = normal). Used to correct drift while content continues behind an
ad with continueContentDuringBreak. Report the engine's current rate, not just the last
assigned value, so the SDK can detect changes made by the player's live-latency controller.
If omitted, drift is reported but not corrected.
Program Date Time from the HLS manifest (EXT-X-PROGRAM-DATE-TIME).
The manifest hls.js currently has, read off the engine (hls.url) so it is correct even
when the application called loadSource() itself. The element's own src is a blob:
MediaSource and cannot be reloaded.
Whether the content and ad pipelines can buffer in parallel. True whenever
HLS.js (MSE) is operational. On Web, false prevents continued content
playout during a break because the two pipelines cannot remain buffered
concurrently.
The underlying HTMLVideoElement. Exposed so the SDK can pass it to GAM.
Volume level in the range [0, 1].
Volume in [0, 1]; settable so the SDK can sync it between content and ad players.
Clean up resources.
Load a media source without playing; resolves when it is ready to play. Used to preload ads.
Unsubscribe from player events.
Subscribe to player events.
Pause playback.
Resume playback.
Detached prefetch for the single-decoder preload strategy.
Spins up a throwaway HLS.js instance with startFragPrefetch that parses
the manifest and fetches the first fragment WITHOUT attaching media — so no
second MediaSource / decoder is engaged. The raw responses land in the
browser HTTP cache; the instance is destroyed once the first fragment is
loaded (or on error/timeout). Best-effort: never rejects.
Seek to a specific time in seconds.
Set the requested video quality, or restore the selection in force before the first set. Returns whether an override was applied or an outstanding override was restored.
The lowest rendition is selected through nextLevel, which hls.js documents as taking
effect without interrupting the fragment being decoded. currentLevel would flush the
whole buffer and stall the content timeline. The argmin is computed because hls.js does
not sort its level array by bitrate first.
The PlayerAdapter for HLS.js, from the
@dolby-optiview/ads-sdk-adapter-hlsjspackage (peer dependency:hls.js1.x).Example