最MC论坛

标题: 一个非常靓丽的html音乐播放器代码 [打印本页]

作者: Jianghao7172    时间: 2016-11-9 16:49
标题: 一个非常靓丽的html音乐播放器代码
本帖最后由 Jianghao7172 于 2016-11-9 17:04 编辑


刚才不小心搞错了。。。重发。。

废话不多说,上图
[attach]15505[/attach]
演示地址:
  1. <html>
  2.         <head>
  3.                 <title>TCOTP Music Player</title>
  4.                 <link rel="stylesheet" type="text/css" href="css/style.css">
  5.                 <script src="js/prefixfree.min.js"></script>
  6.                 <script src="js/jquery.js"></script>
  7.                 <script src="js/index.js"></script>
  8.                 <script src="js/gg_bd_ad_720x90.js" type="text/javascript"></script>
  9.                 <script src="js/follow.js" type="text/javascript"></script>
  10.         </head>
  11.         <body>
  12.                 <video id="myVideo" preload="auto" poster="css/bg.bmp" width="380" style="display:none;" autoplay="autoplay">
  13.                         <source src="<?php echo $file_name; ?>" type="audio/mpeg">
  14.                         <p>你的浏览器不支持此播放方式</p>
  15.                 </video>
  16.                 <!--Powered by TCOTP幻影都市-->
  17.                 <div class="control" style="display: block;">
  18.                         <div class="btmControl">
  19.                                 <div class="btnPlay btn" title="播放/暂停"><span class="icon-play"></span></div>
  20.                                 <div class="progress-bar">
  21.                                         <div class="progress">
  22.                                                 <span class="bufferBar"></span>
  23.                                                 <span class="timeBar"></span>
  24.                                         </div>
  25.                                 </div>
  26.                                 <div class="sound sound2 btn" title="切换声音/静音"><span class="icon-sound"></span></div>
  27.                                 <div class="btnFS btn" title="全屏幕"><span class="icon-fullscreen"></span></div>
  28.                         </div>

  29.                 </div>
  30.                 <div style="text-align:center;clear:both;"></div>
  31.         </body>
  32. </html>
复制代码



