欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

微信小程序?qū)崿F(xiàn)錄音功能

本文實(shí)例為大家分享了微信小程序錄音功能的具體代碼,供大家參考,具體內(nèi)容如下

創(chuàng)新互聯(lián)是專業(yè)的武安網(wǎng)站建設(shè)公司,武安接單;提供網(wǎng)站設(shè)計(jì)制作、成都網(wǎng)站制作,網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行武安網(wǎng)站開(kāi)發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛(ài)的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來(lái)合作!

release.wxml

<!--pages/index/release/release.wxml-->
<scroll-view>
 <view wx:if="{{voices}}" class="common-list" >
 <block wx:for="{{voices}}">
  <view class="board">
  <view class="cell">
   <view class="cell-bd" data-key="{{item.filePath}}" bindtap="gotoPlay">
   <view class="date">存儲(chǔ)路徑:{{item.filePath}}</view>
   <view class="date">存儲(chǔ)時(shí)間:{{item.createTime}}</view>
   <view class="date">音頻大小:{{item.size}}KB</view>
   </view>
 
  </view>
  </view>
 </block>
 </view>
</scroll-view>
 
<view wx:if="{{isSpeaking}}" class="microphone">
 <image class="sound-style" src="/images/speak.png"></image>
 <image wx:if="{{j==2}}" class="sound-style" src="/images/speak.png"></image>
 <image wx:if="{{j==3}}" class="sound-style" src="/images/speak.png"></image>
 <image wx:if="{{j==4}}" class="sound-style" src="/images/speak.png"></image>
 <image wx:if="{{j==5}}" class="sound-style" src="/images/speak_end.png"></image>
</view>
<view class="record-style">
 <button class="btn-style" bindtouchstart="touchdown" bindtouchend="touchup">按住 錄音</button>
</view>

release.wxss

/* pages/index/release/release.wxss */
.microphone{ 
 position:fixed;
 left: 250rpx;
 bottom: 0;
 height: 240rpx; 
 width: 240rpx; 
 border-radius: 20rpx; 
 margin: 50% auto; 
 background: #26A5FF; 
} 
.item-style{ 
 margin-top: 30rpx; 
 margin-bottom: 30rpx; 
} 
.text-style{ 
 text-align: center; 
 
} 
.record-style{ 
 position: fixed; 
 bottom: 0; 
 left: 0; 
 height: 120rpx; 
 width: 100%; 
} 
.btn-style{ 
 margin-left: 30rpx; 
 margin-right: 30rpx; 
} 
 
.sound-style{ 
 position: absolute; 
 width: 74rpx; 
 height:150rpx; 
 margin-top: 45rpx; 
 margin-left: 83rpx; 
} 
 
 
.board { 
 overflow: hidden; 
 border-bottom: 2rpx solid #26A5FF; 
} 
/*列布局*/ 
.cell{ 
 display: flex; 
 margin: 20rpx; 
} 
.cell-hd{ 
 margin-left: 10rpx; 
 color: #885A38; 
} 
.cell .cell-bd{ 
 flex:1; 
 position: relative; 
  
} 
/**只顯示一行*/ 
.date{ 
 font-size: 30rpx; 
 text-overflow: ellipsis; 
 white-space:nowrap; 
 overflow:hidden; 
} 

release.js

