addListener

Adds one listener.

addListener?<EventType extends keyof IMediaRecorderEvent>(
      eventType: EventType,
      listener: IMediaRecorderEvent[EventType]
    ): void;

Details

After calling this method, you can listen for the corresponding events in the object and obtain data through . Depending on your project needs, you can add multiple listeners for the same event.

Parameters

eventType
The name of the target event to listen for. See .
listener
The callback function for eventType. Take adding a listener for as an example:
const onRecorderStateChanged = (state: RecorderState, reason: RecorderReasonCode) => {};
engine.addListener('onRecorderStateChanged', onRecorderStateChanged);