fix mse docs

This commit is contained in:
DIYgod 2018-06-09 03:25:57 +08:00
parent 0faef14fcb
commit 75912f3f99
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
4 changed files with 39 additions and 17 deletions

View File

@ -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.
<div class="dplayer-wrap">
<div id="dplayer10"><button class="docute-button load">Click to load player</div>

View File

@ -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);
}

View File

@ -21,7 +21,6 @@
<script src="https://cdn.jsdelivr.net/npm/hls.js/dist/hls.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dashjs/dist/dash.all.min.js"></script>
<script src="https://cdn.jsdelivr.net/webtorrent/latest/webtorrent.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/pearplayer"></script>
<script src="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.js"></script>
<style>
body {

View File

@ -577,9 +577,9 @@ const dp = new DPlayer({
});
```
### Work with other HLS library
### Work with other MSE library
DPlayer 可以通过 `customType` 参数与任何 HLS 库一起使用
DPlayer 可以通过 `customType` 参数与任何 MSE 库一起使用
<div class="dplayer-wrap">
<div id="dplayer10"><button class="docute-button load">点击加载播放器</div>
@ -608,6 +608,7 @@ const dp = new DPlayer({
}
}
});
```
## 直播