title: Taro.startRecord(option)

sidebar_label: startRecord

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

  1. (option: Option) => Promise<SuccessCallbackResult>

Parameters

Option

Property Type Required Description
complete (res: any) => void No The callback function used when the API call completed (always executed whether the call succeeds or fails)
fail (res: any) => void No The callback function for a failed API call
success (res: Result) => void No The callback function for a successful API call

SuccessCallbackResult

Property Type Description
tempFilePath string The temporary path to recording files
errMsg string Call result

Sample Code

  1. Taro.startRecord({
  2. success: function (res) {
  3. const tempFilePath = res.tempFilePath
  4. }
  5. })
  6. setTimeout(function () {
  7. Taro.stopRecord() // Stop recording
  8. }, 10000)

API Support

API WeChat Mini-Program H5 React Native
Taro.startRecord ✔️