Is it possible to display a camera feed in a macOS app? I'm basically trying to capture images frame by frame from a camera feed. I know how to do this in iOS, but for some reasons, on macOS, I can't seem to find any AVCaptureDevice
for video.
let x = AVCaptureDevice.devices()
// When I print x, I only see the Microphone as the only capture device. No reference to video/camera whatsoever
guard let device = AVCaptureDevice.default(for: .video) else{ return }
An object that configures capture behavior and coordinates the flow of data from input devices to capture outputs. iOS 4.0+ iPadOS 4.0+ macOS 10.7+ Mac Catalyst 14.0+
A capture device (also referred to as a capture card) is a hardware device that you connect to your computer that converts the video signal from your camera's output into a digital format your computer can recognize.
I had the exact same issue, AVCaptureDevice.devices() only returned one entry, a microphone. Solution for me was to turn on the Camera checkbox in Project:Capabilities:App Sandbox. Output after I set the Camera checkbox...
▿ 2 elements
- 0 : <AVCaptureHALDevice: 0x60c0000e4980 [Built-in Microphone][AppleHDAEngineInput:1B,0,1,0:1]>
- 1 : <AVCaptureDALDevice: 0x101302b10 [FaceTime HD Camera][CC245055EWDF6VVDY]>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With