刷视频 随机舞蹈
一个刷视频的界面。只要一个page就能展示了。
当然要找到很多在线小姐姐视频才能播放。
源码如下:
<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><!-- iOS 相关meta标签 --><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"><meta name="apple-mobile-web-app-title" content="随机舞蹈"><title>刷视频</title><style>/* 防止iOS点击闪烁 */* {-webkit-tap-highlight-color: transparent;-webkit-touch-callout: none;-webkit-user-select: none;user-select: none;}/* 适配刘海屏和曲面屏 */body {padding-top: env(safe-area-inset-top);padding-bottom: env(safe-area-inset-bottom);padding-left: env(safe-area-inset-left);padding-right: env(safe-area-inset-right);background-color: #f5f5f5; /* 白色背景 */}/* 全局样式 */* {margin: 0;padding: 0;box-sizing: border-box;}body {background-color: #f5f5f5; /* 浅灰色背景 */min-height: 100vh;display: flex;align-items: center;justify-content: center;font-family: 'Microsoft YaHei', sans-serif;flex-direction: column; /* 使内容垂直排列 */}.container {width: 95%;max-width: 900px;margin: 20px auto;padding: 20px;background: #f5f5f5; /* 白色背景 */border-radius: 20px;box-shadow:8px 8px 16px rgba(0, 0, 0, 0.05), /* 外阴影 - 模拟下沉效果 */-8px -8px 16px rgba(255, 255, 255, 0.8); /* 内阴影 - 模拟高光 */padding-bottom: calc(20px + env(safe-area-inset-bottom));position: relative; /* 使容器相对定位 */transition: transform 0.5s ease, height 0.5s ease;}.video-container {position: relative;width: 100%;height: calc(100vh - 200px - env(safe-area-inset-top) - env(safe-area-inset-bottom));min-height: 400px;margin-bottom: 30px;border-radius: 15px;overflow: hidden;box-shadow:inset 5px 5px 10px rgba(0, 0, 0, 0.05), /* 内阴影 - 模拟下沉效果 */inset -5px -5px 10px rgba(255, 255, 255, 0.8); /* 内高光阴影 */transition: all 0.5s ease;}video {position: absolute;top: 50%;left: 50%;width: 100%;height: 100%;object-fit: cover; /* 修改为cover以适配曲面屏,避免黑边 */transform: translate(-50%, -50%); /* 居中对齐 */border-radius: 10px;background: #000;touch-action: manipulation;}.controls {display: flex;justify-content: center;gap: 20px;flex-wrap: wrap;margin-top: 20px;transition: all 0.5s ease;}button {-webkit-appearance: none;appearance: none;min-width: 120px;padding: 14px 25px;font-size: 16px;cursor: pointer;border: none;border-radius: 50px;color: #333;font-weight: bold;transition: all 0.3s ease, background-color 0.3s ease, color 0.3s ease; /* 添加颜色过渡效果 */box-shadow:5px 5px 10px rgba(0, 0, 0, 0.1), /* 外阴影 - 模拟下沉效果 */-5px -5px 10px rgba(255, 255, 255, 1); /* 内阴影 - 模拟高光 */}/* 拟态化按钮状态变化 */button:active {box-shadow:inset 5px 5px 10px rgba(0, 0, 0, 0.1), /* 按下时的内阴影 */inset -5px -5px 10px rgba(255, 255, 255, 1); /* 按下时的内高光 */transform: translateY(2px);}/* 按钮悬停效果 - 增强颜色过渡 */button:hover {box-shadow:3px 3px 7px rgba(0, 0, 0, 0.15), /* 悬停时的外阴影 */-3px -3px 7px rgba(255, 255, 255, 1); /* 悬停时的内高光 */transform: translateY(-1px);}/* 按钮主题渐变色 - 保持原有功能区分并添加渐变效果 */.next-button {background: linear-gradient(135deg, #ffeff0, #ffccd5); /* 浅红到粉红渐变 */}.next-button:hover {background: linear-gradient(135deg, #ffccd5, #ffabbf); /* 悬停时颜色加深 */}.refresh-button {background: linear-gradient(135deg, #e6f7ff, #bae1ff); /* 浅蓝到蓝紫渐变 */}.refresh-button:hover {background: linear-gradient(135deg, #bae1ff, #90caf9); /* 悬停时颜色加深 */}.play-toggle-button {background: linear-gradient(135deg, #f0e6ff, #dbb6fd); /* 浅紫到淡紫渐变 */}.play-toggle-button:hover {background: linear-gradient(135deg, #dbb6fd, #b388ff); /* 悬停时颜色加深 */}.home-button {background: linear-gradient(135deg, #fff3e0, #ffd59c); /* 浅黄到橙黄渐变 */}.home-button:hover {background: linear-gradient(135deg, #ffd59c, #ffb74d); /* 悬停时颜色加深 */}.collapse-button {background: linear-gradient(135deg, #e8f5e9, #b2f5b4); /* 浅绿到嫩绿渐变 */}.collapse-button:hover {background: linear-gradient(135deg, #b2f5b4, #81c784); /* 悬停时颜色加深 */}.like-button {background: linear-gradient(135deg, #fff3e0, #ffd59c); /* 浅橙到橙红渐变 */}.like-button:hover {background: linear-gradient(135deg, #ffd59c, #ffab91); /* 悬停时颜色加深 */}.pip-button {background: linear-gradient(135deg, #e0f7fa, #bae8ed); /* 浅青到青蓝渐变 */}.pip-button:hover {background: linear-gradient(135deg, #bae8ed, #80deea); /* 悬停时颜色加深 */}.expand-button {background: linear-gradient(135deg, #e8f5e9, #b2f5b4); /* 浅绿到嫩绿渐变 */display: none;margin: 20px auto 0; /* 居中显示 */}.expand-button:hover {background: linear-gradient(135deg, #b2f5b4, #81c784); /* 悬停时颜色加深 */}/* 响应式设计 */@media (max-width: 768px) {.container {width: 98%;padding: 15px;}button {min-width: 100px;padding: 12px 20px;font-size: 14px;}.controls {gap: 10px;}}/* 添加加载动画 */@keyframes pulse {0% { opacity: 1; }50% { opacity: 0.5; }100% { opacity: 1; }}.loading {animation: pulse 1.5s infinite;}/* 添加iOS风格的加载动画 */@keyframes ios-loading {0% { transform: rotate(0deg); }100% { transform: rotate(360deg); }}.loading::after {content: '';position: absolute;top: 50%;left: 50%;width: 40px;height: 40px;margin: -20px 0 0 -20px;border: 4px solid #333;border-top-color: transparent;border-radius: 50%;animation: ios-loading 1s linear infinite;}/* 爱心动画效果 */@keyframes floatUp {0% {transform: translateY(0) scale(1);opacity: 1;}100% {transform: translateY(-100px) scale(1.5);opacity: 0;}}.floating-heart {position: absolute;font-size: 20px;animation: floatUp 3s forwards;pointer-events: none;}/* 提示框样式 */.alert {position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);background: #f5f5f5;padding: 20px;border-radius: 10px;box-shadow:5px 5px 10px rgba(0, 0, 0, 0.1),-5px -5px 10px rgba(255, 255, 255, 1);display: none; /* 默认隐藏 */}/* 版权信息样式 */.copyright {margin-top: 20px;font-size: 14px;text-align: center; /* 居中显示 */color: #666;}/* 折叠状态样式 */.collapsed .video-container {height: 0;min-height: 0;margin-bottom: 0;overflow: hidden;opacity: 0;}.collapsed .controls {opacity: 0;height: 0;margin-top: 0;overflow: hidden;}.collapsed .copyright {opacity: 0;height: 0;margin-top: 0;overflow: hidden;}.collapsed .expand-button {display: block;margin: 20px auto 0; /* 居中显示 */}</style></head><body><div class="container" id="mainContainer"><div class="video-container"><video id="danceVideo" controls>您的浏览器不支持视频播放。</video></div><div class="controls"><button class="home-button" onclick="goToHome()">返回首页</button><button class="next-button" onclick="nextVideo()">下一个</button><button class="refresh-button" onclick="refreshVideo()">刷新</button><button class="play-toggle-button" onclick="togglePlay()">暂停/播放</button><button class="collapse-button" onclick="collapsePlayer()">收起</button><button class="like-button" onclick="createHearts()">点赞</button><button class="pip-button" onclick="togglePip()">画中画</button></div><button class="expand-button" onclick="expandPlayer()">展开视频</button><div class="alert" id="alertBox">复制成功,请打开浏览器进行下载保存!</div><!-- <div class="copyright"><a href="https://www.nm1.cn/" id="copyrightLink">© 2025 随机视频 保留所有权利.</a></div> --></div><script>var _hmt = _hmt || [];(function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?10e39dcbd066fa2163734510b7830bd1"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s);})();</script><script>/*** @type {HTMLVideoElement}*/const video = document.getElementById('danceVideo');const container = document.getElementById('mainContainer');let savedCurrentTime = 0;/*** 视频源数组 - 可以替换为您自己的API或视频源* @type {string[]}*/const videoSources = ['http://api.yujn.cn/api/xjj.php?type=video', /**青春美女视频 */'https://v2.xxapi.cn/api/meinv', /**美女跳舞视频 */'https://www.hhlqilongzhu.cn/api/MP4_xiaojiejie.php', /**青春美女视频 */'http://v.nrzj.vip/video.php', /**美女跳舞视频 */'http://api.xingchenfu.xyz/API/nvda.php', /**青春美女视频 */'http://api.xingchenfu.xyz/API/zzxjj.php', /**青春美女视频 */'http://api.xingchenfu.xyz/API/shejie.php', /**青春美女视频 */'http://api.xingchenfu.xyz/API/rwsp.php', /**美女跳舞视频 */'http://api.mmp.cc/api/shortvideo?type=mp4', /**美女跳舞视频 */'https://www.tuwei.space/home.html', /**随机美女视频 */'https://api.yviii.com/video/i.php', /**随机美女视频 */'https://dsp.yeqsy.com/video.php?lx=video', /**随机美女视频 */];/*** 获取随机视频源* @returns {string} 随机视频URL*/function getRandomVideo() {const randomIndex = Math.floor(Math.random() * videoSources.length);return videoSources[randomIndex];}/*** 添加加载状态处理*/function setLoading(isLoading) {const video = document.getElementById('danceVideo');if (isLoading) {video.classList.add('loading');} else {video.classList.remove('loading');}}/*** 增强版的下一个视频函数*/async function nextVideo() {setLoading(true);const newSrc = getRandomVideo();// 确保不会连续播放同一个视频if (newSrc === video.src) {return nextVideo();}video.src = newSrc;try {await video.play();} catch (error) {console.error('视频播放失败:', error);}video.oncanplay = () => {setLoading(false);};}/*** 刷新当前视频*/function refreshVideo() {video.currentTime = 0;video.play();}/*** 切换视频播放/暂停状态*/function togglePlay() {if (video.paused) {video.play();} else {video.pause();}}/*** 创建爱心动画效果*/function createHearts() {for(let i = 0; i < 15; i++) {setTimeout(() => {const heart = document.createElement('div');heart.innerHTML = ['❤️', '⭐', '✨', '💖', '💕'][Math.floor(Math.random() * 5)];heart.className = 'floating-heart';heart.style.left = Math.random() * window.innerWidth + 'px';heart.style.fontSize = (20 + Math.random() * 20) + 'px';document.body.appendChild(heart);setTimeout(() => {heart.remove();}, 3000);}, i * 100);}}/*** 切换画中画模式*/function togglePip() {if (document.pictureInPictureElement) {document.exitPictureInPicture().catch(error => {console.error('退出画中画失败:', error);});} else {video.requestPictureInPicture().catch(error => {console.error('进入画中画失败:', error);});}}/*** 收起视频播放器*/function collapsePlayer() {savedCurrentTime = video.currentTime;video.pause();container.classList.add('collapsed');}/*** 展开视频播放器*/function expandPlayer() {container.classList.remove('collapsed');// 等待动画完成后恢复播放setTimeout(() => {video.currentTime = savedCurrentTime;video.play();}, 500);}/*** 返回首页功能*/function goToHome() {window.location.href = "https://www.nm1.cn/"; // 在当前页面打开首页}// 禁用双指缩放document.addEventListener('gesturestart', function(e) {e.preventDefault();});// 处理iOS的各种手势let touchStartY = 0;document.addEventListener('touchstart', function(e) {touchStartY = e.touches[0].clientY;}, { passive: false });document.addEventListener('touchmove', function(e) {const touchY = e.touches[0].clientY;const delta = touchStartY - touchY;// 如果不是在视频上滑动,则阻止默认行为if (!e.target.matches('video')) {e.preventDefault();}}, { passive: false });// 添加iOS的错误处理video.addEventListener('error', function(e) {console.error('视频加载错误:', e.target.error);nextVideo();});// 处理iOS后台播放document.addEventListener('visibilitychange', function() {if (document.hidden) {video.pause();}});// 初始化window.onload = function() {nextVideo();video.addEventListener('ended', nextVideo); // 播放完自动播放下一个};</script></body></html>
演示访问地址:https://www.nm1.cn/shipin/