Please go through the android developer link:
http://developer.android.com/guide/topics/media/camera.html#capture-video
By default the orientation of camera preview is landscape. Please check this:
Note: A camera preview does not have to be in landscape mode. Starting
in Android 2.2 (API Level 8), you can use the setDisplayOrientation()
method to set the rotation of the preview image. In order to change
preview orientation as the user re-orients the phone, within the
surfaceChanged() method of your preview class, first stop the preview
with Camera.stopPreview() change the orientation and then start the
preview again with Camera.startPreview().
You could also refer to Camera.Parameters.setRotation() for more info.
or you could call mediaRecorder.setOrientationHint(rotation) when recording video.
Also If you want to make the camera image show in the same orientation as the display, you can use the following code.
public static void setCameraDisplayOrientation(Activity activity,
int cameraId, android.hardware.Camera camera) {
android.hardware.Camera.CameraInfo info =
new android.hardware.Camera.CameraInfo();
android.hardware.Camera.getCameraInfo(cameraId, info);
int rotation = activity.getWindowManager().getDefaultDisplay()
.getRotation();
int degrees = 0;
switch (rotation) {
case Surface.ROTATION_0: degrees = 0; break;
case Surface.ROTATION_90: degrees = 90; break;
case Surface.ROTATION_180: degrees = 180; break;
case Surface.ROTATION_270: degrees = 270; break;
}
int result;
if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
result = (info.orientation + degrees) % 360;
result = (360 - result) % 360; // compensate the mirror
} else { // back-facing
result = (info.orientation - degrees + 360) % 360;
}
camera.setDisplayOrientation(result);
}
Its works starting from API level 14, this method can be called when preview is active