Esempio n. 1
0
        public void Init()
        {
            string appID = _context.GetString(Resource.String.agora_app_id);

            _myRtmClientListener = new RtmClientListener();
            _myRtmClientListener.MessageReceived += OnRtmMessageReceived;
            _myRtmClientListener.StateChanged    += OnStateChanged;

            try
            {
                _rtmClient = RtmClient.CreateInstance(_context, appID, _myRtmClientListener);

#if DEBUG
                _rtmClient.SetParameters("{\"rtm.log_filter\": 65535}");
#endif
            }
            catch (Exception e)
            {
                throw new Exception($"NEED TO check rtm sdk init fatal error\n {e.StackTrace}");
            }

            _callManager = _rtmClient.RtmCallManager;
            _callManager.RemoteInvitationReceived      += RemoteInvitationReceived;
            _callManager.RemoteInvitationFailure       += RemoteInvitationFailure;
            _callManager.LocalInvitationReceivedByPeer += LocalInvitationReceivedByPeer;
            _callManager.RemoteInvitationAccepted      += RemoteInvitationAccepted;
            _callManager.RemoteInvitationRefused       += RemoteInvitationRefused;
            _callManager.LocalInvitationRefused        += LocalInvitationRefused;
            _callManager.LocalInvitationAccepted       += LocalInvitationAccepted;
        }
Esempio n. 2
0
        private void InitCallbackAndListener()
        {
            _channelJoinCallBack = new ResultCallback();
            _channelJoinCallBack.OnSuccessAction += OnSuccessJoinChannel;
            _channelJoinCallBack.OnFailureAction += OnFailureJoinChannel;

            _sendMessageClientCallback = new ResultCallback();
            _sendMessageClientCallback.OnFailureAction += OnFailureSendToClient;

            _sendMessageChannelCallback = new ResultCallback();
            _sendMessageChannelCallback.OnFailureAction += OnFailureSendChannel;

            _memberCallBack = new ResultCallback();
            _memberCallBack.OnSuccessAction += MemberSuccessAction;

            _myRtmClientListener = new RtmClientListener();
            _myRtmClientListener.MessageReceived += OnRtmMessageReceived;
            _myRtmClientListener.StateChanged    += OnStateChanged;

            _channelListener = new RtmChannelListener();
            _channelListener.OnMemberLeftAction      += OnMemberLeft;
            _channelListener.OnMemberJoinedAction    += OnMemberJoined;
            _channelListener.OnMessageReceivedAction += OnMessageReceived;
        }
Esempio n. 3
0
 public void UnregisterListener(RtmClientListener listener)
 {
     _listenerList.Remove(listener);
 }
Esempio n. 4
0
 public void RegisterListener(RtmClientListener listener)
 {
     _listenerList.Add(listener);
 }