/* * Called when participant leaves the room */ private void removeParticipant(Participant participant) { videoStatusTextView.setText("Participant " + participant.getIdentity() + " left."); if (!participant.getIdentity().equals(participantIdentity)) { return; } /* * Show local video in primary view */ thumbnailVideoView.setVisibility(View.GONE); localVideoTrack.removeRenderer(thumbnailVideoView); primaryVideoView.setMirror(true); localVideoTrack.addRenderer(primaryVideoView); localVideoView = primaryVideoView; }
/* * Called when participant joins the room */ private void addParticipant(Participant participant) { /* * This app only displays video for one additional participant per Room */ if (thumbnailVideoView.getVisibility() == View.VISIBLE) { Snackbar.make( connectActionFab, "Multiple participants are not currently support in this UI", Snackbar.LENGTH_LONG) .setAction("Action", null) .show(); return; } participantIdentity = participant.getIdentity(); videoStatusTextView.setText("Participant " + participantIdentity + " joined"); /* * Stop rendering local video track in primary view and move it to thumbnail view */ localVideoTrack.removeRenderer(primaryVideoView); thumbnailVideoView.setVisibility(View.VISIBLE); localVideoTrack.addRenderer(thumbnailVideoView); localVideoView = thumbnailVideoView; /* * Start listening for participant media events */ participant.getMedia().setListener(mediaListener()); }