html5的audio实现高仿微信语音播放效果(实际项目)
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实现高仿微信语音播放效果(实际项目)的更多相关文章
- html5的audio实现高仿微信语音播放效果
效果图 前台大体呈现效果图如下: 点击就可以播放mp3格式的录音.点击另外一个录音,当前录音停止! 思路 关于播放动画,这个很简单,我们可以用css3的逐帧动画来实现.关于逐帧动画,我之前的文章也写过 ...
- html5的audio实现高仿微信语音播放效果Demo
HTML部分: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <t ...
- 纯css3配合vue实现微信语音播放效果
前言 每次写点东西都扯两句-0-,这几天一半精力放在移动端,一半维护之前的项目.书也少看了,不过还好依旧保持一颗学习的心.对于css3我是之前有专门整理过的,因此对于原理之前也算了解.今天是项目中遇到 ...
- Android 高仿微信语音聊天页面高斯模糊效果
目前的应用市场上,使用毛玻璃效果的APP随处可见,比如用过微信语音聊天的人可以发现,语音聊天页面就使用了高斯模糊效果. 先看下效果图: 仔细观察上图,我们可以发现,背景图以用户头像为模板,对其进行了高 ...
- js仿微信语音播放
html结构如下: <div class="app-voice-you" voiceSrc="xx.mp3"> <img class=&quo ...
- html5聊天案例|趣聊h5|仿微信界面聊天|红包|语音聊天|地图
之前有开发过一个h5微直播项目,当时里面也用到过聊天模块部分,今天就在之前聊天部分的基础上重新抽离模块,开发了这个h5趣聊项目,功能效果比较类似微信聊天界面.采用html5+css3+Zepto+sw ...
- GSD_WeiXin(高仿微信)应用源码
高仿微信计划:已经实现功能 1.微信首页(cell侧滑编辑.下拉眼睛动画.下拉拍短视频.点击进入聊天详情界面) 2.通讯录(联系人字母排序.搜索界面) 3.发现(朋友圈) 4.我(界面) 待实现功能( ...
- uniapp+nvue开发之仿微信语音+视频通话功能 :实现一对一语音视频在线通话
本篇文章是利用uni-app和nvue实现微信效果功能的第三篇了,今天我们基于uniapp + nvue实现的uniapp仿微信音视频通话插件实例项目,实现了以下功能: 1: 语音通话 2: 视频 ...
- Android高仿微信(一)——如何消除启动时的白屏
默认情况下,APP启动时会先把屏幕刷成白色,然后才绘制第一个Activity中的View,这两个步骤之间的延迟会造成启动后先看到白屏(时间大概为1秒左右).时间不长,但是我们也看到,一般的APP时不存 ...
随机推荐
- thymeleaf:访问list,map等
1.map 在后端放入一个map Map<String, String> mapDict = serviceBaseDict.selectMap(ConstantDictType.SYSI ...
- appium+java(七)图片的放到及缩小操作
多点触控(MultiTouch) MultiTouch对象是触摸操作的集合. 多点触控手势只有两个方法,add和perform. add 用于将不同的触摸操作添加到当前的多点触控中. 当 perfor ...
- jqgrid获取数据条数
function getResult() {//获取结果结合的函数,可以通过此函数获取查询后匹配的所有数据行. var o = jQuery("#jqgrid"); ...
- wx :swipertab切换
<view> <view class="navbar"> <block wx:for="{{body}}" wx:key=&quo ...
- 最近Android真的凉凉了?
都说Android最近行情不好,很多人都遇到瓶颈或放弃或转行.其实这种情况15年16年也是如此,相对比之下,个人认为今年比去年好多了,Android接下来将会走向复苏的春天. 自从Google开始推出 ...
- Confluence 6 后台中的默认空间模板设置
Confluence 6 后台中的默认空间模板设置界面的布局. https://www.cwiki.us/display/CONFLUENCEWIKI/Customizing+Default+Spac ...
- Confluence 6 编辑和删除用户宏
编辑一个用户宏 希望对一个用户宏进行编辑: 进入 > 基本配置(General Configuration) > 用户宏(User Macros) 在相关的宏的边上,单击 编辑(Edit ...
- Confluence 6 连接到外部用户目录服务器的问题分析
在有关外部目录服务器配置页面中有一个测试配置(Test Settings)按钮.这个功能将会帮助你分析你的用户管理在 Active Directory 和其他 LDAP 服务器中出现的问题. 希望对你 ...
- Python学习【第2篇】:Python数据结构
Python数据结构 1.数字类型 2.字符串 3.列表 4.元组 5.字典 6.集合
- 【sqli-labs】Less11~Less16
学习sqli-labs的笔记,前面的笔记内容比较详细.后面的只记录关键点了. Less11: POST注入, 有回显,有错误提示 从11题起是POST注入,发现有两个输入框.用firefox的F12查 ...