/** Registers a packet observer. * * The Agora RTC SDK allows your application to register a packet observer to receive callbacks for voice or video packet transmission. * * @note * - The size of the packet sent to the network after processing should not exceed 1200 bytes, otherwise, the packet may fail to be sent. * - Ensure that both receivers and senders call this method, otherwise, you may meet undefined behaviors such as no voice and black screen. * - When you use CDN live streaming, recording or storage functions, Agora doesn't recommend calling this method. * * * @return * - 0: Success. * - < 0: Failure. */ public override int RegisterPacketObserver() { if (_irtcEngine == null) { return((int)ERROR_CODE.ERROR_NOT_INIT_ENGINE); } IRtcEngineNative.initEventOnPacketCallback(OnReceiveAudioPacketCallback, OnReceiveVideoPacketCallback, OnSendAudioPacketCallback, OnSendVideoPacketCallback); return(IRtcEngineNative.registerPacketObserver()); }
/** UnRegisters the packet observer. * * @return * - 0: Success. * - < 0: Failure. */ public override int UnRegisterPacketObserver() { if (_irtcEngine == null) { return((int)ERROR_CODE.ERROR_NOT_INIT_ENGINE); } int rc = IRtcEngineNative.unRegisterPacketObserver(); IRtcEngineNative.initEventOnPacketCallback(null, null, null, null); return(rc); }