<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVCaptureSession",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVCaptureSession"
  },
  "title" : "AVCaptureSession"
}
-->

# AVCaptureSession

An object that configures capture behavior and coordinates the flow of data from input devices to capture outputs.

```
class AVCaptureSession
```

## Overview

To perform real-time capture, you instantiate a capture session and add appropriate inputs and outputs. The following code fragment illustrates how to configure a capture device to record audio.

```swift
// Create the capture session.
let captureSession = AVCaptureSession()

// Find the default audio device.
guard let audioDevice = AVCaptureDevice.default(for: .audio) else { return }

do {
    // Wrap the audio device in a capture device input.
    let audioInput = try AVCaptureDeviceInput(device: audioDevice)
    // If the input can be added, add it to the session.
    if captureSession.canAddInput(audioInput) {
        captureSession.addInput(audioInput)
    }
} catch {
    // Configuration failed. Handle error.
}
```

Call the [`startRunning()`](/documentation/AVFoundation/AVCaptureSession/startRunning()) method to start the flow of data from the inputs to the outputs, and call the [`stopRunning()`](/documentation/AVFoundation/AVCaptureSession/stopRunning()) method to stop the flow.

> Important:
> The ``doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureSession/startRunning()`` method is a blocking call which can take some time, therefore start the session on a serial dispatch queue so that you don’t block the main queue (which keeps the UI responsive). See <doc://com.apple.avfoundation/documentation/AVFoundation/avcam-building-a-camera-app> for an implementation example.

You use the [`sessionPreset`](/documentation/AVFoundation/AVCaptureSession/sessionPreset) property to customize the quality level, bitrate, or other settings for the output. Most common capture configurations are available through session presets; however, some specialized options (such as high frame rate) require directly setting a capture format on an [`AVCaptureDevice`](/documentation/AVFoundation/AVCaptureDevice) instance.

## Topics

### Configuring a session

[`beginConfiguration()`](/documentation/AVFoundation/AVCaptureSession/beginConfiguration())

Marks the beginning of changes to a running capture session’s configuration to perform in a single atomic update.

[`commitConfiguration()`](/documentation/AVFoundation/AVCaptureSession/commitConfiguration())

Commits one or more changes to a running capture session’s configuration in a single atomic update.

### Setting a session preset

[`AVCaptureSession.Preset`](/documentation/AVFoundation/AVCaptureSession/Preset)

Presets that define standard configurations for a capture session.

[`canSetSessionPreset(_:)`](/documentation/AVFoundation/AVCaptureSession/canSetSessionPreset(_:))

Determines whether you can configure a capture session with the specified preset.

[`sessionPreset`](/documentation/AVFoundation/AVCaptureSession/sessionPreset)

A preset value that indicates the quality level or bit rate of the output.

### Configuring inputs

[`inputs`](/documentation/AVFoundation/AVCaptureSession/inputs)

The inputs that provide media data to a capture session.

[`canAddInput(_:)`](/documentation/AVFoundation/AVCaptureSession/canAddInput(_:))

Determines whether you can add an input to a session.

[`addInput(_:)`](/documentation/AVFoundation/AVCaptureSession/addInput(_:))

Adds a capture input to the session.

[`removeInput(_:)`](/documentation/AVFoundation/AVCaptureSession/removeInput(_:))

Removes an input from the session.

### Configuring outputs

[`outputs`](/documentation/AVFoundation/AVCaptureSession/outputs)

The output destinations to which a captures session sends its data.

[`canAddOutput(_:)`](/documentation/AVFoundation/AVCaptureSession/canAddOutput(_:))

Determines whether you can add an output to a session.

[`addOutput(_:)`](/documentation/AVFoundation/AVCaptureSession/addOutput(_:))

Adds an output to the capture session.

[`removeOutput(_:)`](/documentation/AVFoundation/AVCaptureSession/removeOutput(_:))

Removes an output from a capture session.

### Connecting inputs and outputs

