dash-video
DASH video element powered by dash.js for adaptive bitrate streaming
DASH video element powered by dash.js for MPEG-DASH adaptive bitrate streaming.
Examples
Basic Usage
import { DashVideo } from '@videojs/react/media/dash-video';
export default function BasicUsage() {
return <DashVideo className="dash-video" src="https://dash.akamaized.net/akamai/streamroot/050714/Spring_4Ktest.mpd" autoPlay muted playsInline loop />;
}
.dash-video {
width: 100%;
aspect-ratio: 16 / 9;
}
<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>
.media-container {
position: relative;
display: block;
width: 100%;
aspect-ratio: 16 / 9;
}
import '@videojs/html/media/container';
import '@videojs/html/media/dash-video';
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:
| Attribute | Type | Default | Details |
|---|---|---|---|
stream-type | MediaStreamType | NonNullable<Target["streamType"]> | — | |
| |||
Properties
| Property | Type | Default | Details |
|---|---|---|---|
contentData | Target["contentData"] | undefined | — | |
| |||
engine | MediaPlayerClass | — | |
| |||
isFullscreen | boolean | — | |
| |||
isPictureInPicture | boolean | — | |
| |||
liveEdgeStart | number | — | |
| |||
source | DashSource | null | null | |
| |||
src | string | '' | |
streamType | MediaStreamType | NonNullable<Target["streamType"]> | — | |
| |||
targetLiveWindow | number | — | |
| |||
webkitCurrentPlaybackTargetIsWireless | boolean | undefined | — | |
| |||
webkitPresentationMode | WebKitPresentationMode | undefined | — | |
| |||
webkitSetPresentationMode | ((mode: WebKitPresentationMode) => void) | undefined | — | |
| |||
Also exposes these properties from the native media API. See HTMLVideoElement for details: autoplaybufferedcontrolscrossOrigincurrentSrccurrentTimedefaultMuteddefaultPlaybackRatedisablePictureInPicturedisableRemotePlaybackdurationendederrorloopmutedpausedplaybackRateplayedplaysInlineposterpreloadreadyStateremoteseekableseekingtextTrackstitlevideoHeightvideoWidthvolume
Engine options
source.engine.dashJs
Pass dash.js’s own settings here. They’re handed to dash.js untouched, so every option in its settings reference works. Replacing the object resets any settings applied before it. Media Sources covers how engine options fit into a structured source.
Each of the three below is a group of dash.js settings rather than a single value, and dash.js documents what’s inside them.
<DashVideo
source={{
src: 'https://example.com/manifest.mpd',
engine: { dashJs: { streaming: { buffer: { fastSwitchEnabled: true } } } },
}}
/>const video = document.querySelector('dash-video');
video.source = {
src: 'https://example.com/manifest.mpd',
engine: { dashJs: { streaming: { buffer: { fastSwitchEnabled: true } } } },
};| Option | Type | Details |
|---|---|---|
debug | object | |
| ||
errors | object | |
| ||
streaming | object | |
| ||
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:
| Event | Description |
|---|---|
sourcechange | Fired when `source` changes, either directly or by resolving a new `src`. Read `source` for the new value. |
CSS custom properties
| Variable | Details |
|---|---|
--media-video-border-radius | |
| |
--media-object-fit | |
| |
--media-object-position | |
| |
--media-caption-track-duration | |
| |
--media-caption-track-delay | |
| |
--media-caption-track-y | |
| |