Skip to content

ReferenceMedia

dash-video

Unstable

DASH video element powered by dash.js for adaptive bitrate streaming

DASH video element powered by dash.js for MPEG-DASH adaptive bitrate streaming.

Import

pnpm add @videojs/dash-video
import '@videojs/html/media/dash-video';

Or load it from the CDN:

<script type="module" src="https://cdn.jsdelivr.net/npm/@videojs/cdn@10.5.0/media/dash-video.js"></script>

Load a source

src takes a DASH manifest (MPD) URL.

<dash-video src="https://example.com/manifest.mpd"></dash-video>

The structured source object pairs the URL with dash.js settings under engine.dashJs. Setting source derives src, and changing engine.dashJs applies the settings to the running player instead of recreating it.

const video = document.querySelector('dash-video')!;
video.source = {
  src: 'https://example.com/manifest.mpd',
  engine: { dashJs: { streaming: { buffer: { bufferTimeAtTopQuality: 30 } } } },
};

Examples

Basic Usage

<media-container class="media-container">
  <dash-video src="https://dash.akamaized.net/akamai/streamroot/050714/Spring_4Ktest.mpd" autoplay muted playsinline loop></dash-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-typeMediaStreamType—

Properties

PropertyTypeDefaultDetails
contentDataMediaContentData | undefined—
enginedashjs.MediaPlayerClass—
isFullscreenboolean—
isPictureInPictureboolean—
liveEdgeStartnumber—
sourceobjectnull
srcstring''
streamTypeMediaStreamType—
targetLiveWindownumber—
webkitCurrentPlaybackTargetIsWirelessboolean | undefined—
webkitPresentationModeWebKitPresentationMode | undefined—
webkitSetPresentationModeundefined | function—

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

Methods

Supports these media methods. See HTMLVideoElement for details: addTextTrackcanPlayTypeexitFullscreenexitPictureInPictureloadpauseplayremoveTextTrackrequestFullscreenrequestPictureInPicture

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.

CSS custom properties

VariableDescription
--media-video-border-radiusBorder radius of the video element.
--media-object-fitObject fit for the video.
--media-object-positionObject position for the video.
--media-caption-track-durationDuration of the caption track transition.
--media-caption-track-delayDelay before the caption track transition.
--media-caption-track-yVertical offset of the caption track.