Class

AVCaptureConnection

A connection between a specific pair of capture input and capture output objects in a capture session.

Overview

Capture inputs (instances of AVCaptureInput) have one or more input ports (instances of AVCaptureInput.Port). Capture outputs (instances of AVCaptureOutput) can accept data from one or more sources (for example, an AVCaptureMovieFileOutput object accepts both video and audio data).

You can add an AVCaptureConnection instance to a session using the add(_:) method only if the canAdd(_:) method returns true. When using the addInput(_:) or addOutput(_:) method, connections are formed automatically between all compatible inputs and outputs. You only need to add connections manually when adding an input or output with no connections. You can also use connections to enable or disable the flow of data from a given input or to a given output.

Topics

Creating a Connection

init(inputPorts: [AVCaptureInput.Port], output: AVCaptureOutput)

Initializes a capture connection to describe a connection between the specified input ports and the specified output.

init(inputPort: AVCaptureInput.Port, videoPreviewLayer: AVCaptureVideoPreviewLayer)

Initializes a capture connection to describe a connection between the specified input port and the specified video preview layer.

Configuration

var isEnabled: Bool

Indicates whether the connection is enabled.

var isActive: Bool

Indicates whether the connection is active.

var inputPorts: [AVCaptureInput.Port]

The connection’s input ports.

var output: AVCaptureOutput

The connection’s output port.

var videoPreviewLayer: AVCaptureVideoPreviewLayer

The video preview layer associated with the connection.

Managing Video Configuration

var isVideoOrientationSupported: Bool

A Boolean value that indicates whether the connection supports changing the orientation of the video.

var videoFieldMode: AVVideoFieldMode

An indicator of how interlaced video flowing through the connection should be treated

var isVideoFieldModeSupported: Bool

A Boolean value that indicates whether the connection supports setting the videoFieldMode property.

var videoMinFrameDuration: CMTime

The minimum time interval between which the receiver should output consecutive video frames.

var isVideoMinFrameDurationSupported: Bool

A Boolean value that indicates whether the connection supports setting the videoMinFrameDuration property.

var videoMaxFrameDuration: CMTime

The maximum time interval between which the receiver should output consecutive video frames.

var isVideoMaxFrameDurationSupported: Bool

A Boolean value that indicates whether the connection supports setting the videoMaxFrameDuration property.

var videoScaleAndCropFactor: CGFloat

The current video scale and crop factor in use by the receiver.

var videoMaxScaleAndCropFactor: CGFloat

The maximum video scale and crop factor by the connection.

Managing the Video Mirroring Settings

var automaticallyAdjustsVideoMirroring: Bool

A Boolean value that indicates whether the value of isVideoMirrored can change based on configuration of the session.

var isVideoMirroringSupported: Bool

A Boolean value that indicates whether the connection supports video mirroring.

var isVideoMirrored: Bool

A Boolean value that indicates whether the video flowing through the connection should be mirrored about its vertical axis..

Managing the Video Stabilization Settings

var isVideoStabilizationSupported: Bool

A Boolean value that indicates whether this connection supports video stabilization.

var activeVideoStabilizationMode: AVCaptureVideoStabilizationMode

The stabilization mode currently active for the connection.

var preferredVideoStabilizationMode: AVCaptureVideoStabilizationMode

The stabilization mode most appropriate for use with the connection.

var isVideoStabilizationEnabled: Bool

A Boolean value that indicates whether video stabilization is active for the connection.

Deprecated
var enablesVideoStabilizationWhenAvailable: Bool

A Boolean value that indicates whether the system should enable video stabilization when it is available.

Deprecated

Managing Camera Calibration Delivery Settings

var isCameraIntrinsicMatrixDeliverySupported: Bool

A Boolean value indicating whether the capture connection currently supports delivery of camera intrinsics information.

Beta
var isCameraIntrinsicMatrixDeliveryEnabled: Bool

A Boolean value that specifies whether to configure the capture pipeline for delivery of camera intrinsics information.

Beta

Constants

enum AVCaptureVideoOrientation

Constants indicating video orientation.

enum AVVideoFieldMode

Constants indicating video field mode, for use with the videoFieldMode property.

Relationships

Inherits From

Conforms To

See Also

Session Configuration

class AVCaptureInput

The abstract superclass for objects that provide input data to a capture session.

class AVCaptureOutput

The abstract superclass for objects that output the media recorded in a capture session.

class AVCaptureDeviceInput

A capture input that provides media from a capture device to a capture session.

class AVCaptureAudioChannel

An object that monitors average and peak power levels for an audio channel in a capture connection.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software