开发者

SurfaceView without camera : preview after start rotated on 90 degree

my problem. I create app which do preview from camera on android. For preview while im not press on button - i used Camera , camera.open. When app started - the orientation of screen is normal.. But when i try to record video - i closed camera preview and used only SurfaceView with recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT); It's showing me preview from camera without class Camera. All this i do becouse it's fixed for me bug with greenish screen after recorded. So... this preview(which without camera) he after start always rotated on 90 degree ( Like in mode LANDSCAPE) im try to use

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE );

and

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT );

but it not fixed my problem. So, can any one tell me how to rotate my preview(without camera) in mode like SCREEN_ORIENTATION_PORTRAIT ??

pls tell me how to fix this problem.. i can't fix it 2-3 days :(

Regards, Peter p.s. sorry for my bad english, hope u understand me.

it's code which i used for preview when i recorded video/audio

 preview = new SurfaceView(withPreview.this);
 preview.getHolder();
 holder.addCallback(this);
 holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS );

get picture from camera

recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);

now the screen rotated on 90 degree. if i set

recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);

than image rotated on 开发者_运维百科180 degree О_О

and set preview

recorder.setPreviewDisplay(holder.getSurface());

that's all what i need for camera preview How u can see im not using Camera.. so i can't us camera.parameters.setOrientation(90) //example :]


is it right, that you will fix the Screen Orientation to Landscape or Portrait? Or should it be dynamic? So if i understand you, to fix the orientation of the screen, then i prefer to add this into your Android Manifest:

android:screenOrientation="landscape"

This must inside the activity-block.

Hope this will help, otherwise tell me when it should dynmaic or so on.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