Example #1
0
        /** Registers a metadata observer.
         *
         * You need to implement the MetadataObserver class and specify the metadata type in this method. A successful call of this method triggers the {@link agora_gaming_rtc.MetadataObserver.OnGetMaxMetadataSizeHandler OnGetMaxMetadataSizeHandler} callback. This method enables you to add synchronized metadata in the video stream for more diversified live broadcast interactions, such as sending shopping links, digital coupons, and online quizzes.
         *
         * @note
         * - Call this method before the {@link agora_gaming_rtc.IRtcEngine.JoinChannelByKey JoinChannelByKey} method.
         * - This method applies to the Live-broadcast channel profile.
         *
         * @param metaDataType See {@link agora_gaming_rtc.METADATA_TYPE METADATA_TYPE}. The SDK supports `VIDEO_METADATA(0)` only for now.
         *
         * @return
         * - 0: Success.
         * - < 0: Failure.
         */
        public override int RegisterMediaMetadataObserver(METADATA_TYPE metaDataType)
        {
            if (_irtcEngine == null)
            {
                return((int)ERROR_CODE.ERROR_NOT_INIT_ENGINE);
            }

            IRtcEngineNative.initEventOnMetaDataCallback(OnMediaMetaDataReceivedCallback, OnReadyToSendMetadataCallback, OnGetMaxMetadataSizeCallback);
            return(IRtcEngineNative.registerMediaMetadataObserver((int)metaDataType));
        }