下面是 /css/style.css 的内容
  1. * {
  2.   box-sizing: border-box;
  3. }

  4. html {
  5.   width: 100%;
  6.   height: 100%;
  7.   overflow: hidden;
  8.   /*background: #1f323e;
  9.   background: radial-gradient(80% 0%, ellipse cover, #426168 0%, rgba(49, 67, 74, 0.1) 100%), radial-gradient(20% 100%, ellipse cover, #080d11 0%, #243a43 100%);*/
  10. }

  11. video {
  12.   border-radius: 6px;
  13. }

  14. /* video container */
  15. .videoContainer {
  16.   width: 380px;
  17.   height: 163px;
  18.   position: relative;
  19.   overflow: hidden;
  20.   background: #000;
  21.   color: #ccc;
  22.   border-radius: 6px;
  23.   border: 1px solid rgba(0, 0, 0, 0.8);
  24.   box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  25.   margin: 50px auto 0;
  26. }

  27. .videoContainer:before {
  28.   content: '';
  29.   position: absolute;
  30.   top: 0;
  31.   right: 0;
  32.   bottom: 0;
  33.   left: 0;
  34.   box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3);
  35.   z-index: 6;
  36.   border-radius: 6px;
  37.   pointer-events: none;
  38. }

  39. /* video caption css */
  40. .caption {
  41.   display: none;
  42.   position: absolute;
  43.   top: 0;
  44.   left: 0;
  45.   width: 380px;;
  46.   padding: 5px 10px;
  47.   color: #ddd;
  48.   font-size: 14px;
  49.   font-weight: 300;
  50.   text-align: center;
  51.   background: rgba(0, 0, 0, 0.4);
  52.   text-transform: uppercase;
  53.   border-radius: 6px 6px 0 0;
  54.   -webkit-backface-visibility: hidden;
  55.   -moz-backface-visibility: hidden;
  56.   -ms-backface-visibility: hidden;
  57. }

  58. /*** VIDEO CONTROLS CSS ***/
  59. /* control holder */
  60. .control {
  61.   color: #ccc;
  62.   position: absolute;
  63.   /*bottom: 10px;*/
  64.   left: 10px;
  65.   width: 360px;
  66.   z-index: 5;
  67.   display: none;
  68. }

  69. /* control bottom part */
  70. .btmControl {
  71.   clear: both;
  72. }

  73. .control .btnPlay {
  74.   float: left;
  75.   width: 34px;
  76.   height: 30px;
  77.   padding: 5px;
  78.   background: rgba(0, 0, 0, 0.5);
  79.   cursor: pointer;
  80.   border-radius: 6px 0 0 6px;
  81.   border: 1px solid rgba(0, 0, 0, 0.7);
  82.   box-shadow: inset 0 0 1px rgba(255, 255, 255, 0.5);
  83. }

  84. .control .icon-play {
  85.   background: url(css/vp_sprite.png) no-repeat -11px 0;
  86.   width: 6px;
  87.   height: 9px;
  88.   display: block;
  89.   margin: 4px 0 0 8px;
  90. }

  91. .control .icon-pause {
  92.   background: url(css/vp_sprite.png) no-repeat -34px -1px;
  93.   width: 8px;
  94.   height: 9px;
  95.   display: block;
  96.   margin: 4px 0 0 8px;
  97. }

  98. .control .selected {
  99.   font-size: 15px;
  100.   color: #ccc;
  101. }

  102. .control .sound {
  103.   width: 30px;
  104.   height: 30px;
  105.   float: left;
  106.   background: rgba(0, 0, 0, 0.5);
  107.   border: 1px solid rgba(0, 0, 0, 0.7);
  108.   border-left: none;
  109.   box-shadow: inset 0 0 1px rgba(255, 255, 255, 0.5);
  110.   cursor: pointer;
  111. }

  112. .control .icon-sound {
  113.   background: url(css/vp_sprite.png) no-repeat -19px 0;
  114.   width: 13px;
  115.   height: 10px;
  116.   display: block;
  117.   margin: 8px 0 0 8px;
  118. }

  119. .control .muted .icon-sound {
  120.   width: 7px !important;
  121. }

  122. .control .btnFS {
  123.   width: 30px;
  124.   height: 30px;
  125.   border-radius: 0 6px 6px 0;
  126.   float: left;
  127.   background: rgba(0, 0, 0, 0.5);
  128.   border: 1px solid rgba(0, 0, 0, 0.7);
  129.   border-left: none;
  130.   box-shadow: inset 0 0 1px rgba(255, 255, 255, 0.5);
  131. }

  132. .control .icon-fullscreen {
  133.   background: url(css/vp_sprite.png) no-repeat 0 0;
  134.   width: 10px;
  135.   height: 10px;
  136.   display: block;
  137.   margin: 8px 0 0 9px;
  138. }

  139. /* PROGRESS BAR CSS */
  140. /* Progress bar */
  141. .progress-bar {
  142.   height: 30px;
  143.   padding: 10px;
  144.   background: rgba(0, 0, 0, 0.6);
  145.   border: 1px solid rgba(0, 0, 0, 0.7);
  146.   border-left: none;
  147.   box-shadow: inset 0 0 1px rgba(255, 255, 255, 0.5);
  148.   float: left;
  149.   width:180px;
  150. }

  151. .progress {
  152.   width: 160px;
  153.   height: 7px;
  154.   position: relative;
  155.   cursor: pointer;
  156.   background: rgba(0, 0, 0, 0.4);
  157.   /* fallback */
  158.   box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 1px 1px black;
  159.   border-radius: 10px;
  160. }

  161. .progress span {
  162.   height: 100%;
  163.   position: absolute;
  164.   top: 0;
  165.   left: 0;
  166.   display: block;
  167.   border-radius: 10px;
  168. }

  169. .timeBar {
  170.   z-index: 10;
  171.   width: 0;
  172.   background: -webkit-linear-gradient(top, #6bcce2 0%, #1da3d0 100%);
  173.   box-shadow: 0 0 7px rgba(107, 204, 226, 0.5);
  174. }

  175. .bufferBar {
  176.   z-index: 5;
  177.   width: 0;
  178.   background: rgba(255, 255, 255, 0.2);
  179. }

  180. /* VOLUME BAR CSS */
  181. /* volume bar */
  182. .volume {
  183.   position: relative;
  184.   cursor: pointer;
  185.   width: 70px;
  186.   height: 10px;
  187.   float: right;
  188.   margin-top: 10px;
  189.   margin-right: 10px;
  190. }

  191. .volumeBar {
  192.   display: block;
  193.   height: 100%;
  194.   position: absolute;
  195.   top: 0;
  196.   left: 0;
  197.   background-color: #eee;
  198.   z-index: 10;
  199. }
复制代码


大量js
[attach]15506[/attach]



作者: zuimc    时间: 2016-11-9 22:13
为啥不用swf
作者: MineBox    时间: 2016-11-13 16:02
666 这个好 我可以把他装到我服务器官网里 这样玩家进官网就有音乐听了
作者: FMLX    时间: 2021-2-9 12:27
支持支持!




欢迎光临 最MC论坛 (http://www.zuimc.com/) Powered by Discuz! X3.2