index.html 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>DPlayer Demo</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
  7. <style>
  8. body {
  9. font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  10. }
  11. .container {
  12. max-width: 40rem;
  13. margin-left: auto;
  14. margin-right: auto;
  15. margin-bottom: 50px;
  16. }
  17. h1 {
  18. font-size: 54px;
  19. color: #333;
  20. margin: 30px 0 10px;
  21. }
  22. h2 {
  23. font-size: 22px;
  24. color: #555;
  25. }
  26. h3 {
  27. font-size: 24px;
  28. color: #555;
  29. }
  30. hr {
  31. display: block;
  32. width: 7rem;
  33. height: 1px;
  34. margin: 2.5rem 0;
  35. background-color: #eee;
  36. border: 0;
  37. }
  38. a {
  39. color: #08c;
  40. text-decoration: none;
  41. }
  42. p {
  43. font-size: 18px;
  44. }
  45. </style>
  46. </head>
  47. <body>
  48. <a href="https://github.com/DIYgod/DPlayer" target="_blank" class="github-corner"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.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}}</style>
  49. <div class="container">
  50. <h1>DPlayer</h1>
  51. <h2>Wow, such a lovely HTML5 danmaku video player</h2>
  52. <p>Made by <a href="https://www.anotherhome.net/" target="_blank">DIYgod</a>. Available on <a href="https://github.com/DIYgod/DPlayer" target="_blank">GitHub</a>. Licensed SATA.</p>
  53. <hr>
  54. <h3>Normal</h3>
  55. <div class="dplayer" id="dplayer1"></div>
  56. <button onclick="switchDPlayer()">Switch Video</button>
  57. <h3>Bilibili video and danmaku support</h3>
  58. <div class="dplayer" id="dplayer2"></div>
  59. <h3>Live Video (HTTP Live Streaming, M3U8 format) support</h3>
  60. <div class="dplayer" id="dplayer3"></div>
  61. <h3>FLV format support</h3>
  62. <div class="dplayer" id="dplayer4"></div>
  63. </div>
  64. <script src="https://rawgit.com/mrdoob/stats.js/master/build/stats.min.js"></script>
  65. <script src="https://unpkg.com/dplayer/plugin/flv.min.js"></script>
  66. <script src="https://unpkg.com/dplayer/plugin/hls.min.js"></script>
  67. <script src="https://unpkg.com/dplayer"></script>
  68. <script>
  69. // Normal
  70. var dp1 = new DPlayer({
  71. element: document.getElementById('dplayer1'),
  72. autoplay: false,
  73. theme: '#FADFA3',
  74. loop: true,
  75. screenshot: true,
  76. hotkey: true,
  77. video: {
  78. url: 'http://devtest.qiniudn.com/若能绽放光芒.mp4',
  79. pic: 'http://devtest.qiniudn.com/若能绽放光芒.png'
  80. },
  81. danmaku: {
  82. id: '9E2E3368B56CDBB4',
  83. api: 'https://api.prprpr.me/dplayer/',
  84. token: 'tokendemo',
  85. maximum: 3000
  86. }
  87. });
  88. function switchDPlayer() {
  89. if (dp1.option.danmaku.id !== '5rGf5Y2X55qu6Z2p') {
  90. dp1.switchVideo({
  91. url: 'http://devtest.qiniudn.com/微小微-江南皮革厂倒闭了.mp4',
  92. pic: 'http://devtest.qiniudn.com/微小微-江南皮革厂倒闭了.jpg'
  93. },
  94. {
  95. id: '5rGf5Y2X55qu6Z2p',
  96. api: 'https://api.prprpr.me/dplayer/',
  97. token: 'tokendemo',
  98. maximum: 3000
  99. });
  100. }
  101. else {
  102. dp1.switchVideo({
  103. url: 'http://devtest.qiniudn.com/若能绽放光芒.mp4',
  104. pic: 'http://devtest.qiniudn.com/若能绽放光芒.png'
  105. },
  106. {
  107. id: '9E2E3368B56CDBB4',
  108. api: 'https://api.prprpr.me/dplayer/',
  109. token: 'tokendemo',
  110. maximum: 3000
  111. });
  112. }
  113. }
  114. // Bilibili video and danmaku support
  115. var dp2 = new DPlayer({
  116. element: document.getElementById('dplayer2'),
  117. autoplay: false,
  118. theme: '#FADFA3',
  119. loop: true,
  120. screenshot: false,
  121. video: {
  122. url: 'https://api.prprpr.me/dplayer/video/bilibili?aid=4045652',
  123. pic: 'http://devtest.qiniudn.com/微小微-江南皮革厂倒闭了.jpg'
  124. },
  125. danmaku: {
  126. id: '5rGf5Y2X55qu6Z2p',
  127. api: 'https://api.prprpr.me/dplayer/',
  128. token: 'tokendemo',
  129. maximum: 3000,
  130. addition: ['https://api.prprpr.me/dplayer/bilibili?aid=4045652']
  131. }
  132. });
  133. // Live Video (HTTP Live Streaming, M3U8 format) support
  134. var dp3 = new DPlayer({
  135. element: document.getElementById('dplayer3'),
  136. autoplay: false,
  137. theme: '#FADFA3',
  138. loop: true,
  139. screenshot: true,
  140. hotkey: true,
  141. video: {
  142. url: 'http://devtest.qiniudn.com/若能绽放光芒5.m3u8',
  143. pic: 'http://devtest.qiniudn.com/若能绽放光芒.png'
  144. },
  145. danmaku: {
  146. id: '9E2E3368B56CDBB42',
  147. api: 'https://api.prprpr.me/dplayer/',
  148. token: 'tokendemo',
  149. maximum: 3000
  150. }
  151. });
  152. // FLV format support
  153. var dp4 = new DPlayer({
  154. element: document.getElementById('dplayer4'),
  155. autoplay: false,
  156. theme: '#FADFA3',
  157. loop: true,
  158. screenshot: true,
  159. hotkey: true,
  160. video: {
  161. url: 'http://devtest.qiniudn.com/【微小微】玖月奇迹-踩踩踩.flv',
  162. pic: 'http://devtest.qiniudn.com/【微小微】玖月奇迹-踩踩踩.jpg'
  163. },
  164. danmaku: {
  165. id: '9E2E3368B56CDBB43',
  166. api: 'https://api.prprpr.me/dplayer/',
  167. token: 'tokendemo',
  168. maximum: 3000
  169. }
  170. });
  171. // stats.js: JavaScript Performance Monitor
  172. var stats = new Stats();
  173. stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom
  174. document.body.appendChild(stats.dom);
  175. function animate() {
  176. stats.begin();
  177. // monitored code goes here
  178. stats.end();
  179. requestAnimationFrame(animate);
  180. }
  181. requestAnimationFrame(animate);
  182. </script>
  183. </body>
  184. </html>