计科知识库
  • 源界面
  • 博客圈
  • 专题
  • 博友
  • 登录
  • 注册
源界面 源界面 8天前

刷视频 随机舞蹈

html/css

一个刷视频的界面。只要一个page就能展示了。
当然要找到很多在线小姐姐视频才能播放。
bgSfDaB8
源码如下:

  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, maximum-scale=1.0, user-scalable=no">
  6. <!-- iOS 相关meta标签 -->
  7. <meta name="apple-mobile-web-app-capable" content="yes">
  8. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  9. <meta name="apple-mobile-web-app-title" content="随机舞蹈">
  10. <title>刷视频</title>
  11. <style>
  12. /* 防止iOS点击闪烁 */
  13. * {
  14. -webkit-tap-highlight-color: transparent;
  15. -webkit-touch-callout: none;
  16. -webkit-user-select: none;
  17. user-select: none;
  18. }
  19. /* 适配刘海屏和曲面屏 */
  20. body {
  21. padding-top: env(safe-area-inset-top);
  22. padding-bottom: env(safe-area-inset-bottom);
  23. padding-left: env(safe-area-inset-left);
  24. padding-right: env(safe-area-inset-right);
  25. background-color: #f5f5f5; /* 白色背景 */
  26. }
  27. /* 全局样式 */
  28. * {
  29. margin: 0;
  30. padding: 0;
  31. box-sizing: border-box;
  32. }
  33. body {
  34. background-color: #f5f5f5; /* 浅灰色背景 */
  35. min-height: 100vh;
  36. display: flex;
  37. align-items: center;
  38. justify-content: center;
  39. font-family: 'Microsoft YaHei', sans-serif;
  40. flex-direction: column; /* 使内容垂直排列 */
  41. }
  42. .container {
  43. width: 95%;
  44. max-width: 900px;
  45. margin: 20px auto;
  46. padding: 20px;
  47. background: #f5f5f5; /* 白色背景 */
  48. border-radius: 20px;
  49. box-shadow:
  50. 8px 8px 16px rgba(0, 0, 0, 0.05), /* 外阴影 - 模拟下沉效果 */
  51. -8px -8px 16px rgba(255, 255, 255, 0.8); /* 内阴影 - 模拟高光 */
  52. padding-bottom: calc(20px + env(safe-area-inset-bottom));
  53. position: relative; /* 使容器相对定位 */
  54. transition: transform 0.5s ease, height 0.5s ease;
  55. }
  56. .video-container {
  57. position: relative;
  58. width: 100%;
  59. height: calc(100vh - 200px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  60. min-height: 400px;
  61. margin-bottom: 30px;
  62. border-radius: 15px;
  63. overflow: hidden;
  64. box-shadow:
  65. inset 5px 5px 10px rgba(0, 0, 0, 0.05), /* 内阴影 - 模拟下沉效果 */
  66. inset -5px -5px 10px rgba(255, 255, 255, 0.8); /* 内高光阴影 */
  67. transition: all 0.5s ease;
  68. }
  69. video {
  70. position: absolute;
  71. top: 50%;
  72. left: 50%;
  73. width: 100%;
  74. height: 100%;
  75. object-fit: cover; /* 修改为cover以适配曲面屏,避免黑边 */
  76. transform: translate(-50%, -50%); /* 居中对齐 */
  77. border-radius: 10px;
  78. background: #000;
  79. touch-action: manipulation;
  80. }
  81. .controls {
  82. display: flex;
  83. justify-content: center;
  84. gap: 20px;
  85. flex-wrap: wrap;
  86. margin-top: 20px;
  87. transition: all 0.5s ease;
  88. }
  89. button {
  90. -webkit-appearance: none;
  91. appearance: none;
  92. min-width: 120px;
  93. padding: 14px 25px;
  94. font-size: 16px;
  95. cursor: pointer;
  96. border: none;
  97. border-radius: 50px;
  98. color: #333;
  99. font-weight: bold;
  100. transition: all 0.3s ease, background-color 0.3s ease, color 0.3s ease; /* 添加颜色过渡效果 */
  101. box-shadow:
  102. 5px 5px 10px rgba(0, 0, 0, 0.1), /* 外阴影 - 模拟下沉效果 */
  103. -5px -5px 10px rgba(255, 255, 255, 1); /* 内阴影 - 模拟高光 */
  104. }
  105. /* 拟态化按钮状态变化 */
  106. button:active {
  107. box-shadow:
  108. inset 5px 5px 10px rgba(0, 0, 0, 0.1), /* 按下时的内阴影 */
  109. inset -5px -5px 10px rgba(255, 255, 255, 1); /* 按下时的内高光 */
  110. transform: translateY(2px);
  111. }
  112. /* 按钮悬停效果 - 增强颜色过渡 */
  113. button:hover {
  114. box-shadow:
  115. 3px 3px 7px rgba(0, 0, 0, 0.15), /* 悬停时的外阴影 */
  116. -3px -3px 7px rgba(255, 255, 255, 1); /* 悬停时的内高光 */
  117. transform: translateY(-1px);
  118. }
  119. /* 按钮主题渐变色 - 保持原有功能区分并添加渐变效果 */
  120. .next-button {
  121. background: linear-gradient(135deg, #ffeff0, #ffccd5); /* 浅红到粉红渐变 */
  122. }
  123. .next-button:hover {
  124. background: linear-gradient(135deg, #ffccd5, #ffabbf); /* 悬停时颜色加深 */
  125. }
  126. .refresh-button {
  127. background: linear-gradient(135deg, #e6f7ff, #bae1ff); /* 浅蓝到蓝紫渐变 */
  128. }
  129. .refresh-button:hover {
  130. background: linear-gradient(135deg, #bae1ff, #90caf9); /* 悬停时颜色加深 */
  131. }
  132. .play-toggle-button {
  133. background: linear-gradient(135deg, #f0e6ff, #dbb6fd); /* 浅紫到淡紫渐变 */
  134. }
  135. .play-toggle-button:hover {
  136. background: linear-gradient(135deg, #dbb6fd, #b388ff); /* 悬停时颜色加深 */
  137. }
  138. .home-button {
  139. background: linear-gradient(135deg, #fff3e0, #ffd59c); /* 浅黄到橙黄渐变 */
  140. }
  141. .home-button:hover {
  142. background: linear-gradient(135deg, #ffd59c, #ffb74d); /* 悬停时颜色加深 */
  143. }
  144. .collapse-button {
  145. background: linear-gradient(135deg, #e8f5e9, #b2f5b4); /* 浅绿到嫩绿渐变 */
  146. }
  147. .collapse-button:hover {
  148. background: linear-gradient(135deg, #b2f5b4, #81c784); /* 悬停时颜色加深 */
  149. }
  150. .like-button {
  151. background: linear-gradient(135deg, #fff3e0, #ffd59c); /* 浅橙到橙红渐变 */
  152. }
  153. .like-button:hover {
  154. background: linear-gradient(135deg, #ffd59c, #ffab91); /* 悬停时颜色加深 */
  155. }
  156. .pip-button {
  157. background: linear-gradient(135deg, #e0f7fa, #bae8ed); /* 浅青到青蓝渐变 */
  158. }
  159. .pip-button:hover {
  160. background: linear-gradient(135deg, #bae8ed, #80deea); /* 悬停时颜色加深 */
  161. }
  162. .expand-button {
  163. background: linear-gradient(135deg, #e8f5e9, #b2f5b4); /* 浅绿到嫩绿渐变 */
  164. display: none;
  165. margin: 20px auto 0; /* 居中显示 */
  166. }
  167. .expand-button:hover {
  168. background: linear-gradient(135deg, #b2f5b4, #81c784); /* 悬停时颜色加深 */
  169. }
  170. /* 响应式设计 */
  171. @media (max-width: 768px) {
  172. .container {
  173. width: 98%;
  174. padding: 15px;
  175. }
  176. button {
  177. min-width: 100px;
  178. padding: 12px 20px;
  179. font-size: 14px;
  180. }
  181. .controls {
  182. gap: 10px;
  183. }
  184. }
  185. /* 添加加载动画 */
  186. @keyframes pulse {
  187. 0% { opacity: 1; }
  188. 50% { opacity: 0.5; }
  189. 100% { opacity: 1; }
  190. }
  191. .loading {
  192. animation: pulse 1.5s infinite;
  193. }
  194. /* 添加iOS风格的加载动画 */
  195. @keyframes ios-loading {
  196. 0% { transform: rotate(0deg); }
  197. 100% { transform: rotate(360deg); }
  198. }
  199. .loading::after {
  200. content: '';
  201. position: absolute;
  202. top: 50%;
  203. left: 50%;
  204. width: 40px;
  205. height: 40px;
  206. margin: -20px 0 0 -20px;
  207. border: 4px solid #333;
  208. border-top-color: transparent;
  209. border-radius: 50%;
  210. animation: ios-loading 1s linear infinite;
  211. }
  212. /* 爱心动画效果 */
  213. @keyframes floatUp {
  214. 0% {
  215. transform: translateY(0) scale(1);
  216. opacity: 1;
  217. }
  218. 100% {
  219. transform: translateY(-100px) scale(1.5);
  220. opacity: 0;
  221. }
  222. }
  223. .floating-heart {
  224. position: absolute;
  225. font-size: 20px;
  226. animation: floatUp 3s forwards;
  227. pointer-events: none;
  228. }
  229. /* 提示框样式 */
  230. .alert {
  231. position: absolute;
  232. top: 50%;
  233. left: 50%;
  234. transform: translate(-50%, -50%);
  235. background: #f5f5f5;
  236. padding: 20px;
  237. border-radius: 10px;
  238. box-shadow:
  239. 5px 5px 10px rgba(0, 0, 0, 0.1),
  240. -5px -5px 10px rgba(255, 255, 255, 1);
  241. display: none; /* 默认隐藏 */
  242. }
  243. /* 版权信息样式 */
  244. .copyright {
  245. margin-top: 20px;
  246. font-size: 14px;
  247. text-align: center; /* 居中显示 */
  248. color: #666;
  249. }
  250. /* 折叠状态样式 */
  251. .collapsed .video-container {
  252. height: 0;
  253. min-height: 0;
  254. margin-bottom: 0;
  255. overflow: hidden;
  256. opacity: 0;
  257. }
  258. .collapsed .controls {
  259. opacity: 0;
  260. height: 0;
  261. margin-top: 0;
  262. overflow: hidden;
  263. }
  264. .collapsed .copyright {
  265. opacity: 0;
  266. height: 0;
  267. margin-top: 0;
  268. overflow: hidden;
  269. }
  270. .collapsed .expand-button {
  271. display: block;
  272. margin: 20px auto 0; /* 居中显示 */
  273. }
  274. </style>
  275. </head>
  276. <body>
  277. <div class="container" id="mainContainer">
  278. <div class="video-container">
  279. <video id="danceVideo" controls>
  280. 您的浏览器不支持视频播放。
  281. </video>
  282. </div>
  283. <div class="controls">
  284. <button class="home-button" onclick="goToHome()">返回首页</button>
  285. <button class="next-button" onclick="nextVideo()">下一个</button>
  286. <button class="refresh-button" onclick="refreshVideo()">刷新</button>
  287. <button class="play-toggle-button" onclick="togglePlay()">暂停/播放</button>
  288. <button class="collapse-button" onclick="collapsePlayer()">收起</button>
  289. <button class="like-button" onclick="createHearts()">点赞</button>
  290. <button class="pip-button" onclick="togglePip()">画中画</button>
  291. </div>
  292. <button class="expand-button" onclick="expandPlayer()">展开视频</button>
  293. <div class="alert" id="alertBox">复制成功,请打开浏览器进行下载保存!</div>
  294. <!-- <div class="copyright"><a href="https://www.nm1.cn/" id="copyrightLink">© 2025 随机视频 保留所有权利.</a></div> -->
  295. </div>
  296. <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>
  297. <script>
  298. /**
  299. * @type {HTMLVideoElement}
  300. */
  301. const video = document.getElementById('danceVideo');
  302. const container = document.getElementById('mainContainer');
  303. let savedCurrentTime = 0;
  304. /**
  305. * 视频源数组 - 可以替换为您自己的API或视频源
  306. * @type {string[]}
  307. */
  308. const videoSources = [
  309. 'http://api.yujn.cn/api/xjj.php?type=video', /**青春美女视频 */
  310. 'https://v2.xxapi.cn/api/meinv', /**美女跳舞视频 */
  311. 'https://www.hhlqilongzhu.cn/api/MP4_xiaojiejie.php', /**青春美女视频 */
  312. 'http://v.nrzj.vip/video.php', /**美女跳舞视频 */
  313. 'http://api.xingchenfu.xyz/API/nvda.php', /**青春美女视频 */
  314. 'http://api.xingchenfu.xyz/API/zzxjj.php', /**青春美女视频 */
  315. 'http://api.xingchenfu.xyz/API/shejie.php', /**青春美女视频 */
  316. 'http://api.xingchenfu.xyz/API/rwsp.php', /**美女跳舞视频 */
  317. 'http://api.mmp.cc/api/shortvideo?type=mp4', /**美女跳舞视频 */
  318. 'https://www.tuwei.space/home.html', /**随机美女视频 */
  319. 'https://api.yviii.com/video/i.php', /**随机美女视频 */
  320. 'https://dsp.yeqsy.com/video.php?lx=video', /**随机美女视频 */
  321. ];
  322. /**
  323. * 获取随机视频源
  324. * @returns {string} 随机视频URL
  325. */
  326. function getRandomVideo() {
  327. const randomIndex = Math.floor(Math.random() * videoSources.length);
  328. return videoSources[randomIndex];
  329. }
  330. /**
  331. * 添加加载状态处理
  332. */
  333. function setLoading(isLoading) {
  334. const video = document.getElementById('danceVideo');
  335. if (isLoading) {
  336. video.classList.add('loading');
  337. } else {
  338. video.classList.remove('loading');
  339. }
  340. }
  341. /**
  342. * 增强版的下一个视频函数
  343. */
  344. async function nextVideo() {
  345. setLoading(true);
  346. const newSrc = getRandomVideo();
  347. // 确保不会连续播放同一个视频
  348. if (newSrc === video.src) {
  349. return nextVideo();
  350. }
  351. video.src = newSrc;
  352. try {
  353. await video.play();
  354. } catch (error) {
  355. console.error('视频播放失败:', error);
  356. }
  357. video.oncanplay = () => {
  358. setLoading(false);
  359. };
  360. }
  361. /**
  362. * 刷新当前视频
  363. */
  364. function refreshVideo() {
  365. video.currentTime = 0;
  366. video.play();
  367. }
  368. /**
  369. * 切换视频播放/暂停状态
  370. */
  371. function togglePlay() {
  372. if (video.paused) {
  373. video.play();
  374. } else {
  375. video.pause();
  376. }
  377. }
  378. /**
  379. * 创建爱心动画效果
  380. */
  381. function createHearts() {
  382. for(let i = 0; i < 15; i++) {
  383. setTimeout(() => {
  384. const heart = document.createElement('div');
  385. heart.innerHTML = ['❤️', '⭐', '✨', '💖', '💕'][Math.floor(Math.random() * 5)];
  386. heart.className = 'floating-heart';
  387. heart.style.left = Math.random() * window.innerWidth + 'px';
  388. heart.style.fontSize = (20 + Math.random() * 20) + 'px';
  389. document.body.appendChild(heart);
  390. setTimeout(() => {
  391. heart.remove();
  392. }, 3000);
  393. }, i * 100);
  394. }
  395. }
  396. /**
  397. * 切换画中画模式
  398. */
  399. function togglePip() {
  400. if (document.pictureInPictureElement) {
  401. document.exitPictureInPicture().catch(error => {
  402. console.error('退出画中画失败:', error);
  403. });
  404. } else {
  405. video.requestPictureInPicture().catch(error => {
  406. console.error('进入画中画失败:', error);
  407. });
  408. }
  409. }
  410. /**
  411. * 收起视频播放器
  412. */
  413. function collapsePlayer() {
  414. savedCurrentTime = video.currentTime;
  415. video.pause();
  416. container.classList.add('collapsed');
  417. }
  418. /**
  419. * 展开视频播放器
  420. */
  421. function expandPlayer() {
  422. container.classList.remove('collapsed');
  423. // 等待动画完成后恢复播放
  424. setTimeout(() => {
  425. video.currentTime = savedCurrentTime;
  426. video.play();
  427. }, 500);
  428. }
  429. /**
  430. * 返回首页功能
  431. */
  432. function goToHome() {
  433. window.location.href = "https://www.nm1.cn/"; // 在当前页面打开首页
  434. }
  435. // 禁用双指缩放
  436. document.addEventListener('gesturestart', function(e) {
  437. e.preventDefault();
  438. });
  439. // 处理iOS的各种手势
  440. let touchStartY = 0;
  441. document.addEventListener('touchstart', function(e) {
  442. touchStartY = e.touches[0].clientY;
  443. }, { passive: false });
  444. document.addEventListener('touchmove', function(e) {
  445. const touchY = e.touches[0].clientY;
  446. const delta = touchStartY - touchY;
  447. // 如果不是在视频上滑动,则阻止默认行为
  448. if (!e.target.matches('video')) {
  449. e.preventDefault();
  450. }
  451. }, { passive: false });
  452. // 添加iOS的错误处理
  453. video.addEventListener('error', function(e) {
  454. console.error('视频加载错误:', e.target.error);
  455. nextVideo();
  456. });
  457. // 处理iOS后台播放
  458. document.addEventListener('visibilitychange', function() {
  459. if (document.hidden) {
  460. video.pause();
  461. }
  462. });
  463. // 初始化
  464. window.onload = function() {
  465. nextVideo();
  466. video.addEventListener('ended', nextVideo); // 播放完自动播放下一个
  467. };
  468. </script>
  469. </body>
  470. </html>

演示访问地址:https://www.nm1.cn/shipin/

  • © 2025 源界面 源码为笔,博客为路,写就数字未来
  • 建议
  • 图片压缩
  • | 鄂ICP备14016484号-6

    鄂公网安备 42068402000140