小程序开始录音 停止录音 播放录音

button:function(e){

    wx.startRecord({
      success: function (res) {
        voice = res.tempFilePath
       
      },
      fail: function (res) {
        //录音失败
      }
    })
  },
  stop:function(e){
   // setTimeout(function () {
      //结束录音  
      wx.stopRecord()
  //  }, 10000)
  },
  bofang:function(e){
    console.log(voice)
    wx.playVoice({
      filePath: voice
    })

  }
原文地址:https://www.cnblogs.com/swmin/p/9915016.html