DashVideo
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
Host Properties
| Property | Type | Default | Details |
|---|---|---|---|
engine | MediaPlayerClass | — | |
| |||
src | string | '' | |
Attributes
Renders a native <video> element and
accepts these media attributes as React props. The standard ones
behave as described in the MDN media attributes reference: autopictureinpictureautoPlaycontrolscontrolslistcrossOrigindisablepictureinpicturedisableremoteplaybackloadingloopmutedplaysInlineposterpreloadsrcstream-type
Events
Handle these media events with React event props (e.g. onPlay, onTimeUpdate). See media events: abortcanplaycanplaythroughdurationchangeemptiedendederrorloadeddataloadedmetadataloadstartpauseplayplayingprogressratechangeresizeseekedseekingstalledsuspendtimeupdatevolumechangewaiting
These media events have no React prop — attach a listener
through a ref with addEventListener: addtrackchangeenterpictureinpictureleavepictureinpictureremovetrack
This element dispatches no events beyond the media events above.
Methods
Supports these methods from the native media API. See HTMLMediaElement for the core methods: addTextTrackcanPlayTypeexitFullscreenexitPictureInPictureloadpauseplayrequestFullscreenrequestPictureInPicture
In React, call these through a ref to
the element.
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 | |
| |