Class: AVCaptureVideoPreviewLayer

Inherits:
CALayer show all

Overview

AVCaptureVideoPreviewLayer is a subclass of CALayer that you use to display video as it is being captured by an input device.

Instance Attribute Summary (collapse)

Attributes inherited from CALayer

#actions, #anchorPoint, #anchorPointZ, #backgroundColor, #backgroundFilters, #borderColor, #borderWidth, #bounds, #compositingFilter, #contents, #contentsCenter, #contentsGravity, #contentsRect, #contentsScale, #cornerRadius, #delegate, #doubleSided, #drawsAsynchronously, #edgeAntialiasingMask, #filters, #frame, #geometryFlipped, #hidden, #magnificationFilter, #mask, #masksToBounds, #minificationFilter, #minificationFilterBias, #name, #needsDisplayOnBoundsChange, #opacity, #opaque, #position, #rasterizationScale, #shadowColor, #shadowOffset, #shadowOpacity, #shadowPath, #shadowRadius, #shouldRasterize, #style, #sublayerTransform, #sublayers, #superlayer, #transform, #visibleRect, #zPosition

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from CALayer

#actionForKey:, #addAnimation:forKey:, #addSublayer:, #affineTransform, #animationForKey:, #animationKeys, #containsPoint:, #contentsAreFlipped, #convertPoint:fromLayer:, #convertPoint:toLayer:, #convertRect:fromLayer:, #convertRect:toLayer:, #convertTime:fromLayer:, #convertTime:toLayer:, defaultActionForKey:, defaultValueForKey:, #display, #displayIfNeeded, #drawInContext:, #hitTest:, #init, #initWithLayer:, #insertSublayer:above:, #insertSublayer:atIndex:, #insertSublayer:below:, layer, #layoutIfNeeded, #layoutSublayers, #modelLayer, #needsDisplay, needsDisplayForKey:, #needsLayout, #preferredFrameSize, #presentationLayer, #removeAllAnimations, #removeAnimationForKey:, #removeFromSuperlayer, #renderInContext:, #replaceSublayer:with:, #scrollPoint:, #scrollRectToVisible:, #setAffineTransform:, #setNeedsDisplay, #setNeedsDisplayInRect:, #setNeedsLayout, #shouldArchiveValueForKey:

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Instance Attribute Details

- (AVCaptureConnection) connection (readonly)

The capture connection describing the AVCaptureInputPort to which the preview layer is connected. (read-only) If you invoke initWithSession:, layerWithSession:, or setSession: (see session) with a valid AVCaptureSession instance, a connection is formed to the first eligible video AVCaptureInput object. If the preview layer is detached from a session, the connection property becomes nil.

Returns:

- (AVCaptureSession) session

The capture session instance being previewed.

Returns:

- (String) videoGravity

Indicates how the video is displayed within a player layer’s bounds rect. Options are AVLayerVideoGravityResizeAspect, AVLayerVideoGravityResizeAspectFill and AVLayerVideoGravityResize. The default is AVLayerVideoGravityResizeAspect.This property is animatable.

Returns:

Class Method Details

+ (Object) layerWithSession(session)

Returns a preview layer initialized with a given capture session.

Parameters:

  • session (AVCaptureSession)

    The capture session from which to derive the preview.

Returns:

  • (Object)

    A preview layer initialized to use session.

Instance Method Details

- (CGPoint) captureDevicePointOfInterestForPoint(pointInLayer)

Converts a point from layer coordinates to the coordinate space of the capture device. The coordinates in the point structure returned by this method are in the range 0.0 to 1.0. The point (0.0, 0.0) corresponds to the top left corner of the unrotated picture and the point (1.0, 1.0) represents the bottom right corner of the unrotated picture. The conversion performed by this method takes the layer’s frame size and the receiver’s videoGravity property into consideration.

Parameters:

  • pointInLayer (CGPoint)

    A point in the coordinate system of this layer object. The coordinates of this point represent pixel values.

Returns:

  • (CGPoint)

    A scalar point whose coordinates are relative to the coordinate system of the capture device that is providing input to the layer.

- (Object) initWithSession(session)

Initializes a preview layer with a given capture session.

Parameters:

  • session (AVCaptureSession)

    The capture session from which to derive the preview.

Returns:

  • (Object)

    A preview layer initialized to use session.

- (CGPoint) pointForCaptureDevicePointOfInterest(captureDevicePointOfInterest)

Converts a point from the coordinate space of the capture device to the coordinate space of the layer. The conversion performed by this method takes the layer’s frame size and the receiver’s videoGravity property into consideration.

Parameters:

  • captureDevicePointOfInterest (CGPoint)

    A scalar point whose coordinates are relative to the coordinate system of the capture device that is providing input to the layer. The coordinates in this point must be in the range 0.0 to 1.0, where the point (0.0, 0.0) corresponds to the top left corner of the unrotated picture and the point (1.0, 1.0) represents the bottom right corner of the unrotated picture.

Returns:

  • (CGPoint)

    A point in the coordinate system of this layer object. The coordinates of this point represent pixel values.

- (AVMetadataObject) transformedMetadataObjectForMetadataObject(metadataObject)

Converts a metadata object’s visual properties to layer coordinates. An AVMetadataObject’s bounds may be expressed as a rect, where an origin point of (0.0, 0.0) represents the top-left corner of an unrotated picture and (1.0, 1.0) represents the bottom-right corner of an unrotated picture. Face metadata objects also express a yaw and roll angle with respect to an unrotated picture. This method converts all of the metadata object’s visual properties to the coordinate space of the receiver, taking into account orientation, mirroring, layer bounds and videoGravity.

Parameters:

  • metadataObject (AVMetadataObject)

    The metadata object whose visual properties you want to convert. The metadata object must originate from the same AVCaptureInput as the preview layer.

Returns:

  • (AVMetadataObject)

    A metadata object whose visual properties have been converted into layer coordinates, or nil if the metadataObject originates from an input source other than that of the preview layer.