2019独角兽企业重金招聘Python工程师标准>>>

一、方法:
使用Material design风格音频播放器插件需要引入jQuery和jaudio.min.js。
<script src="js/jquery.min.js"></script>
<script src="js/jaudio.min.js"></script>

二、HTML结构
<div class='jAudio--player'>
<audio></audio>
<div class='jAudio--ui'>
<div class='jAudio--thumb'></div>
<div class='jAudio--status-bar'>
<div class='jAudio--details'></div>
<div class='jAudio--volume-bar'></div>
<div class='jAudio--progress-bar'>
<div class='jAudio--progress-bar-wrapper'>
<div class='jAudio--progress-bar-played'>
<span class='jAudio--progress-bar-pointer'></span>
</div></div>
</div>
<div class='jAudio--time'>
<span class='jAudio--time-elapsed'>00:00</span>
<span class='jAudio--time-total'>00:00</span>
</div></div>
</div>
<div class='jAudio--playlist'></div>
<div class='jAudio--controls'>
<ul>
<li><button class='btn' data-action='prev' id='btn-prev'><span></span></button></li>
<li><button class='btn' data-action='play' id='btn-play'><span></span></button></li>
<li><button class='btn' data-action='next' id='btn-next'><span></span></button></li>
</ul>
</div>
</div>

三、CSS样式
下面是该音频播放器的主要CSS样式。你可以修改下面的样式来制作你自己需要的音频播放器样式。
.jAudio--player {
display: table;
overflow: hidden;
background: #fff;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
margin: 100px auto;
width: 352px;
}
 
.jAudio--player:after {
content: " ";
display: block;
width: 100%;
clear: both;
}
 
.jAudio--player .jAudio--ui {
position: relative;
width: 100%;
}
 
.jAudio--player .jAudio--status-bar {
width: 100%;
z-index: 1;
position: relative;
padding: 100px 2rem 2rem 2rem;
display: table;
}
 
.jAudio--player .jAudio--status-bar:after {
content: " ";
display: block;
width: 100%;
clear: both;
}
 
.jAudio--player .jAudio--controls {
width: 100%;
display: table;
background: #fafafa;
}
 
.jAudio--player .jAudio--controls:after {
content: " ";
display: block;
width: 100%;
clear: both;
}
 
.jAudio--player .jAudio--controls ul {
display: table;
overflow: hidden;
width: 100%;
}
 
.jAudio--player .jAudio--controls ul:after {
content: " ";
display: block;
width: 100%;
clear: both;
}
 
.jAudio--player .jAudio--controls li {
position: relative;
width: 33.3333%;
height: 5rem;
line-height: 5rem;
}
 
.jAudio--player .jAudio--thumb {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-size: cover;
background-position: center center;
}
 
.jAudio--player .jAudio--time {
display: table;
width: 100%;
}
 
.jAudio--player .jAudio--time:after {
content: " ";
display: block;
width: 100%;
clear: both;
}
 
.jAudio--player .jAudio--time * {
width: 50%;
display: block;
float: left;
color: #fff;
text-shadow: 0 1px 1px #000;
font-size: 0.9rem;
}
 
.jAudio--player .jAudio--time .jAudio--time-elapsed { text-align: left; }
.jAudio--player .jAudio--time .jAudio--time-total { text-align: right; }
.jAudio--player .jAudio--details * {
color: #fff;
text-shadow: 0 1px 1px #000;
font-size: 1.2rem;
}
 
.jAudio--player .jAudio--details *:first-of-type { font-weight: bold; }
.jAudio--player .jAudio--details p { width: 100%; }
.jAudio--player .jAudio--details p span { display: block; }
.jAudio--player .jAudio--progress-bar { margin: 1.33333rem 0; }
.jAudio--player .jAudio--progress-bar .jAudio--progress-bar-wrapper {
width: 100%;
position: relative;
background: rgba(255, 255, 255, 0.3);
cursor: pointer;
border-radius: 10px;
overflow: hidden;
}
 
.jAudio--player .jAudio--progress-bar .jAudio--progress-bar-played {
height: 10px;
background: #FF6666;
position: relative;
border-radius: 10px;
}
 
.jAudio--player .jAudio--progress-bar .jAudio--progress-bar-pointer {
height: 10px;
 width: 10px;
 border-radius: 50%;
 position: absolute;
 right: 0;
 background: #fff;
}
 
