Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. CGRect layerRect = [[videoStreamView layer] bounds];
  2. [[[self captureManager] previewLayer] setBounds:layerRect];
  3. [[[self captureManager] previewLayer] setPosition:CGPointMake(CGRectGetMidX(layerRect),
  4. CGRectGetMidY(layerRect))];
  5. [[videoStreamView layer] addSublayer:[[self captureManager] previewLayer]];
  6.  
  7. AVCaptureVideoPreviewLayer *newCaptureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:[self.captureManager session]];
  8. newCaptureVideoPreviewLayer.frame = bounds;//CGRectMake(bounds.origin.x, bounds.origin.y, bounds.size.height, bounds.size.width);
  9.  
  10. @property (nonatomic, retain) AVCaptureVideoPreviewLayer *prevLayer;
  11.  
  12. self.prevLayer = [AVCaptureVideoPreviewLayer layerWithSession: self.captureSession];
  13. self.prevLayer.frame = yourRect;
  14. [self.view.layer addSublayer: self.prevLayer];
  15.  
  16. CGRect bounds = view.layer.bounds;
  17. previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
  18. previewLayer.bounds=bounds;
  19. previewLayer.position=CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement