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

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

使用方法

使用Material design风格音频播放器插件需要引入jQuery和jaudio.min.js。

HTML结构

该Material design风格音频播放器的基本HTML结构如下:

00:00

00:00

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;

}

初始化插件

首先需要做的事情是给音频播放器添加一个播放列表。播放列表是一个对象数组,它的格式如下所示。然后可以将播放列表变量以参数的形式传入jAudio()方法中来初始化该音频播放器。

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);

配置参数

该音频播放器的可用配置参数有:

playlist:播放列表。

defaultAlbum:默认的专辑,默认值undefined。

defaultArtist:默认的歌手,默认值undefined。

autoPlay:自动播放,默认值为false。

debug:默认值为false。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
智慧校园整体解决方案是响应国家教育信息化政策,结合教育改革和技术创新的产物。该方案以物联网、大数据、人工智能和移动互联技术为基础,旨在打造一个安全、高效、互动且环保的教育环境。方案强调从数字化校园向智慧校园的转变,通过自动数据采集、智能分析和按需服务,实现校园业务的智能化管理。 方案的总体设计原则包括应用至上、分层设计和互联互通,确保系统能够满足不同用户角色的需求,并实现数据和资源的整合与共享。框架设计涵盖了校园安全、管理、教学、环境等多个方面,构建了一个全面的校园应用生态系统。这包括智慧安全系统、校园身份识别、智能排课及选课系统、智慧学习系统、精品录播教室方案等,以支持个性化学习和教学评估。 建设内容突出了智慧安全和智慧管理的重要性。智慧安全管理通过分布式录播系统和紧急预案一键启动功能,增强校园安全预警和事件响应能力。智慧管理系统则利用物联网技术,实现人员和设备的智能管理,提高校园运营效率。 智慧教学部分,方案提供了智慧学习系统和精品录播教室方案,支持专业级学习硬件和智能化网络管理,促进个性化学习和教学资源的高效利用。同时,教学质量评估中心和资源应用平台的建设,旨在提升教学评估的科学性和教育资源的共享性。 智慧环境建设则侧重于基于物联网的设备管理,通过智慧教室管理系统实现教室环境的智能控制和能效管理,打造绿色、节能的校园环境。电子班牌和校园信息发布系统的建设,将作为智慧校园的核心和入口,提供教务、一卡通、图书馆等系统的集成信息。 总体而言,智慧校园整体解决方案通过集成先进技术,不仅提升了校园的信息化水平,而且优化了教学和管理流程,为学生、教师和家长提供了更加便捷、个性化的教育体验。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值