List of usage examples for android.hardware Camera setParameters
public void setParameters(Parameters params)
From source file:com.ezartech.ezar.videooverlay.ezAR.java
private void initCamera(Camera camera) { Camera.Parameters cameraParameters = camera.getParameters(); defaultFocusMode = cameraParameters.getFocusMode(); continousFocusSupported = cameraParameters.getSupportedFocusModes() .contains(Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); focusAreaSupported = (cameraParameters.getMaxNumFocusAreas() > 0 && Util.isSupported(Parameters.FOCUS_MODE_AUTO, cameraParameters.getSupportedFocusModes())); meteringAreaSupported = (cameraParameters.getMaxNumMeteringAreas() > 0); aeLockSupported = cameraParameters.isAutoExposureLockSupported(); awbLockSupported = cameraParameters.isAutoWhiteBalanceLockSupported(); if (continousFocusSupported) { cameraParameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); } else if (Util.isSupported(Parameters.FOCUS_MODE_AUTO, cameraParameters.getSupportedFocusModes())) { cameraParameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO); }/*from ww w .java 2 s. c om*/ // camera.enableShutterSound(true); //requires api 17 int camWidth = isPortraitOrientation() ? cameraView.getHeight() : cameraView.getWidth(); int camHt = isPortraitOrientation() ? cameraView.getWidth() : cameraView.getHeight(); previewSizePair = selectSizePair(cameraParameters.getPreferredPreviewSizeForVideo(), cameraParameters.getSupportedPreviewSizes(), cameraParameters.getSupportedPictureSizes(), camWidth, camHt); Log.d(TAG, "preview size: " + previewSizePair.previewSize.width + ":" + previewSizePair.previewSize.height); cameraParameters.setPreviewSize(previewSizePair.previewSize.width, previewSizePair.previewSize.height); //commenting out; not used now //Camera.Size picSize = previewSizePair.pictureSize != null ? previewSizePair.pictureSize : previewSizePair.previewSize; //cameraParameters.setPictureSize(picSize.width,picSize.height); //Log.d(TAG, "picture size: " + picSize.width + ":" + picSize.height); camera.setParameters(cameraParameters); try { if (cameraView.getSurfaceTexture() != null) { camera.setPreviewTexture(cameraView.getSurfaceTexture()); } } catch (IOException e) { Log.e(TAG, "Unable to attach preview to camera!", e); } }