0

[全般] -> [デバイスの向き] 設定でアプリが縦向きモードにロックされています。

AVCam を使用してビデオを録画していますが、横向きと縦向きの両方のビデオを録画したいと考えています。

私は以下のアプローチを試しましたが、さらにいくつかのアプローチを試しましたが、それは役に立ちません:

デバイスが回転すると、プレビュー レイヤーの向きを設定し、ビデオの録画を開始します。

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

2 に答える 2

2

ビデオの録画を開始しながら、現在のデバイスの向きを設定します。

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

[[[self movieFileOutput] connectionWithMediaType:AVMediaTypeVideo] setVideoOrientation:(AVCaptureVideoOrientation)[UIDevice currentDevice].orientation];
于 2015-06-15T10:09:28.663 に答える
0

録画を開始する前に、ビデオ出力接続のビデオ方向を設定します。

スイフト3

videoOutput.connection(withMediaType: AVMediaTypeVideo).videoOrientation = AVCaptureVideoOrientation(rawValue: UIDevice.current.orientation.rawValue)!
于 2017-03-23T12:49:43.550 に答える