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

  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
    })

  }

猜你喜欢

转载自www.cnblogs.com/chentailin/p/9368987.html