void OnJoinSuccessHandler2(int id) { Debug.Log("client2 OnJoinSuccess --- id = " + id); rtmCallEventHandler = new RtmCallEventHandler(); rtmCallEventHandler.OnLocalInvitationReceivedByPeer = OnLocalInvitationReceivedByPeerHandler; rtmCallEventHandler.OnRemoteInvitationReceived = OnRemoteInvitationReceivedHandler; rtmCallManager = rtmClient.GetRtmCallManager(rtmCallEventHandler); localInvitation = rtmCallManager.CreateLocalCallInvitation("222"); rtmCallManager.SendLocalInvitation(localInvitation); localInvitation.SetChannelId("1212"); localInvitation.SetContent("23232"); }
// Start is called before the first frame update void Start() { clientEventHandler = new RtmClientEventHandler(); channelEventHandler = new RtmChannelEventHandler(); callEventHandler = new RtmCallEventHandler(); rtmClient = new RtmClient(appId, clientEventHandler); #if UNITY_EDITOR rtmClient.SetLogFile("./rtm_log.txt"); #endif clientEventHandler.OnQueryPeersOnlineStatusResult = OnQueryPeersOnlineStatusResultHandler; clientEventHandler.OnLoginSuccess = OnClientLoginSuccessHandler; clientEventHandler.OnLoginFailure = OnClientLoginFailureHandler; clientEventHandler.OnMessageReceivedFromPeer = OnMessageReceivedFromPeerHandler; channelEventHandler.OnJoinSuccess = OnJoinSuccessHandler; channelEventHandler.OnJoinFailure = OnJoinFailureHandler; channelEventHandler.OnLeave = OnLeaveHandler; channelEventHandler.OnMessageReceived = OnChannelMessageReceivedHandler; // Optional, tracking members channelEventHandler.OnGetMembers = OnGetMembersHandler; channelEventHandler.OnMemberCountUpdated = OnMemberCountUpdatedHandler; channelEventHandler.OnMemberJoined = OnMemberJoinedHandler; channelEventHandler.OnMemberLeft = OnMemberLeftHandler; // image clientEventHandler.OnImageMessageReceivedFromPeer = OnImageMessageReceivedFromPeerHandler; clientEventHandler.OnImageMediaUploadResult = OnImageMediaUploadResultHandler; clientEventHandler.OnSendMessageResult = OnSendMessageResultHandler; clientEventHandler.OnMediaDownloadToFileResult = OnMediaDownloadToFileResultHandler; clientEventHandler.OnMediaDownloadToMemoryResult = OnMediaDownloadToMemoryResultHandler; // invite callEventHandler.OnLocalInvitationAccepted = OnLocalInvitationAcceptedHandler; callEventHandler.OnLocalInvitationCanceled = OnLocalInvitationCanceledHandler; callEventHandler.OnLocalInvitationFailure = OnLocalInvitationFailureHandler; callEventHandler.OnLocalInvitationReceivedByPeer = OnLocalInvitationReceivedByPeerHandler; callEventHandler.OnLocalInvitationRefused = OnLocalInvitationRefusedHandler; callEventHandler.OnRemoteInvitationAccepted = OnRemoteInvitationAcceptedHandler; callEventHandler.OnRemoteInvitationCanceled = OnRemoteInvitationCanceledHandler; callEventHandler.OnRemoteInvitationFailure = OnRemoteInvitationFailureHandler; callEventHandler.OnRemoteInvitationReceived = OnRemoteInvitationReceivedHandler; callEventHandler.OnRemoteInvitationRefused = OnRemoteInvitationRefusedHandler; callManager = rtmClient.GetRtmCallManager(callEventHandler); // state clientEventHandler.OnConnectionStateChanged = OnConnectionStateChangedHandler; bool initialized = ShowDisplayTexts(); if (initialized) { string ver = RtmClient.GetSdkVersion(); messageDisplay.AddTextToDisplay("RTM version " + ver + " initialized.", Message.MessageType.Info); } else { messageDisplay.AddTextToDisplay("RTM not initialized", Message.MessageType.Info); } }