问题
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