WeChat Mini Program API Recording


wx.startRecord(OBJECT)


Start recording. When wx.stopRecord is actively called, or the recording exceeds 1 minute, the recording automatically ends and the temporary file path of the recording file is returned

OBJECT parameter description:

QQ截图20170208110355.png

wx.stopRecord()


Actively call to stop recording.

Sample code:

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