HTML部分:

<div class="tab-pane fade dialog-record" id="dialogRecord">
<volist name="dialogRecord" id="record">
<div class="dialog">
<span class="time">{$record.time}</span>
<span class="text">{$record.asr}</span>
<div class="dialog-container">
<div class="audio-animation">
<div id="one"></div>
<div id="two"></div>
<div id="three"></div>
<div id="four"></div>
</div>
</div>
<audio class="audio">
<source src="{$record.audition_url}"/>
</audio>
<div class="focus" tabindex =></div>
</div>
</volist>
</div>

css部分:

.dialog-record .dialog span.text{
max-width: %;
height: auto;
background: #0094DE;
padding-left: 3.5%;
padding-right: 3.5%;
padding-top: 8px;
padding-bottom: 8px;
font-size: .3rem;
color: #fff;
line-height: 25px;
border-radius: 5px;
margin-left: 7px;
display: inline-block;
margin-right: %;
}
.dialog-record .dialog span.time{
display: block;
width: %;
text-align: center;
margin-bottom: 5px;
color: #;
}
.dialog-record .dialog .focus{
height: 5px;
outline-style: none;
}
/*播放语音时的动画*/
@keyframes yuying{
%{
height: %;
}
%{
height: %;
}
%{
height: %;
}
%{
height: %;
}
%{
height: %;
}
} .dialog-container{
width: 40px;
height: 40px;
border: 2px solid #0094de;
border-radius: 8px;
display: inline-flex;
justify-content: center;
align-items: center;
}
.dialog-container .audio-animation{
width: 20px;
height: 20px;
}
.audioPlay #one{
animation:yuying .6s infinite .15s;
-webkit-animation:yuying .6s infinite .15s;
}
.audioPlay #two{
animation:yuying .6s infinite .3s;
-webkit-animation:yuying .6s infinite .3s;
}
.audioPlay #three{
animation:yuying .6s infinite .45s;
-webkit-animation:yuying .6s infinite .45s;
}
.audioPlay #four{
animation:yuying .6s infinite .6s;
-webkit-animation:yuying .6s infinite .6s;
} #one,#two,#three,#four{
width:2px;
border-radius: 50px;
background-color: #0094de;
vertical-align: middle;
display: inline-block;
}
#one{
margin-left: 1px;
height: %;
}
#two{
height: %;
}
#three{
height: %;
}
#four{
height: %;
}

JS部分:

        //播放语音
$('#dialogRecord').on('click','.dialog-container',function(){
var currentNode = $(this);
var audioEle = $(this).siblings('.audio');
playAudio(currentNode,audioEle);
});
function playAudio(currentNode,audioEle){
/*jquery对象转换成js对象*/
var player = audioEle[];
if (player.paused){ /*如果已经暂停*/
player.play(); /*播放*/
currentNode.children('.audio-animation').addClass('audioPlay');
currentNode.parent().siblings().children('.dialog-container').find('.audio-animation').removeClass('audioPlay');
}else {
player.pause();/*暂停*/
currentNode.children('.audio-animation').removeClass('audioPlay');
}
// 录音播放结束停止动画
player.addEventListener('ended', function () {
currentNode.children('.audio-animation').removeClass('audioPlay');
}, false);
}

