WeChat Open Platform

Mini Programs Documentation



Starts recording. Recording will end automatically when wx.stopRecord is called actively, or the recording exceeds one minute. The temporary file path for the recording file is returned. This interface cannot be called when the user leaves the Mini Program.

OBJECT parameter descriptions:

Parameter Type Required Description
success Function No Called after recording is successful, returns temporary file path for recording file, res = {tempFilePath: 'Temporary recording file path'}
fail Function No Callback function for failed interface call
complete Function No Callback function for interface call results (will be executed if call succeeds or fails)

Note: Temporary file paths can be used as normal during this Mini Program startup. wx.saveFile needs to be called actively if files need to be saved permanently. They can only be accessed the next time the Mini Program is launched.

success return parameter descriptions:

Parameter Description
tempFilePath Temporary recording file path


‚Äč Actively calls stop record.

Sample code:

  success: function(res) {
    var tempFilePath = res.tempFilePath 
  fail: function(res) {
     //Recording unsuccessful
setTimeout(function() {
  //Stop recording  
}, 10000)

Bugs & Tips

  1. tip: The wx.startRecord interface requires user authorization, it is a scene where compatible users are requested to refuse authorization.