Metadata Observer
Introduces methods and callbacks related to metadata observers.
getMaxMetadataSize
Occurs when the SDK requests the maximum size of the metadata.
virtual int getMaxMetadataSize() { return DEFAULT_METADATA_SIZE_IN_BYTE; }
After successfully complete the registration by calling registerMediaMetadataObserver, the SDK triggers this callback once every video frame is sent. You need to specify the maximum size of the metadata in the return value of this callback.
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.
registerMediaMetadataObserver
Registers the metadata observer.
virtual int registerMediaMetadataObserver(IMetadataObserver *observer, IMetadataObserver::METADATA_TYPE type) = 0;
You need to implement the IMetadataObserver class and specify the metadata type in this method. This method enables you to add synchronized metadata in the video stream for more diversified live interactive streaming, such as sending shopping links, digital coupons, and online quizzes.
A successful call of this method triggers the getMaxMetadataSize callback.
Parameters
- observer
- The metadata observer. See IMetadataObserver.
- type
-
The metadata type. The SDK currently only supports VIDEO_METADATA. See METADATA_TYPE.
Returns
- 0: Success.
- < 0: Failure.
unregisterMediaMetadataObserver
Unregisters the specified metadata observer.
virtual int unregisterMediaMetadataObserver(IMetadataObserver* observer, IMetadataObserver::METADATA_TYPE type) = 0;
Parameters
- observer
- The metadata observer. See IMetadataObserver.
- type
-
The metadata type. The SDK currently only supports VIDEO_METADATA. See METADATA_TYPE.
Returns
- 0: Success.
- < 0: Failure.
onMetadataReceived
Occurs when the local user receives the metadata.
virtual void onMetadataReceived(const Metadata &metadata) = 0;
};
Parameters
- metadata
- The metadata received, see Metadata.
onReadyToSendMetadata
Occurs when the SDK is ready to send metadata.
virtual bool onReadyToSendMetadata(Metadata &metadata, VIDEO_SOURCE_TYPE source_type) = 0;
This callback is triggered when the SDK is ready to send metadata.
Parameters
- source_type
- Video data type. See VIDEO_SOURCE_TYPE.
- metadata
- The metadata the user wants to send. See Metadata.
Returns
true
: Send it.false
: Do not send it.