/**
  * This method gets called when the zoom control reports that the zoom value has changed. This
  * method sets the camera zoom value accordingly.
  *
  * @param index
  */
 private void onZoomValueChanged(int index) {
   mZoomValue = index;
   ImsCamera imsCamera = mVideoCallManager.getImsCameraInstance();
   // Set zoom
   if (imsCamera.isZoomSupported()) {
     imsCamera.setZoom(mZoomValue);
   }
 }
  /**
   * This method get the zoom related parameters from the camera and initialized the zoom control
   */
  private void initializeZoom() {
    ImsCamera imsCamera = mVideoCallManager.getImsCameraInstance();
    if (imsCamera == null) {
      return;
    }
    if (!imsCamera.isZoomSupported()) {
      mZoomControl.setVisibility(View.GONE); // Disable ZoomControl
      return;
    }

    mZoomControl.setVisibility(View.VISIBLE); // Enable ZoomControl
    mZoomMax = imsCamera.getMaxZoom();
    // Currently we use immediate zoom for fast zooming to get better UX and
    // there is no plan to take advantage of the smooth zoom.
    mZoomControl.setZoomMax(mZoomMax);
    mZoomControl.setZoomIndex(DEFAULT_CAMERA_ZOOM_VALUE);
    mZoomControl.setOnZoomChangeListener(new ZoomChangeListener());
  }
 /** Initialize camera parameters based on negotiated height, width */
 private void initializeCameraParams() {
   try {
     // Get the parameter to make sure we have the up-to-date value.
     ImsCamera imsCamera = mVideoCallManager.getImsCameraInstance();
     // Set the camera preview size
     if (mIsMediaLoopback) {
       // In loopback mode the IMS is hard coded to render the
       // camera frames of only the size 176x144 on the far end surface
       imsCamera.setPreviewSize(LOOPBACK_MODE_WIDTH, LOOPBACK_MODE_HEIGHT);
     } else {
       log(
           "Set Preview Size directly with negotiated Height = "
               + mVideoCallManager.getNegotiatedHeight()
               + " negotiated width= "
               + mVideoCallManager.getNegotiatedWidth());
       imsCamera.setPreviewSize(
           mVideoCallManager.getNegotiatedWidth(), mVideoCallManager.getNegotiatedHeight());
       imsCamera.setPreviewFpsRange(mVideoCallManager.getNegotiatedFps());
     }
   } catch (RuntimeException e) {
     loge("Error setting Camera preview size/fps exception=" + e);
   }
 }