Camera Capturer
TheCameraCapturer class provides camera video capture functionality for iOS, macOS, tvOS, and visionOS platforms. It handles device selection, format selection, camera switching, and multitasking camera access.
Creating a Camera Track
The simplest way to create a camera track is using the convenience method:Camera Capture Options
CameraCaptureOptions
Configure camera capture behavior with the following properties:| Property | Type | Default | Description |
|---|---|---|---|
deviceType | AVCaptureDevice.DeviceType? | nil | Preferred device type (not available on visionOS) |
device | AVCaptureDevice? | nil | Exact device to use (overrides other selection) |
position | AVCaptureDevice.Position | .unspecified | Camera position (.front, .back, .unspecified) |
preferredFormat | AVCaptureDevice.Format? | nil | Exact capture format to use |
dimensions | Dimensions | .h720_169 | Preferred capture dimensions |
fps | Int | 30 | Preferred frames per second |
Device Management
Listing Available Cameras
Checking Camera Switching Support
Switching Cameras
Toggle Between Front and Back
Set Specific Camera Position
Update Options at Runtime
Camera Properties
Current Device
Access the currently active camera device:Capture Session
Access the underlyingAVCaptureSession:
Multitasking Camera Access (iOS 16+)
On iOS 16 and later, you can enable multitasking camera access to continue capturing when your app is in the background:Format Selection
The SDK automatically selects the best capture format based on your options. The selection process:- If
preferredFormatis specified, it’s used directly - Otherwise, formats are filtered and ranked by:
- Multi-cam support (if using multi-cam session)
- Aspect ratio match
- FPS support
- Manhattan distance to target dimensions
- The closest matching format is selected
- FPS is clamped to the supported range if needed
Custom Format Selection
Multi-Camera Support (iOS/tvOS)
On devices that support multi-camera capture, the SDK can coordinate multiple camera capturers:Video Processing
Apply custom video processing to camera frames:Platform Availability
- iOS 13.0+
- macOS 10.15+
- tvOS 13.0+
- visionOS 1.0+
See Also
- Screen Capturer - Screen capture for macOS and iOS
- Custom Capturer - Creating custom video capturers
- LocalVideoTrack - Publishing camera video