Skip to content
FrameworkStyle

hlsjs-video

HLS video element powered by hls.js for adaptive bitrate streaming

HLS video element powered by hls.js for adaptive bitrate streaming. It’s the recommended choice for HLS playback: full feature support across every browser. For alternatives, see NativeHlsVideo (browser-native HLS) or HlsVideo (lightweight HLS).

Examples

Basic Usage

<media-container class="media-container">
    <hlsjs-video
        src="https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM.m3u8"
        autoplay
        muted
        playsinline
        loop
    ></hlsjs-video>
</media-container>

API Reference

Attributes

Forwards these standard media attributes to the internal <video>. See the MDN media element reference: autopictureinpictureautoplaycontrolscontrolslistcrossorigindisablepictureinpicturedisableremoteplaybackloadingloopmutedplaysinlineposterpreloadsrc

These Video.js-specific attributes configure media behavior:

AttributeTypeDefaultDetails
stream-typeStreamType'unknown'

Properties

PropertyTypeDefaultDetails
audioRenditionsAudioRenditionListLike | undefined
audioTracksAudioTrackListLike | undefined
contentDataTarget["contentData"] | undefined
engineHls | null
error(ErrorLike & MediaError) | null
isFullscreenboolean
isPictureInPictureboolean
liveEdgeStartnumber
preloadPreloadType'metadata'
sourceHlsSource | nullnull
srcstring''
streamTypeStreamType'unknown'
targetLiveWindownumber
videoRenditionsVideoRenditionListLike | undefined
videoTracksVideoTrackListLike | undefined
webkitCurrentPlaybackTargetIsWirelessboolean | undefined
webkitPresentationModeWebKitPresentationMode | undefined
webkitSetPresentationMode((mode: WebKitPresentationMode) => void) | undefined

Also exposes these properties from the native media API. See HTMLVideoElement for details: autoplaybufferedcontrolscrossOrigincurrentSrccurrentTimedefaultMuteddefaultPlaybackRatedisablePictureInPicturedisableRemotePlaybackdurationendedloopmutedpausedplaybackRateplayedplaysInlineposterreadyStateremoteseekableseekingtextTrackstitlevideoHeightvideoWidthvolume

Engine options

source.engine.hlsJs

Pass hls.js’s own configuration here. It’s handed to hls.js untouched, so every option in its config reference works, spelled the way hls.js spells it. Media Sources covers how engine options fit into a structured source.

The names and types below come from hls.js’s own type definitions, so they tell you what exists and what shape it takes. hls.js documents what each one does; the descriptions are theirs to write, and most are blank here because its types carry none.

