| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>纯净Video.js播放器</title>
- <link href="https://vjs.zencdn.net/7.20.3/video-js.css" rel="stylesheet">
- <style>
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
-
- body {
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
- background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
- display: flex;
- justify-content: center;
- align-items: center;
- min-height: 100vh;
- padding: 20px;
- color: white;
- }
-
- .container {
- max-width: 900px;
- width: 100%;
- background: rgba(0, 0, 0, 0.7);
- border-radius: 15px;
- padding: 30px;
- box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
- }
-
- h1 {
- text-align: center;
- margin-bottom: 20px;
- font-weight: 300;
- letter-spacing: 2px;
- }
-
- .description {
- text-align: center;
- margin-bottom: 30px;
- line-height: 1.6;
- opacity: 0.8;
- }
-
- .player-container {
- position: relative;
- width: 100%;
- margin: 0 auto;
- border-radius: 8px;
- overflow: hidden;
- box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
- }
-
- /* 隐藏所有控制UI */
- .video-js .vjs-control-bar,
- .video-js .vjs-big-play-button,
- .video-js .vjs-loading-spinner,
- .video-js .vjs-modal-dialog,
- .video-js .vjs-text-track-display {
- display: none !important;
- }
-
- /* 自定义视频样式 */
- .video-js {
- width: 100%;
- height: 0;
- padding-top: 56.25%; /* 16:9 宽高比 */
- }
-
- .video-js .vjs-tech {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- }
-
- .controls-info {
- margin-top: 20px;
- text-align: center;
- font-size: 14px;
- opacity: 0.7;
- }
-
- .features {
- display: flex;
- justify-content: space-between;
- margin-top: 30px;
- flex-wrap: wrap;
- }
-
- .feature {
- flex: 1;
- min-width: 200px;
- background: rgba(255, 255, 255, 0.1);
- margin: 10px;
- padding: 15px;
- border-radius: 8px;
- text-align: center;
- }
-
- .feature h3 {
- margin-bottom: 10px;
- font-weight: 400;
- }
-
- @media (max-width: 768px) {
- .container {
- padding: 15px;
- }
-
- .features {
- flex-direction: column;
- }
- }
- </style>
- </head>
- <body>
- <div class="container">
- <h1>纯净 Video.js 播放器</h1>
- <p class="description">完全移除进度条、按钮和控制界面,只保留纯粹的视频内容</p>
-
- <div class="player-container">
- <video
- id="my-video"
- class="video-js"
- controls
- preload="auto"
- poster="https://vjs.zencdn.net/v/oceans.png"
- data-setup="{}"
- >
- <source src="https://vjs.zencdn.net/v/oceans.mp4" type="video/mp4" />
- <p class="vjs-no-js">
- 您的浏览器不支持HTML5视频,请升级浏览器。
- </p>
- </video>
- </div>
-
- <p class="controls-info">提示:虽然移除了控制界面,但您仍然可以使用空格键播放/暂停视频</p>
-
- <div class="features">
- <div class="feature">
- <h3>纯净体验</h3>
- <p>无干扰的观看体验,专注于视频内容本身</p>
- </div>
- <div class="feature">
- <h3>响应式设计</h3>
- <p>自适应各种屏幕尺寸,保持最佳观看效果</p>
- </div>
- <div class="feature">
- <h3>性能优化</h3>
- <p>轻量级实现,加载快速,运行流畅</p>
- </div>
- </div>
- </div>
- <script src="https://vjs.zencdn.net/7.20.3/video.min.js"></script>
- <script>
- // 初始化播放器
- var player = videojs('my-video');
-
- // 播放器准备就绪后
- player.ready(function() {
- // 禁用右键菜单
- this.on('contextmenu', function(e) {
- e.preventDefault();
- });
-
- // 自动播放(可根据需要取消注释)
- // this.play();
- });
-
- // 添加键盘控制
- document.addEventListener('keydown', function(e) {
- if (e.code === 'Space') {
- e.preventDefault();
- if (player.paused()) {
- player.play();
- } else {
- player.pause();
- }
- }
- });
- </script>
- </body>
- </html>
|