美文网首页
AVCapture - AVCaptureVideoPrevie

AVCapture - AVCaptureVideoPrevie

作者: 木登与木由 | 来源:发表于2019-06-22 16:02 被阅读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;
    }

相关文章

网友评论

      本文标题:AVCapture - AVCaptureVideoPrevie

      本文链接:https://www.haomeiwen.com/subject/tphvqctx.html