微信小程序开发文档 / 微信小程序API 录音

微信小程序API 录音

wx.startRecord(OBJECT)


开始录音。当主动调用wx.stopRecord,或者录音超过1分钟时自动结束录音,返回录音文件的临时文件路径

OBJECT参数说明:

QQ截图20170208110355.png

wx.stopRecord()


主动调用停止录音。

示例代码:

wx.starRecord({
  success:function(res){
     var tempFilePath = res.tempFilePath;  
  },
  fail:function(res){
     //录音失败
  }
});
setTimeout(function(){  
  //结束录音  
  wx.stopRecord();
},10000);