Example #1
0
        /** Listens for the {@link agora_gaming_rtc.AudioRawDataManager.OnPlaybackAudioFrameHandler OnPlaybackAudioFrameHandler} delegate.
         *
         * @note
         * - Call this method before calling {@link agora_gaming_rtc.AudioRawDataManager.RegisterAudioRawDataObserver RegisterAudioRawDataObserver}.
         * - If you want to unregister the `OnPlaybackAudioFrameHandler` 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 `OnPlaybackAudioFrameHandler` delegate.
         *
         * @return
         * - 0: Success.
         * - < 0: Failure.
         */
        public override int SetOnPlaybackAudioFrameCallback(OnPlaybackAudioFrameHandler action)
        {
            if (_irtcEngine == null)
            {
                return((int)ERROR_CODE.ERROR_NOT_INIT_ENGINE);
            }

            if (action == null)
            {
                OnPlaybackAudioFrame = null;
                IRtcEngineNative.initEventOnPlaybackAudioFrame(null);
            }
            else
            {
                OnPlaybackAudioFrame = action;
                IRtcEngineNative.initEventOnPlaybackAudioFrame(OnPlaybackAudioFrameCallback);
            }
            return((int)ERROR_CODE.ERROR_OK);
        }
Example #2
0
        public int SetOnPlaybackAudioFrameCallback(OnPlaybackAudioFrameHandler action)
        {
            if (_irtcEngine == null)
            {
                return(-7);
            }

            if (action == null)
            {
                OnPlaybackAudioFrame = null;
                initEventOnPlaybackAudioFrame(null);
            }
            else
            {
                OnPlaybackAudioFrame = action;
                initEventOnPlaybackAudioFrame(OnPlaybackAudioFrameCallback);
            }
            return(0);
        }