Example #1
0
        /** Listens for the {@link agora_gaming_rtc.AudioRawDataManager.OnRecordAudioFrameHandler OnRecordAudioFrameHandler} delegate.
         *
         * @note
         * - Call this method before calling {@link agora_gaming_rtc.AudioRawDataManager.RegisterAudioRawDataObserver RegisterAudioRawDataObserver}.
         * - If you want to unregister the `OnRecordAudioFrameHandler` delegate, call {@link agora_gaming_rtc.AudioRawDataManager.UnRegisterAudioRawDataObserver UnRegisterAudioRawDataObserver} before calling this method, and set `action` as `null` when calls this method.
         *
         * @param action The implementation of the `OnRecordAudioFrameHandler` delegate.
         *
         * @return
         * - 0: Success.
         * - < 0: Failure.
         */
        public override int SetOnRecordAudioFrameCallback(OnRecordAudioFrameHandler action)
        {
            if (_irtcEngine == null)
            {
                return((int)ERROR_CODE.ERROR_NOT_INIT_ENGINE);
            }

            if (action == null)
            {
                OnRecordAudioFrame = null;
                IRtcEngineNative.initEventOnRecordAudioFrame(null);
            }
            else
            {
                OnRecordAudioFrame = action;
                IRtcEngineNative.initEventOnRecordAudioFrame(OnRecordAudioFrameCallback);
            }
            return((int)ERROR_CODE.ERROR_OK);
        }