// pages/index/release/release.js
var app = getApp()
Page({
 data: {
 j: 1,//幀動(dòng)畫(huà)初始圖片 
 isSpeaking: false,//是否正在說(shuō)話 
 voices: [],//音頻數(shù)組 
 },
 onLoad: function () {
 },
 //手指按下 
 touchdown: function () {
 console.log("手指按下了...")
 console.log("new date : " + new Date)
 var _this = this;
 speaking.call(this);
 this.setData({
  isSpeaking: true
 })
 //開(kāi)始錄音 
 wx.startRecord({
  success: function (res) {
  //臨時(shí)路徑,下次進(jìn)入小程序時(shí)無(wú)法正常使用 
  var tempFilePath = res.tempFilePath
  console.log("tempFilePath: " + tempFilePath)
  //持久保存 
  wx.saveFile({
   tempFilePath: tempFilePath,
   success: function (res) {
   //持久路徑 
   //本地文件存儲(chǔ)的大小限制為 100M 
   var savedFilePath = res.savedFilePath
   console.log("savedFilePath: " + savedFilePath)
   }
  })
  wx.showToast({
   title: '恭喜!錄音成功',
   icon: 'success',
   duration: 1000
  })
  //獲取錄音音頻列表 
  wx.getSavedFileList({
   success: function (res) {
   var voices = [];
   for (var i = 0; i < res.fileList.length; i++) {
    //格式化時(shí)間 
    var createTime = new Date(res.fileList[i].createTime)
    //將音頻大小B轉(zhuǎn)為KB 
    var size = (res.fileList[i].size / 1024).toFixed(2);
    var voice = { filePath: res.fileList[i].filePath, createTime: createTime, size: size };
    console.log("文件路徑: " + res.fileList[i].filePath)
    console.log("文件時(shí)間: " + createTime)
    console.log("文件大小: " + size)
    voices = voices.concat(voice);
   }
   _this.setData({
    voices: voices
   })
   }
  })
  },
  fail: function (res) {
  //錄音失敗 
  wx.showModal({
   title: '提示',
   content: '錄音的姿勢(shì)不對(duì)!',
   showCancel: false,
   success: function (res) {
   if (res.confirm) {
    console.log('用戶點(diǎn)擊確定')
    return
   }
   }
  })
  }
 })
 },
 //手指抬起 
 touchup: function () {
 console.log("手指抬起了...")
 this.setData({
  isSpeaking: false,
 })
 clearInterval(this.timer)
 wx.stopRecord()
 },
 //點(diǎn)擊播放錄音 
 gotoPlay: function (e) {
 var filePath = e.currentTarget.dataset.key;
 //點(diǎn)擊開(kāi)始播放 
 wx.showToast({
  title: '開(kāi)始播放',
  icon: 'success',
  duration: 1000
 })
 wx.playVoice({
  filePath: filePath,
  success: function () {
  wx.showToast({
   title: '播放結(jié)束',
   icon: 'success',
   duration: 1000
  })
  }
 })
 }
})
//麥克風(fēng)幀動(dòng)畫(huà) 
function speaking() {
 var _this = this;
 //話筒幀動(dòng)畫(huà) 
 var i = 1;
 this.timer = setInterval(function () {
 i++;
 i = i % 5;
 _this.setData({
  j: i
 })
 }, 200);
}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持創(chuàng)新互聯(lián)。

當(dāng)前標(biāo)題:微信小程序?qū)崿F(xiàn)錄音功能
本文鏈接:http://chinadenli.net/article44/joeghe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google、云服務(wù)器建站公司、外貿(mào)建站面包屑導(dǎo)航、網(wǎng)站收錄

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)
日本欧美一区二区三区在线播| 男女午夜视频在线观看免费| 黄色三级日本在线观看| 99香蕉精品视频国产版| 国产精品一区二区不卡中文| 日韩一级一片内射视频4k| 黄片免费播放一区二区| 亚洲精品蜜桃在线观看| 婷婷激情五月天丁香社区| 久久精品偷拍视频观看| 一区二区三区日韩经典| 亚洲天堂精品1024| 国产精品久久熟女吞精| 日本加勒比在线观看不卡| 最近的中文字幕一区二区| 青青操在线视频精品视频| 精品国模一区二区三区欧美| 国产在线一区二区免费| 午夜福利精品视频视频| 黄色片一区二区三区高清| av免费视屏在线观看| 日韩免费午夜福利视频| 麻豆视频传媒入口在线看| 欧美激情一区=区三区| 天堂热东京热男人天堂| 国产亚洲午夜高清国产拍精品| 欧美午夜不卡在线观看| 亚洲国产av精品一区二区| 午夜福利精品视频视频| 久久精品国产99精品亚洲| 亚洲欧美日韩另类第一页| 久一视频这里只有精品| 国产又猛又黄又粗又爽无遮挡| 丝袜美女诱惑在线观看| 国语久精品在视频在线观看| 蜜桃av人妻精品一区二区三区| 午夜福利视频六七十路熟女| 热久久这里只有精品视频| 白白操白白在线免费观看| 黄色片国产一区二区三区| 色婷婷在线精品国自产拍|