diff --git a/docs/README.md b/docs/README.md index 33c92ea..af2fe18 100644 --- a/docs/README.md +++ b/docs/README.md @@ -580,9 +580,9 @@ const dp = new DPlayer({ }); ``` -### Work with other HLS library +### Work with other MSE library -DPlayer can work with any HLS library via `customType` option. +DPlayer can work with any MSE library via `customType` option.
diff --git a/docs/config.js b/docs/config.js index d62ffd5..e7f8aaf 100644 --- a/docs/config.js +++ b/docs/config.js @@ -250,19 +250,41 @@ function dplayer9 () { } function dplayer10 () { - window.dp10 = new DPlayer({ - container: document.getElementById('dplayer10'), - video: { - url: 'https://qq.webrtc.win/tv/Pear-Demo-Yosemite_National_Park.mp4', - type: 'pearplayer', - customType: { - 'pearplayer': function (video, player) { - new PearPlayer(video, { - src: video.src, - autoplay: player.options.autoplay - }); + loadScript('https://cdn.jsdelivr.net/npm/pearplayer', function () { + window.dp10 = new DPlayer({ + container: document.getElementById('dplayer10'), + video: { + url: 'https://qq.webrtc.win/tv/Pear-Demo-Yosemite_National_Park.mp4', + type: 'pearplayer', + customType: { + 'pearplayer': function (video, player) { + new PearPlayer(video, { + src: video.src, + autoplay: player.options.autoplay + }); + } } } - } + }); }); +} + +function loadScript (src, callback) { + let s, + r, + t; + r = false; + s = document.createElement('script'); + s.type = 'text/javascript'; + s.src = src; + s.onload = s.onreadystatechange = function () { + // console.log( this.readyState ); //uncomment this line to see which ready states are called. + if (!r && (!this.readyState || this.readyState == 'complete')) + { + r = true; + callback(); + } + }; + t = document.getElementsByTagName('script')[0]; + t.parentNode.insertBefore(s, t); } \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 454f6f7..acfc896 100644 --- a/docs/index.html +++ b/docs/index.html @@ -21,7 +21,6 @@ -