Hardware camera access from inside a Camera Extension

While trying to re-create the CIFilterCam demo shown in the WWDC session, I hit a roadblock when trying to access a hardware camera from inside my extension.

Can I simply use an AVCaptureSession + AVCaptureDeviceInput + AVCaptureVideoDataOutput to get frames from an actual hardware camera and pass them to the extension's stream? If yes, when should I ask for camera access permissions?

It seems the extension code is run as soon as I install the extension, but I never get prompted for access permission. Do I need to set up the capture session lazily? What's the best practice for this use case?

Hi @FrankSchlegel,

It appears that using AVCaptureDevice.authorizationStatus and AVCaptureDevice.requestAccess(for: .video) in the extension works under Ventura where the extension runs as the logged in user, but not under 12.4 where the extension runs as _cmiodalassistants. It would be nice to know if there is a workaround for 12.3+ or if developers wanting to utilize camera streams from this extension will have to set their min target to 13... doing all the camera process in the extension is "the intent behind the design" according to @ssmith_c.

Hardware camera access from inside a Camera Extension
 
 
Q