Search code examples
androidorientationandroid-cameralandscapescreen-rotation

Android Front Camera recording video but plays upside down...!


I have managed to create an android application to record videos but the problem is with the orientation of front camera video . The output is not the as per requirements . It gets automatically rotated .

Application orientation is landscape . So, I need to record using front cam in landscape mode.

Nothing is working out .


Solution

  • You might want to look at how the AOSP VideoCamera activity is implementing this:

        if (info.facing == CameraInfo.CAMERA_FACING_FRONT) {
            rotation = (info.orientation - mOrientation + 360) % 360;
        } else {  // back-facing camera
            rotation = (info.orientation + mOrientation) % 360;
        }
    

    There are some more details in my answer for another question here.