2015-06-11 104 views
0

我的應用程序在常規 - >設備方向設置中被鎖定到肖像模式。IOS:在橫向模式下使用avcam進行視頻錄製?

我正在使用AVCam錄製視頻,我想錄制橫向和縱向視頻。

我試圖用下面的方法,也我已經嘗試了幾個方法,但它不能幫助:

當設備旋轉時,我已經設置了預覽層取向和開始錄製的視頻。

[[(AVCaptureVideoPreviewLayer *)[[self previewView] layer] connection] setVideoOrientation:(AVCaptureVideoOrientation)toInterfaceOrientation]; 

回答

1

在開始錄製視頻時設置當前的設備方向。

// Update the orientation on the movie file output video connection before starting recording. 

[[[self movieFileOutput] connectionWithMediaType:AVMediaTypeVideo] setVideoOrientation:(AVCaptureVideoOrientation)[UIDevice currentDevice].orientation]; 
0

在開始記錄之前設置視頻輸出連接的視頻方向。

夫特3

videoOutput.connection(withMediaType: AVMediaTypeVideo).videoOrientation = AVCaptureVideoOrientation(rawValue: UIDevice.current.orientation.rawValue)! 
相關問題