RecorderManager.stop
Introduction
Stops recording audio.
Usage Restrictions
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 API invocation. | |
| fail | function | No | Callback function for a failed API invocation. | |
| complete | function | No | Callback function that is called at the end of the API invocation (whether it was successful or failed). |
object.success Callback Function Parameters
Object res
| Property | Type | Description |
|---|---|---|
| success | string | true - Success |
object.fail Callback Function Parameters
Object res
| Property | Type | Description |
|---|---|---|
| errMsg | string | Error message |
| success | string | false - Failure |
errMsg Description
| Error Message | Description |
|---|---|
| Audio is stop, don't stop record again : A10012 | Recording has already stopped; please do not stop again |
| Audio failed with permission denied : A10011 | No recording permission |
Example
// pages/index/index.js
Page({
stop() {
const recorderManager = dlt.getRecorderManager();
recorderManager.stop({
success: () => {
console.log('success');
},
});
},
});
In this example, the RecorderManager is used to stop the recording of audio. The stop method is called to stop the recording, and you can handle the success or failure of the operation using the provided callback functions.