Files
ArtPlayer/packages/artplayer-vitepress/docs/library/dash.md
T
Harvey Zack fa7954de0d Artplayer vitepress (#446)
* init

* init

* update

* update

* update

* update

* update

* update

* add i18n option

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update
2023-01-11 20:45:01 +08:00

36 lines
936 B
Markdown

# dash.js
👉 [https://github.com/Dash-Industry-Forum/dash.js](https://github.com/Dash-Industry-Forum/dash.js)
<div className="run-code" data-libs="https://cdnjs.cloudflare.com/ajax/libs/dashjs/4.5.2/dash.all.min.js">
▶ Run Code
</div>
```js{18-21,25}
function playMpd(video, url, art) {
if (dashjs.supportsMediaSource()) {
const dash = dashjs.MediaPlayer().create();
dash.initialize(video, url, art.option.autoplay);
// optional
art.dash = dash;
art.once('url', () => dash.destroy());
art.once('destroy', () => dash.destroy());
} else {
art.notice.show = 'Unsupported playback format: mpd';
}
}
var art = new Artplayer({
container: '.artplayer-app',
url: 'https://dash.akamaized.net/envivio/EnvivioDash3/manifest.mpd',
type: 'mpd',
customType: {
mpd: playMpd
},
});
art.on('ready', () => {
console.info(art.dash);
});
```