mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-19 11:21:20 -08:00
* 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
36 lines
936 B
Markdown
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);
|
|
});
|
|
``` |