From 5198c259cd08c8ddeb574288143f5624f6ac87c6 Mon Sep 17 00:00:00 2001 From: Mattia Iavarone Date: Fri, 4 Aug 2017 22:37:36 +0200 Subject: [PATCH] Fix orientation for videos --- .../main/api16/com/flurgle/camerakit/Camera1.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/camerakit/src/main/api16/com/flurgle/camerakit/Camera1.java b/camerakit/src/main/api16/com/flurgle/camerakit/Camera1.java index 5e909e7b..19f7be13 100644 --- a/camerakit/src/main/api16/com/flurgle/camerakit/Camera1.java +++ b/camerakit/src/main/api16/com/flurgle/camerakit/Camera1.java @@ -150,15 +150,14 @@ class Camera1 extends CameraImpl { if (isCameraOpened()) stop(); if (collectCameraId()) { mCamera = Camera.open(mCameraId); - mCameraListener.dispatchOnCameraOpened(); // Set parameters that might have been set before the camera was opened. synchronized (mLock) { Camera.Parameters params = mCamera.getParameters(); - mergeFocus(params, mFocus); - mergeFlash(params, mFlash); - mergeLocation(params, mLatitude, mLongitude); - mergeWhiteBalance(params, mWhiteBalance); + mergeFocus(params, CameraKit.Defaults.DEFAULT_FOCUS); + mergeFlash(params, CameraKit.Defaults.DEFAULT_FLASH); + mergeLocation(params, 0d, 0d); + mergeWhiteBalance(params, CameraKit.Defaults.DEFAULT_WHITE_BALANCE); params.setRecordingHint(mSessionType == SESSION_TYPE_VIDEO); mCamera.setParameters(params); } @@ -167,6 +166,7 @@ class Camera1 extends CameraImpl { mCamera.setDisplayOrientation(computeSensorToDisplayOffset()); // <- not allowed during preview if (shouldSetup()) setup(); collectExtraProperties(); + mCameraListener.dispatchOnCameraOpened(); } } @@ -596,7 +596,7 @@ class Camera1 extends CameraImpl { mMediaRecorder.setProfile(getCamcorderProfile(mVideoQuality)); mMediaRecorder.setOutputFile(mVideoFile.getAbsolutePath()); - mMediaRecorder.setOrientationHint(computeSensorToDisplayOffset()); // TODO is this correct? Should we use exif orientation? Maybe not. + mMediaRecorder.setOrientationHint(computeExifRotation()); // Not needed. mMediaRecorder.setPreviewDisplay(mPreview.getSurface()); }