Java Code Examples for android.hardware.Camera.Parameters#setRecordingHint()
The following examples show how to use
android.hardware.Camera.Parameters#setRecordingHint() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CameraView.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
@TargetApi(14) private void onCameraReady(final @NonNull Camera camera) { final Parameters parameters = camera.getParameters(); if (VERSION.SDK_INT >= 14) { parameters.setRecordingHint(true); final List<String> focusModes = parameters.getSupportedFocusModes(); if (focusModes.contains(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)) { parameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE); } else if (focusModes.contains(Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) { parameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); } } displayOrientation = CameraUtils.getCameraDisplayOrientation(getActivity(), getCameraInfo()); camera.setDisplayOrientation(displayOrientation); camera.setParameters(parameters); enqueueTask(new PostInitializationTask<Void>() { @Override protected Void onRunBackground() { try { camera.setPreviewDisplay(surface.getHolder()); startPreview(parameters); } catch (Exception e) { Log.w(TAG, "couldn't set preview display", e); } return null; } }); }
Example 2
Source File: CameraView.java From deltachat-android with GNU General Public License v3.0 | 5 votes |
@TargetApi(14) private void onCameraReady(final @NonNull Camera camera) { final Parameters parameters = camera.getParameters(); if (VERSION.SDK_INT >= 14) { parameters.setRecordingHint(true); final List<String> focusModes = parameters.getSupportedFocusModes(); if (focusModes.contains(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)) { parameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE); } else if (focusModes.contains(Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) { parameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); } } displayOrientation = CameraUtils.getCameraDisplayOrientation(getActivity(), getCameraInfo()); camera.setDisplayOrientation(displayOrientation); camera.setParameters(parameters); enqueueTask(new PostInitializationTask<Void>() { @Override protected Void onRunBackground() { try { camera.setPreviewDisplay(surface.getHolder()); startPreview(parameters); } catch (Exception e) { Log.w(TAG, "couldn't set preview display", e); } return null; } }); }
Example 3
Source File: AndroidCameraAgentImpl.java From Camera2 with Apache License 2.0 | 4 votes |
private void applySettingsToParameters(final CameraSettings settings, final Parameters parameters) { final CameraCapabilities.Stringifier stringifier = mCapabilities.getStringifier(); Size photoSize = settings.getCurrentPhotoSize(); parameters.setPictureSize(photoSize.width(), photoSize.height()); Size previewSize = settings.getCurrentPreviewSize(); parameters.setPreviewSize(previewSize.width(), previewSize.height()); if (settings.getPreviewFrameRate() == -1) { parameters.setPreviewFpsRange(settings.getPreviewFpsRangeMin(), settings.getPreviewFpsRangeMax()); } else { parameters.setPreviewFrameRate(settings.getPreviewFrameRate()); } parameters.setPreviewFormat(settings.getCurrentPreviewFormat()); parameters.setJpegQuality(settings.getPhotoJpegCompressionQuality()); if (mCapabilities.supports(CameraCapabilities.Feature.ZOOM)) { parameters.setZoom(zoomRatioToIndex(settings.getCurrentZoomRatio(), parameters.getZoomRatios())); } parameters.setExposureCompensation(settings.getExposureCompensationIndex()); if (mCapabilities.supports(CameraCapabilities.Feature.AUTO_EXPOSURE_LOCK)) { parameters.setAutoExposureLock(settings.isAutoExposureLocked()); } parameters.setFocusMode(stringifier.stringify(settings.getCurrentFocusMode())); if (mCapabilities.supports(CameraCapabilities.Feature.AUTO_WHITE_BALANCE_LOCK)) { parameters.setAutoWhiteBalanceLock(settings.isAutoWhiteBalanceLocked()); } if (settings.getWhiteBalance() != null) { parameters.setWhiteBalance(stringifier.stringify(settings.getWhiteBalance())); } if (mCapabilities.supports(CameraCapabilities.Feature.FOCUS_AREA)) { if (settings.getFocusAreas().size() != 0) { parameters.setFocusAreas(settings.getFocusAreas()); } else { parameters.setFocusAreas(null); } } if (mCapabilities.supports(CameraCapabilities.Feature.METERING_AREA)) { if (settings.getMeteringAreas().size() != 0) { parameters.setMeteringAreas(settings.getMeteringAreas()); } else { parameters.setMeteringAreas(null); } } if (settings.getCurrentFlashMode() != CameraCapabilities.FlashMode.NO_FLASH) { parameters.setFlashMode(stringifier.stringify(settings.getCurrentFlashMode())); } if (settings.getCurrentSceneMode() != CameraCapabilities.SceneMode.NO_SCENE_MODE) { if (settings.getCurrentSceneMode() != null) { parameters .setSceneMode(stringifier.stringify(settings.getCurrentSceneMode())); } } parameters.setRecordingHint(settings.isRecordingHintEnabled()); Size jpegThumbSize = settings.getExifThumbnailSize(); if (jpegThumbSize != null) { parameters.setJpegThumbnailSize(jpegThumbSize.width(), jpegThumbSize.height()); } parameters.setPictureFormat(settings.getCurrentPhotoFormat()); CameraSettings.GpsData gpsData = settings.getGpsData(); if (gpsData == null) { parameters.removeGpsData(); } else { parameters.setGpsTimestamp(gpsData.timeStamp); if (gpsData.processingMethod != null) { // It's a hack since we always use GPS time stamp but does // not use other fields sometimes. Setting processing // method to null means the other fields should not be used. parameters.setGpsAltitude(gpsData.altitude); parameters.setGpsLatitude(gpsData.latitude); parameters.setGpsLongitude(gpsData.longitude); parameters.setGpsProcessingMethod(gpsData.processingMethod); } } }