时间:2021-05-18
最近接到这样一个需求,要求实现录制、试听、上传音频功能,选择的是getBackgroundAudioManager,声音录制和播放波形图是用css实现的,效果图及详细设计代码如下:
xml文件
<view class="servicePage"> <view style="width:100%;height:320rpx;position:absolute;z-index:-1;"> <image style="width:100%" src="../../img/bg.png" mode='widthFix'></image> </view> <view class="content" style="height:{{contentHeight}}"> <view class="allService"> <view class="title"> 录制提示 </view> </view> <view class="voiceView"> <view class="voiceTime" style="text-align: center;">00:00:<span>{{currentTime}}</span></view> <view class="voiceLine"> <view class="voiceBox" wx:if="{{!showWaveView}}"> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave2"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave3"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave2"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave2"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave3"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> </view> <view class="voiceBox" wx:if="{{showWaveView}}"> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave2"> <view class="voiceWave"> <view class="auItem au1"></view> <view class="auItem au1"></view> <view class="auItem au2"></view> <view class="auItem au2"></view> <view class="auItem au3"></view> <view class="auItem au3"></view> <view class="auItem au3"></view> </view> <view class="voiceWave1"> <view class="auItem au4"></view> <view class="auItem au4"></view> <view class="auItem au5"></view> <view class="auItem au5"></view> <view class="auItem au6"></view> <view class="auItem au6"></view> <view class="auItem au6"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave3"> <view class="voiceWave"> <view class="auItem au1"></view> <view class="auItem au1"></view> <view class="auItem au1"></view> <view class="auItem au1"></view> <view class="auItem au2"></view> <view class="auItem au2"></view> <view class="auItem au3"></view> <view class="auItem au3"></view> <view class="auItem au3"></view> <view class="auItem au3"></view> <view class="auItem au3"></view> </view> <view class="voiceWave1"> <view class="auItem au4"></view> <view class="auItem au4"></view> <view class="auItem au4"></view> <view class="auItem au4"></view> <view class="auItem au5"></view> <view class="auItem au5"></view> <view class="auItem au6"></view> <view class="auItem au6"></view> <view class="auItem au6"></view> <view class="auItem au6"></view> <view class="auItem au6"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave2"> <view class="voiceWave"> <view class="auItem au1"></view> <view class="auItem au1"></view> <view class="auItem au2"></view> <view class="auItem au2"></view> <view class="auItem au3"></view> <view class="auItem au3"></view> <view class="auItem au3"></view> </view> <view class="voiceWave1"> <view class="auItem au4"></view> <view class="auItem au4"></view> <view class="auItem au5"></view> <view class="auItem au5"></view> <view class="auItem au6"></view> <view class="auItem au6"></view> <view class="auItem au6"></view> </view> </view> <view class="Wave2"> <view class="voiceWave"> <view class="auItem au1"></view> <view class="auItem au1"></view> <view class="auItem au2"></view> <view class="auItem au2"></view> <view class="auItem au3"></view> <view class="auItem au3"></view> <view class="auItem au3"></view> </view> <view class="voiceWave1"> <view class="auItem au4"></view> <view class="auItem au4"></view> <view class="auItem au5"></view> <view class="auItem au5"></view> <view class="auItem au6"></view> <view class="auItem au6"></view> <view class="auItem au6"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave1"> <view class="voiceWave"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view><view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> <view class="voiceWave1"> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> <view class="auItem"></view> </view> </view> <view class="Wave3"> <view class="voiceWave"> <view class="auItem au1"></view> <view class="auItem au1"></view> <view class="auItem au1"></view> <view class="auItem au1"></view> <view class="auItem au2"></view声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
波形图:https://ponentpublicclassServerSocket{privatestaticfinalMapconnections=newHa
本文实例讲述了微信小程序实现图片上传、删除和预览功能的方法。分享给大家供大家参考,具体如下:这里主要介绍一下微信小程序的图片上传图片删除和图片预览布局JS处理d
微信小程序上传头像的实例详解最近在做微信小程序上传头像和上传照片功能就随手写一下代码:上传头像html: 头像 js代码://切换头像cha
微信小程序实现图片轮播及文件上传刚刚接触微信小程序,看着网上的资源写了个小例子,本地图片轮播以及图片上传。图片轮播:index.jsvarapp=getApp(
企业微信小程序的开发通过企业微信小程序模拟器插件来实现,方便用户在微信开发者工具中进行企业微信小程序开发、调试和代码上传。一、开发须知开发者在使用企业微信小程序