diff --git a/demo/demo.css b/demo/demo.css new file mode 100644 index 000000000..f0190ac64 --- /dev/null +++ b/demo/demo.css @@ -0,0 +1,78 @@ +body { + max-width: 700px; + margin: 0 auto; + padding: 45px; +} + +.example { + position: relative; + margin: 15px 0 0; + padding: 39px 19px 14px; + background-color: #fff; + border-radius: 4px 4px 0 0; + border: 1px solid #ddd; +} + +.example:after { + content: "Example"; + position: absolute; + top: 0; + left: 0; + padding: 2px 8px; + font-size: 12px; + font-weight: bold; + background-color: #f5f5f5; + color: #9da0a4; + border-radius: 4px 0 4px 0; +} + +.highlight { + border-radius: 0 0 4px 4px; + border: 1px solid #ddd; + border-top: none; +} + +.btn { + background: #fff; + border: 1px solid #ddd; + border-radius: 4px; + width: 110px; + height: 40px; + font-size: 14px; + margin: 0 0 10px; + cursor: pointer; + outline: none; +} + +/* github-corner */ +.github-corner:hover .octo-arm { + animation: octocat-wave 560ms ease-in-out +} + +@keyframes octocat-wave { + 0%, + 100% { + transform: rotate(0) + } + 20%, + 60% { + transform: rotate(-25deg) + } + 40%, + 80% { + transform: rotate(10deg) + } +} + +@media (max-width:500px) { + .github-corner:hover .octo-arm { + animation: none + } + .github-corner .octo-arm { + animation: octocat-wave 560ms ease-in-out + } +} + +/* modernizr */ +.adownload li.adownload{ color: green; }.canvas li.canvas{ color: green; }.cssanimations li.cssanimations{ color: green; }.csstransforms li.csstransforms{ color: green; }.documentfragment li.documentfragment{ color: green; }.fullscreen li.fullscreen{ color: green; }.localstorage li.localstorage{ color: green; }.svg li.svg{ color: green; }.texttrackapi li.texttrackapi{ color: green; }.track li.track{ color: green; }.todataurljpeg li.todataurljpeg{ color: green; }.todataurlpng li.todataurlpng{ color: green; }.todataurlwebp li.todataurlwebp{ color: green; }.video li.video{ color: green; }.websockets li.websockets{ color: green; }.setclasses li.setclasses{ color: green; } +.no-adownload li.adownload{ color: red; }.no-canvas li.canvas{ color: red; }.no-cssanimations li.cssanimations{ color: red; }.no-csstransforms li.csstransforms{ color: red; }.no-documentfragment li.documentfragment{ color: red; }.no-fullscreen li.fullscreen{ color: red; }.no-localstorage li.localstorage{ color: red; }.no-svg li.svg{ color: red; }.no-texttrackapi li.texttrackapi{ color: red; }.no-track li.track{ color: red; }.no-todataurljpeg li.todataurljpeg{ color: red; }.no-todataurlpng li.todataurlpng{ color: red; }.no-todataurlwebp li.todataurlwebp{ color: red; }.no-video li.video{ color: red; }.no-websockets li.websockets{ color: red; }.no-setclasses li.setclasses{ color: red; } \ No newline at end of file diff --git a/demo/demo.js b/demo/demo.js new file mode 100644 index 000000000..e471d3531 --- /dev/null +++ b/demo/demo.js @@ -0,0 +1,14 @@ +// stats.js: JavaScript Performance Monitor +const stats = new Stats(); +stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom +document.body.appendChild(stats.dom); +function animate () { + stats.begin(); + // monitored code goes here + stats.end(); + + requestAnimationFrame(animate); +} +requestAnimationFrame(animate); + +hljs.initHighlightingOnLoad(); \ No newline at end of file diff --git a/demo/index.html b/demo/index.html index 5cb74bd1b..f25130554 100644 --- a/demo/index.html +++ b/demo/index.html @@ -4,274 +4,308 @@
Made by DIYgod. Available on GitHub. Licensed SATA.
-<link rel="stylesheet" href="dist/DPlayer.min.css">
+<div id="dplayer"></div>
+<script src="dist/DPlayer.min.js"></script>
+<script>
+ var dp = new DPlayer({
+ element: document.getElementById('dplayer'),
video: {
- url: 'http://devtest.qiniudn.com/若能绽放光芒.mp4',
- pic: 'http://devtest.qiniudn.com/若能绽放光芒.png',
- type: 'auto',
+ url: 'demo.mp4',
+ pic: 'demo.png'
},
danmaku: {
- id: '9E2E3368B56CDBB4',
- api: 'https://api.prprpr.me/dplayer/',
- token: 'tokendemo',
- maximum: 3000,
- user: 'DIYgod的女粉'
- },
- contextmenu: [
- {
- text: '关于作者',
- link: 'http://diygod.me'
- },
- {
- text: '播放器意见反馈',
- link: 'https://github.com/DIYgod/DPlayer/issues'
- },
- {
- text: '关于 DPlayer 播放器',
- link: 'https://github.com/DIYgod/DPlayer'
- },
- {
- text: '自定义右键菜单demo',
- link: 'https://github.com/DIYgod/DPlayer'
- },
- ]
+ id: 'demo',
+ api: 'https://api.prprpr.me/dplayer/'
+ }
});
- function switchDPlayer() {
- if (dp1.option.danmaku.id !== '5rGf5Y2X55qu6Z2p') {
- dp1.switchVideo({
- url: 'http://devtest.qiniudn.com/微小微-江南皮革厂倒闭了.mp4',
- pic: 'http://devtest.qiniudn.com/微小微-江南皮革厂倒闭了.jpg',
- type: 'auto',
- },
- {
- id: '5rGf5Y2X55qu6Z2p',
+</script>
{
+ element: document.getElementById('dplayer'),
+ autoplay: false,
+ theme: '#FADFA3',
+ loop: true,
+ screenshot: true,
+ hotkey: true,
+ logo: 'logo.png',
+ video: {
+ url: 'demo.mp4',
+ pic: 'demo.png',
+ type: 'auto',
+ },
+ danmaku: {
+ id: 'demo',
+ api: 'https://api.prprpr.me/dplayer/',
+ token: 'demo',
+ maximum: 3000,
+ user: 'DIYgod'
+ },
+ contextmenu: [
+ {
+ text: 'custom contextmenu',
+ link: 'https://github.com/DIYgod/DPlayer'
+ },
+ ]
+}
+ {
+ video: {
+ quality: [{
+ name: 'HD',
+ url: 'demo1.mp4'
+ }, {
+ name: 'SD',
+ url: 'demo2.mp4'
+ }],
+ defaultQuality: 0
+ }
+}
+ {
+ video: {
+ url: 'demo.m3u8',
+ pic: 'demo.png',
+ type: 'hls',
}
+}
+ {
+ video: {
+ url: 'demo.flv',
+ pic: 'demo.png',
+ type: 'flv',
+ }
+}
+ {
+ screenshot: false,
+ video: {
+ url: 'https://api.prprpr.me/dplayer/video/bilibili?aid=[aid]'
+ },
+ danmaku: {
+ addition: ['https://api.prprpr.me/dplayer/bilibili?aid=[aid]']
+ }
+}
+