RecorderManager.onFrameRecorded

Listen to events indicating the completion of recording files with specified frame sizes.

Note: The listener function is triggered only if frameFormatPcm is set to true and frameSize is specified.

Parameters

Type

Required

Description

Function listener

Yes

The function that listens to events for completion of recording files with specified frame sizes. The listener function is triggered when recording files of specified frame sizes are captured in the buffer.

Function listener

The following table lists the properties of Function listener:

Property

Type

Required

Description

frameBuffer

ArrayBuffer

Yes

The audio frame data.

isLastFrame

Boolean

Yes

Indicates whether the current frame is the last frame before the recording ends normally.

Sample code

copy
const recorderManager = my.getRecorderManager ();
recorderManager.onFrameRecorded (res => {
  console.log (res.frameBuffer, res.isLastFrame, res.frameBuffer.byteLength);
});
recorderManager.start ({
  frameSize: 100,
  frameFormatPcm: true
});