Closed mangoxxx closed 6 years ago
you can fix it by add "mRenderView.setRotate90Degrees(1);" such as
private void setCameraParameters() {
Camera.Parameters parameters = mCamera.getParameters();
if (getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) {
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
Camera.getCameraInfo(mCurrentCameraId, cameraInfo);
parameters.set("orientation", "portrait");
int orientation;
if (mCurrentCameraId == Camera.CameraInfo.CAMERA_FACING_FRONT) {
parameters.set("rotation", 270);
orientation = 360 - cameraInfo.orientation;
} else {
parameters.set("rotation", 90);
orientation = cameraInfo.orientation;
}
mCamera.setDisplayOrientation(orientation);
mRenderView.setRotate90Degrees(0);
} else {
parameters.set("orientation", "landscape");
mCamera.setDisplayOrientation(0);
mRenderView.setRotate90Degrees(1);
}
// 预览分辨率设置为1280*720
parameters.setPreviewSize(1280, 720);
// 输出分辨率设置为1280*720,质量100%
parameters.setPictureSize(1280, 720);
parameters.setJpegQuality(100);
// 设置自动闪光灯
List<String> flashModes = parameters.getSupportedFlashModes();
if (flashModes != null && flashModes.contains(Camera.Parameters.FLASH_MODE_AUTO)) {
parameters.setFocusMode(Camera.Parameters.FLASH_MODE_AUTO);
}
// 设置自动对焦
List<String> focusModes = parameters.getSupportedFocusModes();
if (focusModes != null && focusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)) {
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
}
mCamera.setParameters(parameters);
}
Thank you for your feedback!
@mangoxxx
Thankyou so much @uestccokey
For landcape - I am using
parameters.set("orientation", "landscape"); mCamera.setDisplayOrientation(0); mRenderView.setRotate90Degrees(1);
But When i am switching camera then it is rotating camera preview.
Please Help
When you switch camera you can mRenderView.setRotate90Degrees(0); or any rotation you want
@mangoxxx Change activity orientation on manifest, 100% works
When i am trying to use camera1 in landscape mode then view is stretching . Please check this asap