Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat small program API recording and start recording


May 18, 2021 WeChat Mini Program Development Document


Table of contents


wx.startRecord(Object object)

User authorization scope.record is required before the call can be made
Starting with the base library 1.6.0, this interface stops maintenance, using wx.getRecorderManager instead

Start recording. T he recording ends automatically when the wx.stopRecord is actively called, or when the recording exceeds 1 minute. This interface cannot be called when the user leaves the small program.

Parameters

Object object

Property Type The default Required Description
success function Whether The interface calls a successful callback function
fail function Whether The interface calls the failed callback function
complete function Whether Callback function at end of interface call (call succeeds, fails are executed)

object.success callback function

Parameters
Object res
Property Type Description
tempFilePath string Temporary path to recording file (local path)

The sample code

wx.startRecord({
  success (res) {
    const tempFilePath = res.tempFilePath
  }
})
setTimeout(function () {
  wx.stopRecord() // 结束录音
}, 10000)