html5的audio实现高仿微信语音播放效果(实际项目)的更多相关文章

  1. html5的audio实现高仿微信语音播放效果

    效果图 前台大体呈现效果图如下: 点击就可以播放mp3格式的录音.点击另外一个录音,当前录音停止! 思路 关于播放动画,这个很简单,我们可以用css3的逐帧动画来实现.关于逐帧动画,我之前的文章也写过 ...

  2. html5的audio实现高仿微信语音播放效果Demo

    HTML部分: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <t ...

  3. 纯css3配合vue实现微信语音播放效果

    前言 每次写点东西都扯两句-0-,这几天一半精力放在移动端,一半维护之前的项目.书也少看了,不过还好依旧保持一颗学习的心.对于css3我是之前有专门整理过的,因此对于原理之前也算了解.今天是项目中遇到 ...

  4. Android 高仿微信语音聊天页面高斯模糊效果

    目前的应用市场上,使用毛玻璃效果的APP随处可见,比如用过微信语音聊天的人可以发现,语音聊天页面就使用了高斯模糊效果. 先看下效果图: 仔细观察上图,我们可以发现,背景图以用户头像为模板,对其进行了高 ...

  5. js仿微信语音播放

    html结构如下: <div class="app-voice-you" voiceSrc="xx.mp3"> <img class=&quo ...

  6. html5聊天案例|趣聊h5|仿微信界面聊天|红包|语音聊天|地图

    之前有开发过一个h5微直播项目,当时里面也用到过聊天模块部分,今天就在之前聊天部分的基础上重新抽离模块,开发了这个h5趣聊项目,功能效果比较类似微信聊天界面.采用html5+css3+Zepto+sw ...

  7. GSD_WeiXin(高仿微信)应用源码

    高仿微信计划:已经实现功能 1.微信首页(cell侧滑编辑.下拉眼睛动画.下拉拍短视频.点击进入聊天详情界面) 2.通讯录(联系人字母排序.搜索界面) 3.发现(朋友圈) 4.我(界面) 待实现功能( ...

  8. uniapp+nvue开发之仿微信语音+视频通话功能 :实现一对一语音视频在线通话

    ​ 本篇文章是利用uni-app和nvue实现微信效果功能的第三篇了,今天我们基于uniapp + nvue实现的uniapp仿微信音视频通话插件实例项目,实现了以下功能: 1: 语音通话 2: 视频 ...

  9. Android高仿微信(一)——如何消除启动时的白屏

    默认情况下,APP启动时会先把屏幕刷成白色,然后才绘制第一个Activity中的View,这两个步骤之间的延迟会造成启动后先看到白屏(时间大概为1秒左右).时间不长,但是我们也看到,一般的APP时不存 ...

随机推荐

  1. OpenStack实践系列⑨云硬盘服务Cinder

    OpenStack实践系列⑨云硬盘服务Cinder八.cinder8.1存储的三大分类 块存储:硬盘,磁盘阵列DAS,SAN存储 文件存储:nfs,GluserFS,Ceph(PB级分布式文件系统), ...

  2. 最新版Kali Linux虚拟机安装Open-vm-tools替代VMware tools

    自从Kali 2.0发布之后,会经常遇到安装vmware tools无法成功,或者提示安装成功了但是仍旧无法进行文件拖拽.复制和剪切的问题. 今天给新电脑装系统,重新下载了最新版,Kali 2017. ...

  3. 是armhf,还是armel?

    本文译至:https://blogs.oracle.com/jtc/entry/is_it_armhf_or_armel ARM处理器有各种品牌和规格,其中一部分的原因涉及到市场问题,成本,大小和功耗 ...

  4. 前端 ----jQuery操作表单

    05-使用jQuery操作input的value值   表单控件是我们的重中之重,因为一旦牵扯到数据交互,离不开form表单的使用,比如用户的注册登录功能等 那么通过上节知识点我们了解到,我们在使用j ...

  5. [JavaScript]为JS处理二进制数据提供可能性的WEB API

    写这篇博客的起源是在div.io上的一篇文章<你所不知道的JavaScript数组>by 小胡子哥下的评论中的讨论. 因为随着XHR2和现代浏览器的普及,在浏览器当中处理二进制不再向过去那 ...

  6. 用KendoGrid控件 快速做CRUD

    先看效果: 主要引用的文件: <link href="/css/kendo/2014.1.318/kendo.common.min.css" rel="styles ...

  7. 数据结构HashMap(Android SparseArray 和ArrayMap)

    HashMap也是我们使用非常多的Collection,它是基于哈希表的 Map 接口的实现,以key-value的形式存在.在HashMap中,key-value总是会当做一个整体来处理,系统会根据 ...

  8. SwipeRefreshLayout,用最少的代码定制最美的上下拉刷新样式

    下拉刷新框架其实有很多,而且质量都比较高.但是在日常开发中,每一款产品都会有一套自己独特的一套刷新样式.相信有很多小伙伴在个性化定制中都或多或少的遇到过麻烦.今天我就给大家推荐一个在定制方面很出彩的一 ...

  9. Oracle 行转列pivot 、列转行unpivot 的Sql语句总结

    这个比较简单,用||或concat函数可以实现 select concat(id,username) str from app_user select id||username str from ap ...

  10. JAVA覆写Request过滤XSS跨站脚本攻击

    注:本文非本人原著. demo的地址:链接:http://pan.baidu.com/s/1miEmHMo 密码:k5ca 如何过滤Xss跨站脚本攻击,我想,Xss跨站脚本攻击令人为之头疼.为什么呢. ...