Class AVCaptureVideoPreviewLayer

  • All Implemented Interfaces:
    NSCoding, NSSecureCoding, NSObject, CAMediaTiming

    public class AVCaptureVideoPreviewLayer
    extends CALayer
    AVCaptureVideoPreviewLayer A CoreAnimation layer subclass for previewing the visual output of an AVCaptureSession. An AVCaptureVideoPreviewLayer instance is a subclass of CALayer and is therefore suitable for insertion in a layer hierarchy as part of a graphical interface. One creates an AVCaptureVideoPreviewLayer instance with the capture session to be previewed, using +layerWithSession: or -initWithSession:. Using the @"videoGravity" property, one can influence how content is viewed relative to the layer bounds. On some hardware configurations, the orientation of the layer can be manipulated using @"orientation" and @"mirrored".
    • Constructor Detail

      • AVCaptureVideoPreviewLayer

        protected AVCaptureVideoPreviewLayer​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(java.lang.Object aTarget,
                                                                                 org.moe.natj.objc.SEL aSelector,
                                                                                 java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        public static org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • defaultActionForKey

        public static CAAction defaultActionForKey​(java.lang.String event)
      • defaultValueForKey

        public static java.lang.Object defaultValueForKey​(java.lang.String key)
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • layerWithSession

        public static AVCaptureVideoPreviewLayer layerWithSession​(AVCaptureSession session)
        layerWithSession: Creates an AVCaptureVideoPreviewLayer for previewing the visual output of the specified AVCaptureSession.
        Parameters:
        session - The AVCaptureSession instance to be previewed.
        Returns:
        A newly initialized AVCaptureVideoPreviewLayer instance.
      • layerWithSessionWithNoConnection

        public static AVCaptureVideoPreviewLayer layerWithSessionWithNoConnection​(AVCaptureSession session)
        layerWithSessionWithNoConnection: Creates an AVCaptureVideoPreviewLayer for previewing the visual output of the specified AVCaptureSession, but creates no connections to any of the session's eligible video inputs. Only use this initializer if you intend to manually form a connection between a desired AVCaptureInputPort and the receiver using AVCaptureSession's -addConnection: method.
        Parameters:
        session - The AVCaptureSession instance to be previewed.
        Returns:
        A newly initialized AVCaptureVideoPreviewLayer instance.
      • needsDisplayForKey

        public static boolean needsDisplayForKey​(java.lang.String key)
      • new_objc

        public static java.lang.Object new_objc()
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • automaticallyAdjustsMirroring

        @Deprecated
        public boolean automaticallyAdjustsMirroring()
        Deprecated.
        [@property] automaticallyAdjustsMirroring Specifies whether or not the value of @"mirrored" can change based on configuration of the session. For some session configurations, preview will be mirrored by default. When the value of this property is YES, the value of @"mirrored" may change depending on the configuration of the session, for example after switching to a different AVCaptureDeviceInput. The default value is YES. This property is deprecated. Use AVCaptureConnection's -automaticallyAdjustsVideoMirroring instead.
      • captureDevicePointOfInterestForPoint

        public CGPoint captureDevicePointOfInterestForPoint​(CGPoint pointInLayer)
        captureDevicePointOfInterestForPoint: Converts a point in layer coordinates to a point of interest in the coordinate space of the capture device providing input to the layer. AVCaptureDevice pointOfInterest is expressed as a CGPoint where {0,0} represents the top left of the picture area, and {1,1} represents the bottom right on an unrotated picture. This convenience method converts a point in the coordinate space of the receiver to a point of interest in the coordinate space of the AVCaptureDevice providing input to the receiver. The conversion takes frameSize and videoGravity into consideration.
        Parameters:
        pointInLayer - A CGPoint in layer coordinates.
        Returns:
        A CGPoint in the coordinate space of the capture device providing input to the layer.
      • connection

        public AVCaptureConnection connection()
        [@property] connection The AVCaptureConnection instance describing the AVCaptureInputPort to which the receiver is connected. When calling initWithSession: or setSession: with a valid AVCaptureSession instance, a connection is formed to the first eligible video AVCaptureInput. If the receiver is detached from a session, the connection property becomes nil.
      • initWithLayer

        public AVCaptureVideoPreviewLayer initWithLayer​(java.lang.Object layer)
        Description copied from class: CALayer
        This initializer is used by CoreAnimation to create shadow copies of layers, e.g. for use as presentation layers. Subclasses can override this method to copy their instance variables into the presentation layer (subclasses should call the superclass afterwards). Calling this method in any other situation will result in undefined behavior.
        Overrides:
        initWithLayer in class CALayer
      • initWithSession

        public AVCaptureVideoPreviewLayer initWithSession​(AVCaptureSession session)
        initWithSession: Creates an AVCaptureVideoPreviewLayer for previewing the visual output of the specified AVCaptureSession.
        Parameters:
        session - The AVCaptureSession instance to be previewed.
        Returns:
        A newly initialized AVCaptureVideoPreviewLayer instance.
      • initWithSessionWithNoConnection

        public AVCaptureVideoPreviewLayer initWithSessionWithNoConnection​(AVCaptureSession session)
        initWithSessionWithNoConnection: Creates an AVCaptureVideoPreviewLayer for previewing the visual output of the specified AVCaptureSession, but creates no connections to any of the session's eligible video inputs. Only use this initializer if you intend to manually form a connection between a desired AVCaptureInputPort and the receiver using AVCaptureSession's -addConnection: method.
        Parameters:
        session - The AVCaptureSession instance to be previewed.
        Returns:
        A newly initialized AVCaptureVideoPreviewLayer instance.
      • isMirrored

        @Deprecated
        public boolean isMirrored()
        Deprecated.
        [@property] mirrored Specifies whether or not the preview is flipped over a vertical axis. For most applications, it is unnecessary to manipulate preview mirroring manually if @"automaticallyAdjustsMirroring" is set to YES. The value of @"automaticallyAdjustsMirroring" must be NO in order to set @"mirrored". The value of @"mirroringSupported" must be YES in order to set @"mirrored". An exception will be raised if the value of @"mirrored" is mutated without respecting these requirements. This property is deprecated. Use AVCaptureConnection's -videoMirrored instead.
      • setMirrored

        @Deprecated
        public void setMirrored​(boolean value)
        Deprecated.
        [@property] mirrored Specifies whether or not the preview is flipped over a vertical axis. For most applications, it is unnecessary to manipulate preview mirroring manually if @"automaticallyAdjustsMirroring" is set to YES. The value of @"automaticallyAdjustsMirroring" must be NO in order to set @"mirrored". The value of @"mirroringSupported" must be YES in order to set @"mirrored". An exception will be raised if the value of @"mirrored" is mutated without respecting these requirements. This property is deprecated. Use AVCaptureConnection's -videoMirrored instead.
      • isMirroringSupported

        @Deprecated
        public boolean isMirroringSupported()
        Deprecated.
        [@property] mirroringSupported Specifies whether or not the preview layer supports mirroring. Mirroring is not supported on all hardware configurations. An application should check the value of @"mirroringSupported" before attempting to manipulate mirroring on the receiver. This property is deprecated. Use AVCaptureConnection's -isVideoMirroringSupported instead.
      • isOrientationSupported

        @Deprecated
        public boolean isOrientationSupported()
        Deprecated.
        [@property] orientationSupported Specifies whether or not the preview layer supports orientation. Changes in orientation are not supported on all hardware configurations. An application should check the value of @"orientationSupported" before attempting to manipulate the orientation of the receiver. This property is deprecated. Use AVCaptureConnection's -isVideoOrientationSupported instead.
      • metadataOutputRectOfInterestForRect

        public CGRect metadataOutputRectOfInterestForRect​(CGRect rectInLayerCoordinates)
        metadataOutputRectOfInterestForRect: Converts a rectangle in layer coordinates to a rectangle of interest in the coordinate space of an AVCaptureMetadataOutput whose capture device is providing input to the layer. AVCaptureMetadataOutput rectOfInterest is expressed as a CGRect where {0,0} represents the top left of the picture area, and {1,1} represents the bottom right on an unrotated picture. This convenience method converts a rectangle in the coordinate space of the receiver to a rectangle of interest in the coordinate space of an AVCaptureMetadataOutput whose AVCaptureDevice is providing input to the receiver. The conversion takes frame size and videoGravity into consideration.
        Parameters:
        rectInLayerCoordinates - A CGRect in layer coordinates.
        Returns:
        A CGRect in the coordinate space of the metadata output whose capture device is providing input to the layer.
      • orientation

        @Deprecated
        public long orientation()
        Deprecated.
        [@property] orientation Specifies the orientation of the preview layer. AVCaptureVideoOrientation and its constants are defined in AVCaptureSession.h. The value of @"orientationSupported" must be YES in order to set @"orientation". An exception will be raised if this requirement is ignored. This property is deprecated. Use AVCaptureConnection's -videoOrientation instead.
      • pointForCaptureDevicePointOfInterest

        public CGPoint pointForCaptureDevicePointOfInterest​(CGPoint captureDevicePointOfInterest)
        pointForCaptureDevicePointOfInterest: Converts a point of interest in the coordinate space of the capture device providing input to the layer to a point in layer coordinates. AVCaptureDevice pointOfInterest is expressed as a CGPoint where {0,0} represents the top left of the picture area, and {1,1} represents the bottom right on an unrotated picture. This convenience method converts a point in the coordinate space of the AVCaptureDevice providing input to the coordinate space of the receiver. The conversion takes frame size and videoGravity into consideration.
        Parameters:
        captureDevicePointOfInterest - A CGPoint in the coordinate space of the capture device providing input to the layer.
        Returns:
        A CGPoint in layer coordinates.
      • rectForMetadataOutputRectOfInterest

        public CGRect rectForMetadataOutputRectOfInterest​(CGRect rectInMetadataOutputCoordinates)
        rectForMetadataOutputRectOfInterest: Converts a rectangle of interest in the coordinate space of an AVCaptureMetadataOutput whose capture device is providing input to the layer to a rectangle in layer coordinates. AVCaptureMetadataOutput rectOfInterest is expressed as a CGRect where {0,0} represents the top left of the picture area, and {1,1} represents the bottom right on an unrotated picture. This convenience method converts a rectangle in the coordinate space of an AVCaptureMetadataOutput whose AVCaptureDevice is providing input to the coordinate space of the receiver. The conversion takes frame size and videoGravity into consideration.
        Parameters:
        rectInMetadataOutputCoordinates - A CGRect in the coordinate space of the metadata output whose capture device is providing input to the layer.
        Returns:
        A CGRect in layer coordinates.
      • session

        public AVCaptureSession session()
        [@property] session The AVCaptureSession instance being previewed by the receiver. The session is retained by the preview layer.
      • setAutomaticallyAdjustsMirroring

        @Deprecated
        public void setAutomaticallyAdjustsMirroring​(boolean value)
        Deprecated.
        [@property] automaticallyAdjustsMirroring Specifies whether or not the value of @"mirrored" can change based on configuration of the session. For some session configurations, preview will be mirrored by default. When the value of this property is YES, the value of @"mirrored" may change depending on the configuration of the session, for example after switching to a different AVCaptureDeviceInput. The default value is YES. This property is deprecated. Use AVCaptureConnection's -automaticallyAdjustsVideoMirroring instead.
      • setOrientation

        @Deprecated
        public void setOrientation​(long value)
        Deprecated.
        [@property] orientation Specifies the orientation of the preview layer. AVCaptureVideoOrientation and its constants are defined in AVCaptureSession.h. The value of @"orientationSupported" must be YES in order to set @"orientation". An exception will be raised if this requirement is ignored. This property is deprecated. Use AVCaptureConnection's -videoOrientation instead.
      • setSession

        public void setSession​(AVCaptureSession value)
        [@property] session The AVCaptureSession instance being previewed by the receiver. The session is retained by the preview layer.
      • setSessionWithNoConnection

        public void setSessionWithNoConnection​(AVCaptureSession session)
        method setSessionWithNoConnection: Attaches the receiver to a given session without implicitly forming a connection to the first eligible video AVCaptureInputPort. Only use this setter if you intend to manually form a connection between a desired AVCaptureInputPort and the receiver using AVCaptureSession's -addConnection: method. The session is retained by the preview layer.
      • setVideoGravity

        public void setVideoGravity​(java.lang.String value)
        [@property] videoGravity A string defining how the video is displayed within an AVCaptureVideoPreviewLayer bounds rect. Options are AVLayerVideoGravityResize, AVLayerVideoGravityResizeAspect and AVLayerVideoGravityResizeAspectFill. AVLayerVideoGravityResizeAspect is default. See for a description of these options.
      • transformedMetadataObjectForMetadataObject

        public AVMetadataObject transformedMetadataObjectForMetadataObject​(AVMetadataObject metadataObject)
        transformedMetadataObjectForMetadataObject: Converts an AVMetadataObject's visual properties to layer coordinates. AVMetadataObject bounds may be expressed as a rect where {0,0} represents the top left of the picture area, and {1,1} represents the bottom right on an unrotated picture. Face metadata objects likewise express yaw and roll angles with respect to an unrotated picture. -transformedMetadataObjectForMetadataObject: converts the visual properties in the coordinate space of the supplied AVMetadataObject to the coordinate space of the receiver. The conversion takes orientation, mirroring, layer bounds and videoGravity into consideration. If the provided metadata object originates from an input source other than the preview layer's, nil will be returned.
        Parameters:
        metadataObject - An AVMetadataObject originating from the same AVCaptureInput as the preview layer.
        Returns:
        An AVMetadataObject whose properties are in layer coordinates.
      • videoGravity

        public java.lang.String videoGravity()
        [@property] videoGravity A string defining how the video is displayed within an AVCaptureVideoPreviewLayer bounds rect. Options are AVLayerVideoGravityResize, AVLayerVideoGravityResizeAspect and AVLayerVideoGravityResizeAspectFill. AVLayerVideoGravityResizeAspect is default. See for a description of these options.
      • supportsSecureCoding

        public static boolean supportsSecureCoding()
      • _supportsSecureCoding

        public boolean _supportsSecureCoding()
        Description copied from interface: NSSecureCoding
        This property must return YES on all classes that allow secure coding. Subclasses of classes that adopt NSSecureCoding and override initWithCoder: must also override this method and return YES. The Secure Coding Guide should be consulted when writing methods that decode data.
        Specified by:
        _supportsSecureCoding in interface NSSecureCoding
        Overrides:
        _supportsSecureCoding in class CALayer
      • cornerCurveExpansionFactor

        public static double cornerCurveExpansionFactor​(java.lang.String curve)
      • isPreviewing

        public boolean isPreviewing()
        [@property] previewing A BOOL value indicating whether the receiver is currently rendering video frames from its source. An AVCaptureVideoPreviewLayer begins previewing when -[AVCaptureSession startRunning] is called. When associated with an AVCaptureMultiCamSession, all video preview layers are guaranteed to be previewing by the time the blocking call to -startRunning or -commitConfiguration returns. While a session is running, you may enable or disable a video preview layer's connection to re-start or stop the flow of video to the layer. Once you've set enabled to YES, you can observe this property changing from NO to YES and synchronize any UI to take place precisely when the video resumes rendering to the video preview layer.