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
Type
(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
Taro.startRecord({
success: function (res) {
const tempFilePath = res.tempFilePath
}
})
setTimeout(function () {
Taro.stopRecord() // Stop recording
}, 10000)
API Support
API | WeChat Mini-Program | H5 | React Native |
---|---|---|---|
Taro.startRecord | ✔️ |