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. zabbix3.0.4使用percona-monitoring-plugins插件来监控mysql5.6的详细实现过程

    zabbix3.0.4使用percona-monitoring-plugins插件来监控mysql5.6的详细实现过程 因为Zabbix自带的MySQL监控没有提供可以直接使用的Key,所以一般不采用 ...

  2. mysql:批量插入不同的UUID

    INSERT INTO t_base_role_resource_ref (refID, roleID, resID, orgID, belongTo) SELECT uuid() AS refID, ...

  3. CF 545C

    题意: 砍树, 树会向左或者向右倒,数不能倒重叠, 问最多可以砍多少树 思路: 贪心 + Dp吧, 树要尽可能网左倒,这样对后面的树影响较小, 才是最优状态 #include<iostream& ...

  4. Vue - Router 路由

    路由的注册 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...

  5. Laravel资源理由器跟隐式控制的对比及是怎样的吧?- Route::resource vs Route::controller

    stackoverflow找到的问题:http://stackoverflow.com/questions/23505875/laravel-routeresource-vs-routecontrol ...

  6. String类型作为方法的形参

    代码: public class TestString { String str = new String("good"); char [] ch = {'a','b','c'}; ...

  7. scp命令:远程复制粘贴文件

    文章链接:https://www.cnblogs.com/webnote/p/5877920.html scp是secure copy的简写,用于在Linux下进行远程拷贝文件的命令,和它类似的命令有 ...

  8. 用layui前端框架弹出form表单以及提交

    第一步:引用两个文件 第二步:点击删除按钮弹出提示框 /*删除开始*/ $(".del").click(function () { var id = $(this).attr(&q ...

  9. 小甜点,RecyclerView 之 ItemDecoration 讲解及高级特性实践

    本篇文章摘自微信公众号 guolin_blog (郭霖)独家发布 毫无疑问,RecyclerView 是现在 Android 世界中最重要的系统组件之一,它的出现就是为了高效代替 ListView 和 ...

  10. SQLmap注入启发式检测算法

    1.经过setTargetEnv()就进入了checkWaf()的环节 def checkWaf():     """     Reference: http://sec ...