AgoraMediaMetadataDataSource Protocol Reference

Conforms to NSObject
Declared in AgoraMediaMetadata.h

Overview

The definition of the AgoraMediaMetadataDataSource protocol.

Note: Implement all the callbacks in this protocol in the critical thread. We recommend avoiding any time-consuming operation in the critical thread.

– metadataMaxSize required method

Occurs when the SDK requests the maximum size of the metadata.

- (NSInteger)metadataMaxSize

Return Value

The maximum size of the buffer of the metadata (see the return value of readyToSendMetadataAtTimestamp) that you want to use. The highest value is 1024 bytes. Ensure that you set the return value.

Discussion

The SDK triggers this callback after you successfully calling the setMediaMetadataDataSource method. You need to specify the maximum size of the metadata in the return value of this callback.

This callback is returned multiple times, and you can update the maximum metadata size in the new callbacks.

Declared In

AgoraMediaMetadata.h

– readyToSendMetadataAtTimestamp: required method

Occurs when the SDK is ready to receive and send metadata.

- (NSData *_Nullable)readyToSendMetadataAtTimestamp:(NSTimeInterval)timestamp

Parameters

timestamp

The timestamp (ms) of the current metadata.

Return Value

The metadata that you want to send in the format of NSData, including the following parameters:

  • uid: ID of the user who sends the metadata.
  • size: The size of the sent or received metadata.
  • buffer: The sent or received metadata.
  • timeStampMs: The timestamp of the metadata.

Ensure that you set the return value.

Discussion

You need to specify the metadata in the return value of this method.

Note: Ensure that the size of the metadata that you specify in this callback does not exceed the value set in the maxMetadataSize callback.

Declared In

AgoraMediaMetadata.h