Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/AVFoundation.framework |
Availability | Available in iOS 4.0 and later. |
Declared in | AVCaptureVideoPreviewLayer.h |
AVCaptureVideoPreviewLayer
is a subclass of CALayer
that allows you use to display video as it is being captured by an input device.
You use this preview layer in conjunction with an AV capture session, as illustrated in the following code fragment:
AVCaptureSession *captureSession = <#Get a capture session#>; |
AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:captureSession]; |
UIView *aView = <#The view in which to present the layer#>; |
previewLayer.frame = aView.bounds; // Assume you want the preview layer to fill the view. |
[aView.layer addSublayer:previewLayer]; |
orientation
property
orientationSupported
property
mirrored
property
mirroringSupported
property
automaticallyAdjustsMirroring
property
videoGravity
property
session
property
For more about Objective-C properties, see “Properties” in The Objective-C Programming Language.
Indicates whether the layer display automatically adjusts mirroring.
@property(nonatomic) BOOL automaticallyAdjustsMirroring
The default value is YES
.
AVCaptureVideoPreviewLayer.h
Indicates whether the layer display is mirrored.
@property(nonatomic, getter=isMirrored) BOOL mirrored
To change the value of this property, the value of automaticallyAdjustsMirroring
must be NO
.
AVCaptureVideoPreviewLayer.h
Indicates whether the layer display supports mirroring. (read-only)
@property(nonatomic, readonly, getter=isMirroringSupported) BOOL mirroringSupported
AVCaptureVideoPreviewLayer.h
The layer’s orientation.
@property(nonatomic) AVCaptureVideoOrientation orientation
AVCaptureVideoPreviewLayer.h
Indicates whether the layer display supports changing the orientation. (read-only)
@property(nonatomic, readonly, getter=isOrientationSupported) BOOL orientationSupported
AVCaptureVideoPreviewLayer.h
The capture session with which the layer is associated.
@property(nonatomic, retain) AVCaptureSession *session
AVCaptureVideoPreviewLayer.h
Indicates how the video is displayed within a player layer’s bounds rect.
@property(copy) NSString *videoGravity
Options are AVLayerVideoGravityResizeAspect
, AVLayerVideoGravityResizeAspectFill
and AVLayerVideoGravityResize
. The default is AVLayerVideoGravityResizeAspect
.
AVCaptureVideoPreviewLayer.h
Returns a preview layer initialized with a given capture session.
+ (id)layerWithSession:(AVCaptureSession *)session
The capture session from which to derive the preview.
A preview layer initialized to use session.
AVCaptureVideoPreviewLayer.h
Initializes a preview layer with a given capture session.
- (id)initWithSession:(AVCaptureSession *)session
The capture session from which to derive the preview.
A preview layer initialized to use session.
AVCaptureVideoPreviewLayer.h
Last updated: 2010-05-15