cannot change AVCaptureVideoDataOutput orientation

时光毁灭记忆、已成空白 提交于 2019-12-24 10:54:08

问题


I have a project to use front camera in LandscapeRight orientation for remote communication. when I use the front camera,I need it to work at Landscape orientation,the remote one can get the clear graphs in landscape orientation.I use the following function to changes output orientation of local one and it indeed works in ios5 and 6,but I encountered inverted orientation in my iphone (ios 4.3.3).I don't know why?Does anyone encountered the same problem??

here is the .h file

@interface CameraManager : NSObject <AVCaptureVideoDataOutputSampleBufferDelegate> {
AVCaptureSession * session;
AVCaptureVideoDataOutput * videoOutput;
AVCaptureDeviceInput * videoInput;
}


@property (retain) AVCaptureVideoDataOutput *videoOutput;
@property (retain) AVCaptureDeviceInput *videoInput;
@property (retain) AVCaptureVideoPreviewLayer *previewLayer;
@property (nonatomic) AVCaptureVideoOrientation videoOrientation;
@end

here is the partial code

- (void)setFrontCameraChangeOrientation {

for (AVCaptureConnection *connection in videoOutput.connections)
    if (connection.supportsVideoOrientation && connection.videoOrientation != AVCaptureVideoOrientationLandscapeRight)
            [connection setVideoOrientation:AVCaptureVideoOrientationLandscapeRight];

来源:https://stackoverflow.com/questions/16745771/cannot-change-avcapturevideodataoutput-orientation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!