ReferenceMedia
HlsAudio
Audio-only HLS element that plays the audio rendition of an HLS stream
Audio-only HLS element that plays just the audio rendition of an HLS stream — even when the source is a mixed audio/video manifest. Useful for audio podcast players, background audio, and bandwidth-constrained contexts where downloading video data would be wasted. For full audio/video HLS playback, see the HLS video component.
Import
Load a source
src takes an HLS manifest URL. A mixed audio/video manifest works too: the audio component loads only the audio rendition.
The structured source object takes the same shape as the HLS video component’s, so one object can serve either. source.drm is accepted but unused, because this component composes no EME.
Examples
Basic Usage
API Reference
Props
Accepts the standard React props for a native <audio>, plus these Video.js-specific props:
Refs
ref
Forwards to the rendered <audio>,
an HTMLAudioElement with its complete native property and method API.
mediaRef
Receives the HlsAudioAdapter that
drives the <audio>, the same
object useMedia() returns inside a
player. It forwards the native media methods, properties, and
events, such as play() and currentTime, and exposes the
playback engine through engine. It
is set once the adapter has attached to the element and cleared
when the element unmounts. For DOM-only APIs, use ref.
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.