-1

I am using Media Recorder for recording ,Can Anyone has idea how can to apply Logic? Right now Video recording is happening in Landscape always but it doesn't capturing right orientation ,screen also get rotated

private Camera.Size getBestPreviewSize(int width, int height,
                                       Camera.Parameters parameters) {
    Camera.Size result = null;

    for (Camera.Size size : parameters.getSupportedPreviewSizes()) {
        if (size.width <= width && size.height <= height) {
            if (result == null) {
                result = size;
            } else {
                int resultArea = result.width * result.height;
                int newArea = size.width * size.height;

                if (newArea > resultArea) {
                    result = size;
                }
            }
        }
    }

    return (result);
}
Richa Shah
  • 930
  • 3
  • 12
  • 27

1 Answers1

1

Check setRotation method of camera parameter. If you don't use this one then you can try with mediaRecorder.setOrientationHint(rotation)(only changes the orientation of the output video, not the orientation of the preview if you want to forcefully preview to landscape then Camera.setDisplayOrientation(rotation)) while recording your video.

Sanjay Bhalani
  • 2,424
  • 18
  • 44