2014-10-09 8 views

ответ

0

При настройке камеры, у вас есть AVCaptureVideoDataOutput videoDataOutput, и AVCaptureVideoPreviewLayer previewLayer. Вы можете настроить их следующим образом.

//set the orientation of previewlayer, which is presented to user 
AVCaptureConnection *conncetion = self.previewLayer.connection; 
conncetion.videoOrientation = AVCaptureVideoOrientationLandscapeRight; 

//set the output frame orientation 
AVCaptureConnection *conn = [self.videoDataOutput connectionWithMediaType:AVMediaTypeVideo]; 
conn.videoOrientation = AVCaptureVideoOrientationLandscapeRight; 

В коде образца AVCam при записи и сохранении в виде файла. Выше две установлены в ту же ориентацию, что interfaceOrientation ViewController в:

[[[self movieFileOutput] connectionWithMediaType:AVMediaTypeVideo] setVideoOrientation:[[(AVCaptureVideoPreviewLayer *)[[self previewView] layer] connection] videoOrientation]]; 

И он отмечает ориентацию устройства, что приятно.

Смежные вопросы