Add cdnbye demo
This commit is contained in:
parent
1b3be7749a
commit
17568bd426
|
|
@ -687,24 +687,34 @@ DPlayer 可以通过 `customType` 参数与任何 MSE 库一起使用
|
|||
|
||||
```html
|
||||
<div id="dplayer"></div>
|
||||
<script src="pearplayer.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/cdnbye@latest"></script>
|
||||
<script src="DPlayer.min.js"></script>
|
||||
```
|
||||
|
||||
```js
|
||||
var type = 'normal';
|
||||
if(Hls.isSupported() && Hls.WEBRTC_SUPPORT) {
|
||||
type = 'customHls';
|
||||
}
|
||||
const dp = new DPlayer({
|
||||
container: document.getElementById('dplayer'),
|
||||
video: {
|
||||
url: 'https://qq.webrtc.win/tv/Pear-Demo-Yosemite_National_Park.mp4',
|
||||
type: 'pearplayer',
|
||||
url: 'demo.m3u8',
|
||||
type: type,
|
||||
customType: {
|
||||
pearplayer: function (video, player) {
|
||||
new PearPlayer(video, {
|
||||
src: video.src,
|
||||
autoplay: player.options.autoplay,
|
||||
'customHls': function (video, player) {
|
||||
const hls = new Hls({
|
||||
debug: false,
|
||||
// Other hlsjsConfig options provided by hls.js
|
||||
p2pConfig: {
|
||||
live: false, // 如果是直播设为true
|
||||
// Other p2pConfig options provided by CDNBye
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
hls.loadSource(video.src);
|
||||
hls.attachMedia(video);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in New Issue