微信小程序实现录制、试听、上传音频功能(带

最近接到这样一个需求,要求实现录制、试听、上传音频功能,选择的是getBackgroundAudioManager,声音录制和播放波形图是用css实现的,效果图及详细设计代码如下:

在这里插入图片描述


在这里插入图片描述


在这里插入图片描述

xml文件

<view> <view> <image src="" mode='widthFix'></image> </view> <view> <view> <view> 录制提示 </view> </view> <view> <view>00:00:<span>{{currentTime}}</span></view> <view> <view wx:if="{{!showWaveView}}"> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> </view> <view wx:if="{{showWaveView}}"> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> <view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> <view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> <view></view> </view> </view> </view> <view></view> </view> </view> <view wx:if="{{showhandle1}}"> <view wx:if="{{!voiceState}}" bindtap="startRecord">开始</view> <view wx:if="{{voiceState}}" bindtap="shutRecord">录好了</view> </view> <view wx:if="{{showhandle2}}"> <view bindtap="listen" bindtap="listenRecord">试听</view> <view wx:if="{{!uploadState}}" bindtap="uploadVoice">上传</view> <view wx:if="{{uploadState}}">上传中</view> </view> <view wx:if="{{showhandle2}}" bindtap="reRecord">重新录制</view> </view> </view>

js文件

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/d7b25bb4296ad6e36db75411ef05c081.html