AVCapture - AVCaptureVideoPrevie

2019-06-22  本文已影响0人  木登与木由
iPad横屏应用 时 图像旋转了90度
AVCaptureVideoPreviewLayer * layer = [AVCaptureVideoPreviewLayer layerWithSession:session];
    layer.videoGravity=AVLayerVideoGravityResizeAspectFill;
    UIInterfaceOrientation interfaceOrientation = [UIApplication sharedApplication].statusBarOrientation;
    if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft){
         layer.orientation = UIInterfaceOrientationLandscapeLeft;
    } else {
         layer.orientation = AVCaptureVideoOrientationLandscapeRight;
    }

这样修改时,图像恢复正常,但是有个警告


layerconnectionvideoOrientation属性

if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft){
         layer.connection.videoOrientation = UIInterfaceOrientationLandscapeLeft;
    } else {
         layer.connection.videoOrientation = AVCaptureVideoOrientationLandscapeRight;
    }
上一篇 下一篇

猜你喜欢

热点阅读