.jAudio--player .jAudio--playlist { background: #fff; }
.jAudio--player .jAudio--playlist .jAudio--playlist-item {
 display: block;
 width: 100%;
 padding: 1.33333rem 2rem;
 display: table;
}
 
.jAudio--player .jAudio--playlist .jAudio--playlist-item:after {
content: " ";
display: block;
width: 100%;
clear: both;
}
 
.jAudio--player .jAudio--playlist .jAudio--playlist-item.active {
background: #f55c5c;
border-bottom-color: #f55c5c;
}
 
.jAudio--player .jAudio--playlist .jAudio--playlist-item.active * { color: #fff; }
.jAudio--player .jAudio--playlist .jAudio--playlist-item:not(.active):hover { background: #fafafa; }
.jAudio--player .jAudio--playlist .jAudio--playlist-item:last-of-type {
  border: 0;
  margin-bottom: 0;
}
 
.jAudio--player .jAudio--playlist .jAudio--playlist-thumb {
float: left;
margin-right: 0.66667rem;
display: table;
}
 
.jAudio--player .jAudio--playlist .jAudio--playlist-thumb:after {
content: " ";
display: block;
width: 100%;
clear: both;
}
 
.jAudio--player .jAudio--playlist .jAudio--playlist-thumb img {
height: 2.4rem;
width: 2.4rem;
border-radius: 50%;
float: left;
margin-right: 0.5rem;
}
 
.jAudio--player .jAudio--playlist .jAudio--playlist-meta-text h4 {
font-size: 1rem;
color: #000;
}
 
.jAudio--player .jAudio--playlist .jAudio--playlist-meta-text p { font-size: 0.8rem; }

.btn {
position: relative;
overflow: hidden;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: transparent;
border: 0;
}
 
.btn span {
position: absolute;
display: table;
height: 15px;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
overflow: hidden;
}
 
.btn span:before, .btn span:after {
display: block;
content: " ";
height: 0;
float: left;
border-color: transparent;
border-style: solid;
}
 
.btn:active { background: #f5f5f5; }
 
#btn-prev span:before, #btn-prev span:after, #btn-next span:before, #btn-next span:after, #btn-play span:before, #btn-play span:after {
border-top: 7.5px solid transparent;
border-bottom: 7.5px solid transparent;
}
 
#btn-prev span:before, #btn-prev span:after {
border-right: 15px solid #ddd;
border-left: 0;
}
 
#btn-prev:active span:before, #btn-prev:active span:after { border-right-color: #FF6666 !important; }
 
#btn-next span:before, #btn-next span:after {
border-left: 15px solid #ddd;
border-right: 0;
}
 
#btn-next:active span:before, #btn-next:active span:after { border-left-color: #FF6666 !important; }
 
#btn-play span:before {
border-left: 15px solid #ddd;
border-right: 0;
}
 
#btn-play span:after { display: none; }
#btn-play:active span:before, #btn-play.active span:before { border-left-color: #FF6666 !important; }
#btn-pause span:before, #btn-pause span:after {
width: 5px;
height: 15px;
background: #FF6666;
border: 0;
}
 
#btn-pause span:before { margin-right: 5px; }
#btn-pause span:active:before, #btn-pause span:active:after, #btn-pause span.active:before, #btn-pause span.active:after {
background: #fff;
margin-right: 5px;
}
 
.jAudio--player .jAudio--controls li button span:before, .jAudio--player .jAudio--controls li button span:after {
-webkit-transition: border-color 0.3s ease 0s;
transition: border-color 0.3s ease 0s;
}
 
.jAudio--player .jAudio--thumb {
-webkit-transition: all 0.5s ease 0s;
transition: all 0.5s ease 0s;
}
 
.jAudio--player .jAudio--progress-bar .jAudio--progress-bar-played {
-webkit-transition: all 0.2s ease 0s;
transition: all 0.2s ease 0s;
}
 
.jAudio--player .jAudio--playlist .jAudio--playlist-item {
-webkit-transition: all 0.5s ease 0s;
transition: all 0.5s ease 0s;
}
 
.jAudio--player .jAudio--playlist .jAudio--playlist-item * {
-webkit-transition: all 0.3s ease 0s;
transition: all 0.3s ease 0s;
}

四、初始化插件
var t ={
playlist:[
{
file: "resources/tracks/01.mp3",
thumb: "resources/thumbs/01.jpg",
trackName: "Dusk",
trackArtist: "Tobu & Syndec",
trackAlbum: "Single",
    },
    {
file: "resources/tracks/02.mp3",
thumb: "resources/thumbs/02.jpg",
trackName: "Blank",
trackArtist: "Disfigure",
trackAlbum: "Single",
    },
    {
file: "resources/tracks/03.mp3",
thumb: "resources/thumbs/03.jpg",
trackName: "Fade",
trackArtist: "Alan Walker",
trackAlbum: "Single",
    }
  ]
}
 
$(".jAudio--player").jAudio(t);

KeyMob是中国领先的移动广告 移动广告平台,为广告主和应用开发者提供最优的广告产品服务, 创造最佳收益。

转载于:https://my.oschina.net/u/2505907/blog/596780