const video = document.querySelector('hlsjs-video');
video.source = {
  src: 'https://example.com/playlist.m3u8',
  engine: { hlsJs: { maxBufferLength: 30, lowLatencyMode: true } },
};
OptionTypeDetails
abrBandWidthFactornumber
abrBandWidthUpFactornumber
abrControllertypeof AbrController
abrEwmaDefaultEstimatenumber
abrEwmaDefaultEstimateMaxnumber
abrEwmaFastLivenumber
abrEwmaFastVoDnumber
abrEwmaSlowLivenumber
abrEwmaSlowVoDnumber
abrMaxWithRealBitrateboolean
appendErrorMaxRetrynumber
assetPlayerIdstring
audioPreferenceAudioSelectionOption
audioStreamControllertypeof AudioStreamController
audioTrackControllertypeof AudioTrackController
autoStartLoadboolean
backBufferLengthnumber
bufferControllertypeof BufferController
capLevelControllertypeof CapLevelController
capLevelOnFPSDropboolean
capLevelToPlayerSizeboolean
captionsTextTrack1Labelstring
captionsTextTrack1LanguageCodestring
captionsTextTrack2Labelstring
captionsTextTrack2LanguageCodestring
captionsTextTrack3Labelstring
captionsTextTrack3LanguageCodestring
captionsTextTrack4Labelstring
captionsTextTrack4LanguageCodestring
certLoadPolicyLoadPolicy
cmcdCMCDControllerConfig
cmcdControllertypeof CMCDController
contentSteeringControllertypeof ContentSteeringController
cueHandlerCuesInterface
debugboolean | ILogger
defaultAudioCodecstring
detectStallWithCurrentTimeMsnumber
drmSystemOptionsDRMSystemOptions | undefined
drmSystemsPartial<Record<KeySystems, DRMSystemC...
emeControllertypeof EMEController
emeEnabledboolean
enableCEA708Captionsboolean
enableDateRangeMetadataCuesboolean
enableEmsgKLVMetadataboolean
enableEmsgMetadataCuesboolean
enableID3MetadataCuesboolean
enableIMSC1boolean
enableInterstitialPlaybackboolean
enableSoftwareAESboolean
enableWebVTTboolean
enableWorkerboolean
errorControllertypeof ErrorController
fetchSetupfunction
fLoaderFragmentLoaderConstructor
forceKeyFrameOnDiscontinuityboolean
fpsControllertypeof FPSController
fpsDroppedMonitoringPeriodnumber
fpsDroppedMonitoringThresholdnumber
fragLoadingMaxRetrynumber
fragLoadingMaxRetryTimeoutnumber
fragLoadingRetryDelaynumber
fragLoadingTimeOutnumber
fragLoadPolicyLoadPolicy
frontBufferFlushThresholdnumber
highBufferWatchdogPeriodnumber
ignoreDevicePixelRatioboolean
ignorePlaylistParsingErrorsboolean
initialLiveManifestSizenumber
interstitialAppendInPlaceboolean
interstitialAssetListLoadPolicyLoadPolicy
interstitialLiveLookAheadnumber
interstitialsControllertypeof InterstitialsController
keyLoadPolicyLoadPolicy
levelLoadingMaxRetrynumber
levelLoadingMaxRetryTimeoutnumber
levelLoadingRetryDelaynumber
levelLoadingTimeOutnumber
licenseResponseCallbackfunction
licenseXhrSetupfunction
liveBackBufferLengthnumber | null
liveDurationInfinityboolean
liveMaxLatencyDurationnumber
liveMaxLatencyDurationCountnumber
liveSyncDurationnumber
liveSyncDurationCountnumber
liveSyncMode"buffered" | "edge"
liveSyncOnStallIncreasenumber
loaderfunction
lowLatencyModeboolean
manifestLoadingMaxRetrynumber
manifestLoadingMaxRetryTimeoutnumber
manifestLoadingRetryDelaynumber
manifestLoadingTimeOutnumber
manifestLoadPolicyLoadPolicy
maxAudioFramesDriftnumber
maxBufferHolenumber
maxBufferLengthnumber
maxBufferSizenumber
maxDevicePixelRationumber
maxFragLookUpTolerancenumber
maxLiveSyncPlaybackRatenumber
maxLoadingDelaynumber
maxMaxBufferLengthnumber
maxStarvationDelaynumber
minAutoBitratenumber
nudgeMaxRetrynumber
nudgeOffsetnumber
nudgeOnVideoHoleboolean
playlistLoadPolicyLoadPolicy
pLoaderPlaylistLoaderConstructor
preferManagedMediaSourceboolean
preserveManualLevelOnErrorboolean
primarySessionIdstring
progressiveboolean
renderTextTracksNativelyboolean
requestMediaKeySystemAccessFuncMediaKeyFunc | null
requireKeySystemAccessOnStartboolean
startFragPrefetchboolean
startLevelnumber
startOnSegmentBoundaryboolean
startPositionnumber
steeringManifestLoadPolicyLoadPolicy
stretchShortVideoTrackboolean
subtitlePreferenceSubtitleSelectionOption
subtitleStreamControllertypeof SubtitleStreamController
subtitleTrackControllertypeof SubtitleTrackController
testBandwidthboolean
timelineControllertypeof TimelineController
timelineOffsetnumber
useMediaCapabilitiesboolean
videoPreferenceVideoSelectionOption
widevineLicenseUrlstring
workerPathstring | null
xhrSetupfunction

source.engine.nativeHls

When playback falls back to the browser’s own HLS, hls.js isn’t involved and its options don’t apply. This configures that path instead.

OptionTypeDetails
drmSystemsPartial<Record<KeySystem, DrmSystemCo...

Methods

Supports these media methods. See HTMLVideoElement for details: addTextTrackcanPlayTypeexitFullscreenexitPictureInPictureloadpauseplayrequestFullscreenrequestPictureInPicture

Events

Re-dispatches these standard media events from the internal media element: abortaddtrackcanplaycanplaythroughchangecontentdatachangedurationchangeemptiedendedenterpictureinpictureerrorleavepictureinpictureloadeddataloadedmetadataloadstartpauseplayplayingprogressratechangeremovetrackresizeseekedseekingstalledsuspendtimeupdatevolumechangewaiting

Also emits these Video.js-specific events:

EventDescription
sourcechangeFired when `source` changes, either directly or by resolving a new `src`. Read `source` for the new value.
streamtypechangeFired when the detected stream type changes. Read `streamType` for the new value.
targetlivewindowchangeFired when the target live window changes. Read `targetLiveWindow` for the new value.

CSS custom properties

VariableDetails
--media-video-border-radius
--media-object-fit
--media-object-position
--media-caption-track-duration
--media-caption-track-delay
--media-caption-track-y