/* * Resets UI elements. Used after conversation has ended. */ void reset() { if (participantVideoRenderer != null) { //participantVideoRenderer.OnPause (); participantVideoRenderer = null; } localContainer.RemoveAllViews(); localContainer = FindViewById <ViewGroup> (Resource.Id.localContainer); participantContainer.RemoveAllViews(); if (conversation != null) { conversation.Dispose(); conversation = null; } outgoingInvite = null; muteMicrophone = false; muteActionFab.SetImageDrawable(ContextCompat.GetDrawable(this, Resource.Drawable.ic_mic_green_24px)); pauseVideo = false; localVideoActionFab.SetImageDrawable(ContextCompat.GetDrawable(this, Resource.Drawable.ic_videocam_green_24px)); if (conversationsClient != null) { conversationsClient.AudioOutput = AudioOutput.Headset; } setCallAction(); startPreview(); }
/* * Creates an outgoing conversation UI dialog */ private void showCallDialog() { var participantEditText = new EditText(this); alertDialog = Dialog.CreateCallParticipantsDialog(participantEditText, delegate { /* * Make outgoing invite */ var participant = participantEditText.Text; if (!string.IsNullOrEmpty(participant) && conversationsClient != null) { stopPreview(); // Create participants set (we support only one in this example) var participants = new List <string> (); participants.Add(participant); // Create local media var localMedia = setupLocalMedia(); // Create outgoing invite outgoingInvite = conversationsClient.SendConversationInvite(participants, localMedia, new ConversationCallback { ConversationHandler = (c, err) => { if (err == null) { // Participant has accepted invite, we are in active conversation this.conversation = c; conversation.ConversationListener = conversationListener(); } else { Android.Util.Log.Error(TAG, err.Message); hangup(); reset(); } } }); setHangupAction(); } else { Android.Util.Log.Error(TAG, "invalid participant call"); conversationStatusTextView.Text = "call participant failed"; } }, delegate { setCallAction(); alertDialog.Dismiss(); }, this); alertDialog.Show(); }