Html5添加audio音频播放器插件教程相关推荐

  1. html 语音播放插件,Html5添加audio音频播放器插件教程

    一.方法: 使用Material design风格音频播放器插件需要引入jQuery和jaudio.min.js. 二.HTML结构 00:00 00:00 三.CSS样式 下面是该音频播放器的主要C ...

  2. php项目网页音乐播放器插件,基于HTML5 canvas和Web Audio的音频播放器插件

    wavesurfer.js是一款基于HTML5 canvas和Web Audio的音频播放器插件.通过wavesurfer.js你可以使用它来制作各种HTML5音频播放器,它可以在各种支持 Web A ...

  3. html5 仿微信语音播放器,Material design风格HTML5 audio音频播放器

    jAudio.js是一款基于HTML5 audio的Material design风格音频播放器jQuery插件.该音频播放器可以设置音频播放列表,每首曲子的封面,标题等,还可以控制歌曲的播放和快进, ...

  4. HTML5实现Winamp2.9音频播放器插件

    Winamp2-js是一款使用 html5和javascript来实现Winamp 2.9 音频播放器的插件.该Winamp音频播放器插件有支持拖拽文件,自定义皮肤,支持可视化模式等特点.特点还有: ...

  5. 最好的免费WordPress音频播放器插件

    出于多种原因,您可能希望在网站中嵌入音频. 例如,也许您出售自己的音乐,并希望在要求用户购买歌曲之前先预览一下,或者您可能只想拥有基于文本的帖子的音频版本. 无论哪种情况,WordPress都会提供很 ...

  6. 【Ubuntu 16.04中为Chromium、Chrome、Firefox安装Flash播放器插件教程】

    Ubuntu 16.04中为Chromium.Chrome.Firefox安装Flash播放器插件教程: Ubuntu 16.04中安装Chromium浏览器  http://www.linuxidc ...

  7. Vue - 音频播放器插件(vue-aplayer)

    Vue使用音频播放器插件 vue-aplayer vue-aplayer中文文档:https://aplayer.netlify.app/docs/guide/ GitHub文档:https://gi ...

  8. 用html做成的音频播放器,HTML5制作酷炫音频播放器插件图文教程

    上图便是这个音频播放器的UI界面图,里面还隐藏了一个歌曲的播放列表.整个播放器的UI除了大背景的人像图和歌曲的星星评分使用了图片其他全部由CSS和font-face绘制而成,看上去有难度的地方就只有C ...

  9. html5音频插件js,wavesurfer.js是一款基于HTML5 canvas和Web Audio的音频播放器插件

    通过wavesurfer.js你可以使用它来制作各种HTML5音频播放器,它可以在各种支持 Web Audio 的浏览器中工作,包括 Firefox, Chrome, Safari, Mobile S ...

最新文章

  1. Oracle误删除数据和表的恢复办法包括truncate
  2. c语言鼠标下棋,c语言写的鼠标操作的五子棋游戏,欢迎观赏!
  3. 马化腾:用户体验的10/100/1000法则
  4. 漫谈C#编程语言在游戏领域的应用
  5. idea package自动生成_懒人必备,IntelliJ IDEA中代码一键生成
  6. volatile关键字的使用
  7. mysql 用户管理表_Mysql—用户表详解(mysql.user)
  8. html table列平均,html table 列求和
  9. mongodb golang 批量更新_Mongodb读取数据缓慢问题-Sparkamp;Mongodb
  10. 替代传统C/S和B/S技术的下一代客户/服务器编程技术
  11. 淡雅简洁商业汇演商业计划书PPT模板
  12. JAVA JSP网上订餐系统JSP餐厅点餐系统源码JSP点餐系统JSP网上订餐系统JSP在线订餐
  13. 南方cass快捷键命令修改在哪_【干货】南方cass快捷键命令大全
  14. 乾颐堂现任明教教主(2014年课程)TCPIP协议详解卷一 第二节课笔记
  15. 搜狗推送接口-搜狗推送口子
  16. 巴拿赫空间基本理论及其应用
  17. 那些不熟知的系统 开发语言 虚拟机 运行平台
  18. KMZ转换为KML,KML转换为shp文件格式方法
  19. Android腾讯开放平台应用认领
  20. 从尽力而为到全力以赴

热门文章

  1. typescript 方法后面加感叹号_typescript专题(四) 「泛型」
  2. vector 插入_Java学习五分钟系列:对比Vector、ArrayList、LinkedList
  3. php随机数字不重复使等式成立_Schur补与矩阵打洞,SMW求逆公式,分块矩阵与行列式(不)等式...
  4. 在线node服务器,如何将你的node服务放到线上服务器
  5. android8卡顿,Android 8.0系统曝光,解决了安卓系统卡顿的问题
  6. 刷新存储器的容量单位是什么_SRAM的容量扩展
  7. 数组占位符_Java基础 方法和数组
  8. python3 beautifulsoup_Python3中BeautifulSoup的使用方法
  9. sqlserver使用depart获取当前日期月份及通过拼接得到日期时间
  10. VSCode + PYQT5 + QtDesigner