Browse Source

docs: 在文档中增加使用谷歌 Shaka 播放 DASH 的说明。 (#474)

在文档中增加使用谷歌 Shaka 播放 DASH 的说明。
DIYgod 6 years ago
parent
commit
de9b88609a
1 changed files with 29 additions and 0 deletions
  1. 29 0
      docs/zh-Hans/README.md

+ 29 - 0
docs/zh-Hans/README.md

@@ -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
 ### FLV
 
 
 需要在 `DPlayer.min.js` 前面加载 [flv.js](https://github.com/Bilibili/flv.js)。
 需要在 `DPlayer.min.js` 前面加载 [flv.js](https://github.com/Bilibili/flv.js)。