RecorderManager.pause
Introduction
This function is used to pause a recording.
Usage Limitations
Supported in the basic library version 4.0.0 or higher.
Parameters
Object object
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| success | function | No | Callback function for a successful interface call | |
| fail | function | No | Callback function for a failed interface call | |
| complete | function | No | Callback function for the end of an interface call (called whether the call is successful or not) |
object.success Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| success | string | true - Successful |
object.fail Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| errMsg | string | Error message |
| success | string | false - Failed |
errMsg Explanation
| Error Message | Description |
|---|---|
| Audio is paused, pause record fail: A10009 | Recording is already paused. |
| Audio failed with permission denied: A10011 | No recording permission. |
Example Code
// pages/index/index.js
Page({
pause() {
const recorderManager = dlt.getRecorderManager();
recorderManager.pause({
success: () => {
console.log('Success');
},
});
},
});
In this example, the RecorderManager.pause method is used to pause a recording. It accepts an optional success callback function, which is called upon a successful pause. If there are any errors, a failure callback is called, and the error message provides details about the error, such as whether the recording is already paused or if there is no recording permission.