How to display preview in portrait mode?

All your problems with Audio, Video and Images.

How to display preview in portrait mode?

Postby Draffodx » Tue Oct 05, 2010 5:19 pm

I am using a Preview to display what the camera see's on the screen.

I can get everything working fine, surface created, surface set and the surface is displayed.

However it always displays the picture at an incorrect 90 degree angle in portrait mode.

Such as in the picture:

Image

I am aware that using the following code will set the picture straight:

Code: Select all
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);


However I have the Preview within an Activity that has other elements in it and it does not make sense for my Activity to be displayed in landscape mode. (Its disabled by default)

So I was wondering is there anyway to just change the orientation of the Preview? And leave the rest of my Activity correctly displayed in Portrait mode?

Or anyway to rotate the preview so that it is displayed correctly?
Draffodx
Master Developer
Master Developer
 
Posts: 205
Joined: Wed Nov 12, 2008 2:31 pm

Top

Re: How to display preview in portrait mode?

Postby J_R » Tue Oct 12, 2010 4:27 pm

I've got the same problem. Also weird and annoying: the behaviour of camera preview seems to depend on the device. On my HTC Wildfire it actually works OK, I have set setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

...and the preview comes out portrait. But on a Droid it has the preview the wrong way round and on a Hero it doubles up the preview.
http://www.staircase3.com
J_R
Developer
Developer
 
Posts: 32
Joined: Fri Jan 22, 2010 12:37 am

Re: How to display preview in portrait mode?

Postby izeko » Fri Oct 15, 2010 1:42 pm

Hi,

Do you guys know how to stop the preview from looking squashed. As i am overlaying an image, but when it saves it is in a different place to where it was in the preview. This is because the preview look squashed.
Thanks
izeko
Freshman
Freshman
 
Posts: 9
Joined: Mon Oct 11, 2010 11:46 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 21 guests