Agora RTC Objective-C API Reference Refactor

Instance Methods
<AgoraMediaMetadataDataSource> Protocol Reference

Inherits <NSObject>.

## Instance Methods
(NSInteger) | - metadataMaxSize
(NSData *_Nullable) | - readyToSendMetadataAtTimestamp:sourceType:

## Detailed Description

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.

## Method Documentation

## ◆ metadataMaxSize

- (NSInteger) metadataMaxSize |  |  |
| required

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

After calling the AgoraRtcEngineKit.setMediaMetadataDataSource:withType: setMediaMetadataDataSource method, the SDK triggers this callback to query the maximum size of your metadata. You must specify the maximum size in the return value and then pass it to the SDK.

Returns
  The maximum size (bytes) of the buffer of the metadata. See AgoraMediaMetadataDataSource.readyToSendMetadataAtTimestamp: readyToSendMetadataAtTimestamp. The value must not exceed 1024 bytes. You must specify the maximum size in this return value.

## ◆ readyToSendMetadataAtTimestamp:sourceType:

- (NSData * _Nullable) readyToSendMetadataAtTimestamp: |  | (NSTimeInterval) | timestamp
sourceType: |  | (AgoraVideoSourceType) | sourceType
| required

Occurs when the SDK is ready to send metadata.

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 metadataMaxSize metadataMaxSize callback.

Parameters

  timestamp | The timestamp (ms) of the current metadata.

Returns
  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 metadata.
  - `buffer`: The sent metadata.
  - `timeStampMs`: The NTP timestamp (ms) when the metadata is sent.