[`connections`](/documentation/AVFoundation/AVCaptureSession/connections)

The connections between inputs and outputs that a capture session contains.

[`addConnection(_:)`](/documentation/AVFoundation/AVCaptureSession/addConnection(_:))

Adds a connection to the capture session.

[`canAddConnection(_:)`](/documentation/AVFoundation/AVCaptureSession/canAddConnection(_:))

Determines whether a you can add a connection to a capture session.

[`addInputWithNoConnections(_:)`](/documentation/AVFoundation/AVCaptureSession/addInputWithNoConnections(_:))

Adds a capture input to a session without forming any connections.

[`addOutputWithNoConnections(_:)`](/documentation/AVFoundation/AVCaptureSession/addOutputWithNoConnections(_:))

Adds a capture output to the session without forming any connections.

[`removeConnection(_:)`](/documentation/AVFoundation/AVCaptureSession/removeConnection(_:))

Removes a capture connection from the session.

[`AVCaptureAudioChannel`](/documentation/AVFoundation/AVCaptureAudioChannel)

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

### Configuring deferred start

[`isManualDeferredStartSupported`](/documentation/AVFoundation/AVCaptureSession/isManualDeferredStartSupported)

A `BOOL` value that indicates whether the session supports manually running deferred start.

[`automaticallyRunsDeferredStart`](/documentation/AVFoundation/AVCaptureSession/automaticallyRunsDeferredStart)

A Boolean value that indicates whether deferred start runs automatically.

[`runDeferredStartWhenNeeded()`](/documentation/AVFoundation/AVCaptureSession/runDeferredStartWhenNeeded())

Tells the session to run deferred start when appropriate.

[`deferredStartDelegate`](/documentation/AVFoundation/AVCaptureSession/deferredStartDelegate)

A delegate object that observes events about deferred start.

[`deferredStartDelegateCallbackQueue`](/documentation/AVFoundation/AVCaptureSession/deferredStartDelegateCallbackQueue)

The dispatch queue on which the session calls deferred start delegate methods.

[`setDeferredStartDelegate(_:deferredStartDelegateCallbackQueue:)`](/documentation/AVFoundation/AVCaptureSession/setDeferredStartDelegate(_:deferredStartDelegateCallbackQueue:))

Sets a delegate object for the session to call when performing deferred start.

[`AVCaptureSessionDeferredStartDelegate`](/documentation/AVFoundation/AVCaptureSessionDeferredStartDelegate)

A protocol that defines the interface to respond to events about a capture session’s deferred start.

### Configuring capture controls

[`supportsControls`](/documentation/AVFoundation/AVCaptureSession/supportsControls)

A Boolean value that indicates whether a capture session supports controls.

[`maxControlsCount`](/documentation/AVFoundation/AVCaptureSession/maxControlsCount)

The maximum number of controls a capture session supports.

[`controls`](/documentation/AVFoundation/AVCaptureSession/controls)

The controls that allow configuring the camera system from device hardware.

[`canAddControl(_:)`](/documentation/AVFoundation/AVCaptureSession/canAddControl(_:))

Returns a Boolean value that indicates whether a capture session add the specified control.

[`addControl(_:)`](/documentation/AVFoundation/AVCaptureSession/addControl(_:))

Adds a control to a capture session.

[`removeControl(_:)`](/documentation/AVFoundation/AVCaptureSession/removeControl(_:))

Removes a control from a capture session.

[`setControlsDelegate(_:queue:)`](/documentation/AVFoundation/AVCaptureSession/setControlsDelegate(_:queue:))

Sets a delegate object for the system to call when it activates and presents controls.

[`AVCaptureSessionControlsDelegate`](/documentation/AVFoundation/AVCaptureSessionControlsDelegate)

A protocol that defines the interface to respond to capture control activation and presentation events.

[`controlsDelegate`](/documentation/AVFoundation/AVCaptureSession/controlsDelegate)

A delegate object that observes changes to the state of capture controls.

