Agora Java API Reference for Android
io.agora.rtc.IMetadataObserver Interface Reference

Public Member Functions

abstract int getMaxMetadataSize ()
 
abstract byte[] onReadyToSendMetadata (long timeStampMs)
 
abstract void onMetadataReceived (byte[] buffer, int uid, long timeStampMs)
 

Static Public Attributes

static final int UNKNOWN_METADATA = -1
 
static final int VIDEO_METADATA = 0
 

Detailed Description

The definition of IMetadataObserver.

Since
v2.4.1.
Note
Implement all the callbacks in this class in the critical thread. We recommend avoiding any time-consuming operation in the critical thread.

Member Function Documentation

◆ getMaxMetadataSize()

abstract int io.agora.rtc.IMetadataObserver.getMaxMetadataSize ( )
abstract

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

The Metadata struct contains 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. The SDK triggers this callback after you successfully call the registerMediaMetadataObserver 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.

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

◆ onReadyToSendMetadata()

abstract byte[] io.agora.rtc.IMetadataObserver.onReadyToSendMetadata ( long  timeStampMs)
abstract

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

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

Note
Ensure that the size of the metadata does not exceed the value set in the getMaxMetadataSize callback.
Parameters
timeStampMsThe timestamp (ms) of the current metadata.
Returns
The metadata that you want to send in the format of byte[]. Ensure that you set the return value.

◆ onMetadataReceived()

abstract void io.agora.rtc.IMetadataObserver.onMetadataReceived ( byte[]  buffer,
int  uid,
long  timeStampMs 
)
abstract

Occurs when the local user receives the metadata.

Parameters
bufferThe received metadata.
uidThe ID of the user who sent the metadata.
timeStampMsThe timestamp (ms) of the received metadata.

Member Data Documentation

◆ UNKNOWN_METADATA

final int io.agora.rtc.IMetadataObserver.UNKNOWN_METADATA = -1
static

The metadata type is unknown.

◆ VIDEO_METADATA

final int io.agora.rtc.IMetadataObserver.VIDEO_METADATA = 0
static

The metadata type is video.