Skip to content
FrameworkStyle

HlsJsVideo

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

import { HlsJsVideo } from '@videojs/react/media/hlsjs-video';

export default function BasicUsage() {
  return <HlsJsVideo className="hlsjs-video" src="https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM.m3u8" autoPlay muted playsInline loop />;
}

API Reference

Props

Accepts the standard React props for a native <video>, plus these Video.js-specific props:

PropTypeDefaultDetails
preloadPreloadType'metadata'
sourceHlsSource | nullnull
srcstring''
streamTypeStreamType'unknown'

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.

<HlsJsVideo
  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...

Ref

Forwards its ref to the rendered <video>. The ref is an HTMLVideoElement and exposes its complete native property and method API.

Events

Handle standard media events with React event props such as onPlay and onTimeUpdate. For native events without a React prop, attach a listener through the ref with addEventListener.