private void createLocalMedia() {
    localMedia = LocalMedia.create(this);

    // Share your microphone
    localAudioTrack = localMedia.addAudioTrack(true);

    // Share your camera
    cameraCapturer = new CameraCapturer(this, CameraSource.FRONT_CAMERA);
    localVideoTrack = localMedia.addVideoTrack(true, cameraCapturer);
    primaryVideoView.setMirror(true);
    localVideoTrack.addRenderer(primaryVideoView);
    localVideoView = primaryVideoView;
  }
 /*
  * 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;
 }