1.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>纯净Video.js播放器</title>
  7. <link href="https://vjs.zencdn.net/7.20.3/video-js.css" rel="stylesheet">
  8. <style>
  9. * {
  10. margin: 0;
  11. padding: 0;
  12. box-sizing: border-box;
  13. }
  14. body {
  15. font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  16. background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
  17. display: flex;
  18. justify-content: center;
  19. align-items: center;
  20. min-height: 100vh;
  21. padding: 20px;
  22. color: white;
  23. }
  24. .container {
  25. max-width: 900px;
  26. width: 100%;
  27. background: rgba(0, 0, 0, 0.7);
  28. border-radius: 15px;
  29. padding: 30px;
  30. box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  31. }
  32. h1 {
  33. text-align: center;
  34. margin-bottom: 20px;
  35. font-weight: 300;
  36. letter-spacing: 2px;
  37. }
  38. .description {
  39. text-align: center;
  40. margin-bottom: 30px;
  41. line-height: 1.6;
  42. opacity: 0.8;
  43. }
  44. .player-container {
  45. position: relative;
  46. width: 100%;
  47. margin: 0 auto;
  48. border-radius: 8px;
  49. overflow: hidden;
  50. box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  51. }
  52. /* 隐藏所有控制UI */
  53. .video-js .vjs-control-bar,
  54. .video-js .vjs-big-play-button,
  55. .video-js .vjs-loading-spinner,
  56. .video-js .vjs-modal-dialog,
  57. .video-js .vjs-text-track-display {
  58. display: none !important;
  59. }
  60. /* 自定义视频样式 */
  61. .video-js {
  62. width: 100%;
  63. height: 0;
  64. padding-top: 56.25%; /* 16:9 宽高比 */
  65. }
  66. .video-js .vjs-tech {
  67. position: absolute;
  68. top: 0;
  69. left: 0;
  70. width: 100%;
  71. height: 100%;
  72. }
  73. .controls-info {
  74. margin-top: 20px;
  75. text-align: center;
  76. font-size: 14px;
  77. opacity: 0.7;
  78. }
  79. .features {
  80. display: flex;
  81. justify-content: space-between;
  82. margin-top: 30px;
  83. flex-wrap: wrap;
  84. }
  85. .feature {
  86. flex: 1;
  87. min-width: 200px;
  88. background: rgba(255, 255, 255, 0.1);
  89. margin: 10px;
  90. padding: 15px;
  91. border-radius: 8px;
  92. text-align: center;
  93. }
  94. .feature h3 {
  95. margin-bottom: 10px;
  96. font-weight: 400;
  97. }
  98. @media (max-width: 768px) {
  99. .container {
  100. padding: 15px;
  101. }
  102. .features {
  103. flex-direction: column;
  104. }
  105. }
  106. </style>
  107. </head>
  108. <body>
  109. <div class="container">
  110. <h1>纯净 Video.js 播放器</h1>
  111. <p class="description">完全移除进度条、按钮和控制界面,只保留纯粹的视频内容</p>
  112. <div class="player-container">
  113. <video
  114. id="my-video"
  115. class="video-js"
  116. controls
  117. preload="auto"
  118. poster="https://vjs.zencdn.net/v/oceans.png"
  119. data-setup="{}"
  120. >
  121. <source src="https://vjs.zencdn.net/v/oceans.mp4" type="video/mp4" />
  122. <p class="vjs-no-js">
  123. 您的浏览器不支持HTML5视频,请升级浏览器。
  124. </p>
  125. </video>
  126. </div>
  127. <p class="controls-info">提示:虽然移除了控制界面,但您仍然可以使用空格键播放/暂停视频</p>
  128. <div class="features">
  129. <div class="feature">
  130. <h3>纯净体验</h3>
  131. <p>无干扰的观看体验,专注于视频内容本身</p>
  132. </div>
  133. <div class="feature">
  134. <h3>响应式设计</h3>
  135. <p>自适应各种屏幕尺寸,保持最佳观看效果</p>
  136. </div>
  137. <div class="feature">
  138. <h3>性能优化</h3>
  139. <p>轻量级实现,加载快速,运行流畅</p>
  140. </div>
  141. </div>
  142. </div>
  143. <script src="https://vjs.zencdn.net/7.20.3/video.min.js"></script>
  144. <script>
  145. // 初始化播放器
  146. var player = videojs('my-video');
  147. // 播放器准备就绪后
  148. player.ready(function() {
  149. // 禁用右键菜单
  150. this.on('contextmenu', function(e) {
  151. e.preventDefault();
  152. });
  153. // 自动播放(可根据需要取消注释)
  154. // this.play();
  155. });
  156. // 添加键盘控制
  157. document.addEventListener('keydown', function(e) {
  158. if (e.code === 'Space') {
  159. e.preventDefault();
  160. if (player.paused()) {
  161. player.play();
  162. } else {
  163. player.pause();
  164. }
  165. }
  166. });
  167. </script>
  168. </body>
  169. </html>