[`controlsDelegateCallbackQueue`](/documentation/AVFoundation/AVCaptureSession/controlsDelegateCallbackQueue)

The dispatch queue on which the system calls controls delegate methods.

### Managing the session life cycle

[`startRunning()`](/documentation/AVFoundation/AVCaptureSession/startRunning())

Starts the flow of data through the capture pipeline.

[`stopRunning()`](/documentation/AVFoundation/AVCaptureSession/stopRunning())

Stops the flow of data through the capture pipeline.

### Observing session state

[`isRunning`](/documentation/AVFoundation/AVCaptureSession/isRunning)

A Boolean value that indicates whether the capture session is in a running state.

[`isInterrupted`](/documentation/AVFoundation/AVCaptureSession/isInterrupted)

A Boolean value that indicates whether the capture session is in an interrupted state.

[`didStartRunningNotification`](/documentation/AVFoundation/AVCaptureSession/didStartRunningNotification)

A notification the system posts when a capture session starts.

[`didStopRunningNotification`](/documentation/AVFoundation/AVCaptureSession/didStopRunningNotification)

A notification the system posts when a capture session stops.

[`wasInterruptedNotification`](/documentation/AVFoundation/AVCaptureSession/wasInterruptedNotification)

A notification the system posts when it interrupts a capture session.

[`interruptionEndedNotification`](/documentation/AVFoundation/AVCaptureSession/interruptionEndedNotification)

A notification the system posts when an interruption to a capture session finishes.

[`runtimeErrorNotification`](/documentation/AVFoundation/AVCaptureSession/runtimeErrorNotification)

A notification the system posts when an error occurs during a capture session.

### Configuring multitasking

[`isMultitaskingCameraAccessSupported`](/documentation/AVFoundation/AVCaptureSession/isMultitaskingCameraAccessSupported)

A Boolean value that indicates whether the capture session supports using the camera while multitasking.

[`isMultitaskingCameraAccessEnabled`](/documentation/AVFoundation/AVCaptureSession/isMultitaskingCameraAccessEnabled)

A Boolean value that indicates whether the capture session enables access to the camera while multitasking.

### Monitoring performance

[`hardwareCost`](/documentation/AVFoundation/AVCaptureSession/hardwareCost)

A value that indicates the percentage of the session’s available hardware budget in use.

### Configuring the app’s audio session

[`usesApplicationAudioSession`](/documentation/AVFoundation/AVCaptureSession/usesApplicationAudioSession)

A Boolean value that indicates whether the capture session uses the app’s shared audio session.

[`automaticallyConfiguresApplicationAudioSession`](/documentation/AVFoundation/AVCaptureSession/automaticallyConfiguresApplicationAudioSession)

A Boolean value that indicates whether the capture session automatically changes settings in the app’s shared audio session.

[`configuresApplicationAudioSessionToMixWithOthers`](/documentation/AVFoundation/AVCaptureSession/configuresApplicationAudioSessionToMixWithOthers)

A Boolean value that Indicates whether the capture session configures the app’s audio session to mix with others.

[`configuresApplicationAudioSessionForBluetoothHighQualityRecording`](/documentation/AVFoundation/AVCaptureSession/configuresApplicationAudioSessionForBluetoothHighQualityRecording)

A Boolean value that indicates whether the capture session configures the app’s audio session for bluetooth high-quality recording.

### Managing color spaces

[`automaticallyConfiguresCaptureDeviceForWideColor`](/documentation/AVFoundation/AVCaptureSession/automaticallyConfiguresCaptureDeviceForWideColor)

A Boolean value that specifies whether the session should automatically use wide-gamut color where available.

### Synchronizing output

[`synchronizationClock`](/documentation/AVFoundation/AVCaptureSession/synchronizationClock)

A clock to use for output synchronization.

[`masterClock`](/documentation/AVFoundation/AVCaptureSession/masterClock)

A clock object used for output synchronization.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)