在文档中增加使用谷歌 Shaka 播放 DASH 的说明。

This commit is contained in:
bleatingsheep 2019-04-16 13:38:40 +08:00 committed by GitHub
parent f5c53f0826
commit 8d5d4959fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 29 additions and 0 deletions

View File

@ -501,6 +501,35 @@ const dp = new DPlayer({
});
```
### MPEG DASH (Shaka)
需要在 `DPlayer.min.js` 前面加载 [shaka-player.compiled.js](https://github.com/google/shaka-player)。
```html
<link rel="stylesheet" href="DPlayer.min.css">
<div id="dplayer"></div>
<script src="shaka-player.compiled.js"></script>
<script src="DPlayer.min.js"></script>
```
```js
const dp = new DPlayer({
container: document.getElementById('dplayer'),
screenshot: true,
video: {
url: 'demo.mpd',
type: 'shakaDash',
customType: {
'shakaDash': function (video, player) {
var src = video.src;
var playerShaka = new shaka.Player(video); // 将会修改 video.src
playerShaka.load(src);
}
}
}
});
```
### FLV
需要在 `DPlayer.min.js` 前面加载 [flv.js](https://github.com/Bilibili/flv.js)。