Skip to main content
Version: Next

Taro.startRecord(option)

Starts recording. The recording stops when a user calls Taro.stopRecord, or the recording duration exceeds 1 minute. The API cannot be called when the user exits the Mini Program.

NOTE: As of base library 1.6.0, this API is not maintained. Use Taro.getRecorderManager instead

Reference

Type

(option: Option) => Promise<SuccessCallbackResult>

Parameters

Option

PropertyTypeRequiredDescription
complete(res: any) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
fail(res: any) => voidNoThe callback function for a failed API call
success(res: Result) => voidNoThe callback function for a successful API call

SuccessCallbackResult

PropertyTypeDescription
tempFilePathstringThe temporary path to recording files
errMsgstringCall result

Sample Code

Taro.startRecord({
success: function (res) {
const tempFilePath = res.tempFilePath
}
})
setTimeout(function () {
Taro.stopRecord() // Stop recording
}, 10000)

API Support

APIWeChat Mini-ProgramH5React Native
Taro.startRecord✔️