184 lines
6.6 KiB
HTML
184 lines
6.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>DPlayer Demo</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
|
<link rel="stylesheet" href="https://unpkg.com/github-markdown-css">
|
|
<link rel="stylesheet" href="demo.css">
|
|
<script src="https://unpkg.com/flv.js/dist/flv.min.js"></script>
|
|
<script src="https://unpkg.com/hls.js/dist/hls.min.js"></script>
|
|
<script src="DPlayer.js"></script>
|
|
</head>
|
|
<body class="markdown-body">
|
|
<h2 id="quick-start">Quick Start</h2>
|
|
<div class="example">
|
|
<div id="dplayer1"></div>
|
|
<script>
|
|
var dp1 = new DPlayer({
|
|
element: document.getElementById('dplayer1'),
|
|
video: {
|
|
url: 'http://devtest.qiniudn.com/若能绽放光芒.mp4',
|
|
pic: 'http://devtest.qiniudn.com/若能绽放光芒.png',
|
|
},
|
|
danmaku: {
|
|
id: '9E2E3368B56CDBB4',
|
|
api: 'https://api.prprpr.me/dplayer/'
|
|
}
|
|
});
|
|
</script>
|
|
</div>
|
|
|
|
<h2 id="options">Options</h2>
|
|
<div class="example">
|
|
<button class="btn" onclick="switchDPlayer()">Switch Video</button>
|
|
<button class="btn" onclick="dp2.notice('Notice演示')">Notice</button>
|
|
<button class="btn" onclick="dp2.destroy()">Destroy</button>
|
|
<div id="dplayer2"></div>
|
|
<script>
|
|
var dp2 = new DPlayer({
|
|
element: document.getElementById('dplayer2'),
|
|
autoplay: false,
|
|
theme: '#FADFA3',
|
|
loop: true,
|
|
screenshot: true,
|
|
hotkey: true,
|
|
logo: 'http://devtest.qiniudn.com/DPlayer.png',
|
|
video: {
|
|
url: 'http://devtest.qiniudn.com/若能绽放光芒.mp4',
|
|
pic: 'http://devtest.qiniudn.com/若能绽放光芒.png',
|
|
type: 'auto'
|
|
},
|
|
danmaku: {
|
|
id: '9E2E3368B56CDBB42',
|
|
api: 'https://api.prprpr.me/dplayer/',
|
|
token: 'tokendemo',
|
|
maximum: 3000,
|
|
user: 'DIYgod'
|
|
},
|
|
contextmenu: [
|
|
{
|
|
text: 'custom contextmenu',
|
|
link: 'https://github.com/DIYgod/DPlayer'
|
|
}
|
|
]
|
|
});
|
|
function switchDPlayer() {
|
|
if (dp2.option.danmaku.id !== '5rGf5Y2X55qu6Z2p') {
|
|
dp2.switchVideo({
|
|
url: 'http://devtest.qiniudn.com/微小微-江南皮革厂倒闭了.mp4',
|
|
pic: 'http://devtest.qiniudn.com/微小微-江南皮革厂倒闭了.jpg',
|
|
type: 'auto',
|
|
},
|
|
{
|
|
id: '5rGf5Y2X55qu6Z2p',
|
|
api: 'https://api.prprpr.me/dplayer/',
|
|
maximum: 3000,
|
|
user: 'DIYgod'
|
|
});
|
|
}
|
|
else {
|
|
dp2.switchVideo({
|
|
url: 'http://devtest.qiniudn.com/若能绽放光芒.mp4',
|
|
pic: 'http://devtest.qiniudn.com/若能绽放光芒.png',
|
|
type: 'auto',
|
|
},
|
|
{
|
|
id: '9E2E3368B56CDBB42',
|
|
api: 'https://api.prprpr.me/dplayer/',
|
|
maximum: 3000,
|
|
user: 'DIYgod'
|
|
});
|
|
}
|
|
}
|
|
</script>
|
|
</div>
|
|
|
|
<h2 id="quality-switching">Quality switching</h2>
|
|
<div class="example">
|
|
<button class="btn" onclick="dp3.switchQuality(1)">Switch quality</button>
|
|
<div id="dplayer3"></div>
|
|
<script>
|
|
var dp3 = new DPlayer({
|
|
element: document.getElementById('dplayer3'),
|
|
video: {
|
|
quality: [{
|
|
name: 'HD',
|
|
url: 'http://devtest.qiniudn.com/若能绽放光芒.mp4?1'
|
|
}, {
|
|
name: 'SD',
|
|
url: 'http://devtest.qiniudn.com/若能绽放光芒.mp4?2'
|
|
}],
|
|
defaultQuality: 0,
|
|
pic: 'http://devtest.qiniudn.com/若能绽放光芒.png'
|
|
}
|
|
});
|
|
</script>
|
|
</div>
|
|
|
|
<h2 id="hls-support">HLS support</h2>
|
|
<div class="example">
|
|
<div id="dplayer4"></div>
|
|
<script>
|
|
var dp4 = new DPlayer({
|
|
element: document.getElementById('dplayer4'),
|
|
video: {
|
|
url: 'http://devtest.qiniudn.com/若能绽放光芒5.m3u8',
|
|
type: 'hls'
|
|
}
|
|
});
|
|
</script>
|
|
</div>
|
|
|
|
<h2 id="flv-support">FLV support</h2>
|
|
<div class="example">
|
|
<div id="dplayer5"></div>
|
|
<script>
|
|
var dp5 = new DPlayer({
|
|
element: document.getElementById('dplayer5'),
|
|
video: {
|
|
url: 'http://devtest.qiniudn.com/【微小微】玖月奇迹-踩踩踩.flv',
|
|
type: 'flv'
|
|
}
|
|
});
|
|
</script>
|
|
</div>
|
|
|
|
<h2 id="bilibili-video-and-danmaku">Bilibili video and danmaku</h2>
|
|
<div class="example">
|
|
<div id="dplayer6"></div>
|
|
<script>
|
|
var dp5 = new DPlayer({
|
|
element: document.getElementById('dplayer6'),
|
|
screenshot: false,
|
|
video: {
|
|
url: 'https://api.prprpr.me/dplayer/video/bilibili?aid=4045652',
|
|
},
|
|
danmaku: {
|
|
id: '9E2E3368B56CDBB46',
|
|
api: 'https://api.prprpr.me/dplayer/',
|
|
addition: ['https://api.prprpr.me/dplayer/bilibili?aid=4045652']
|
|
}
|
|
});
|
|
</script>
|
|
</div>
|
|
|
|
<h2 id="html5-check">HTML5 check</h2>
|
|
<ul>
|
|
<li class="video">Video</li>
|
|
<li class="svg">SVG</li>
|
|
<li class="cssanimations">CSS animations</li>
|
|
<li class="csstransforms">CSS transforms</li>
|
|
<li class="documentfragment">Document fragment</li>
|
|
<li class="fullscreen">Fullscreen</li>
|
|
<li class="localstorage">Localstorage</li>
|
|
<li class="canvas">Canvas</li>
|
|
<li class="track">Track</li>
|
|
<li class="websockets">WebSockets</li>
|
|
</ul>
|
|
|
|
<script src="https://unpkg.com/stats.js"></script>
|
|
<script src="demo.js"></script>
|
|
<script src="modernizr.js"></script>
|
|
</body>
|
|
</html> |