RecorderManager.onStop

Register a listener function that listens to recording stop events.

Parameters

Type

Required

Description

Function listener

Yes

The function that listens to recording stop events. When the recording process stops, the specified listener function is triggered.

Function listener

The following table lists the properties of Function listener:

Property

Type

Description

tempFilePath

String

Temporary path of the recording file

duration

Number

Total recording duration, in seconds

fileSize

Number

Recording file size, in bytes

Sample code

copy
let recorderManager = my.getRecorderManager();
recorderManager.onStop(res => {
  console.log ('on audio record stopped ', res);
});

recorderManager.start();
setTimeout (() => {
  recorderManager.stop();
}, 5000);