AVCaptureSessionControlsDelegate Not Being Called From Capture App

I am looking to learn more about the new Capture Button controls for iPhone 16, and am working to adapt the AVCam Sample Code to support the Capture Button. While I believe I've followed the guidance in the Enhancing your app experience with the Camera Control documentation, I'm finding that while my AVCaptureControl items seem to be added to the capture session, the Capture Button does not ever do anything, nor are any of the delegate methods called.

After I configure my capture session per the setupSession() method, I'm calling a method I added, func configureCameraControls(device:AVCaptureDevice):

func configureCameraControls(device: AVCaptureDevice) {
    guard captureSession.supportsControls else {
        assertionFailure("App does not support camera control.")
        return
    }
    
    // Set the controls delegate
    captureSession.setControlsDelegate(controlsDelegate, queue: sessionQueue)
    
    // Begin configuring the capture session.
    captureSession.beginConfiguration()
    
    // Remove previously configured controls, if any.
    for control in captureSession.controls {
        captureSession.removeControl(control)
    }
    
    // Add a zoom control
    let systemZoomSlider = AVCaptureSystemZoomSlider(device: device) { zoomFactor in
        // TODO
    }
    
    // Create a control to adjust the device's exposure bias.
    let systemBiasSlider = AVCaptureSystemExposureBiasSlider(device: device)
    
    // Add a custom slider
    let focusSlider = AVCaptureSlider("Focus", symbolName: "scope", in: 0...1)
    focusSlider.setActionQueue(sessionQueue) { focusValue in
        // TODO
    }
    
    // Iterate over the passed in controls.
    for control in [systemZoomSlider, systemBiasSlider, focusSlider] {
        // Add the control to the capture session if possible.
        if captureSession.canAddControl(control) {
            captureSession.addControl(control)
        } else {
            print("Unable to add control \(control).")
        }
    }
    
    // Commit the capture session configuration.
    captureSession.commitConfiguration()
}

I define the controls delegate like so:

final class CaptureControlsDelegate: NSObject, AVCaptureSessionControlsDelegate {
    func sessionControlsDidBecomeActive(_ session: AVCaptureSession) {
    }
    
    func sessionControlsWillEnterFullscreenAppearance(_ session: AVCaptureSession) {
    }
    
    func sessionControlsWillExitFullscreenAppearance(_ session: AVCaptureSession) {
    }
    
    func sessionControlsDidBecomeInactive(_ session: AVCaptureSession) {
    }
}

Which I instantiate earlier on in my app's lifecycle and make available to the CaptureService actor.

I'm not sure if this snippet can provide enough detail to gather some help, but I can't quite fathom why the camera/capture pipeline works, but I'm not getting any functionality from the Capture Button nor is the AVCaptureSessionControlsDelegate ever having its methods called.

..........

The app must also have an active AVCaptureEventInteraction in order for the Camera Control to work. This allows presses of the Camera Control to initiate capture.

Also be aware that captureSession.supportsControls seems to crash (unrecognized selector sent to instance) on some devices that don't have a Camera Control. Very helpful.

I am encountering a similar problem. I have implemented the delegate methods within the ViewController and assigned them to the control delegates. However, the delegate methods are still not being invoked. Could you please provide further clarification on how to incorporate AVCaptureEventInteraction into the AVCaptureSession to enable camera button control within the application?

AVCaptureSessionControlsDelegate Not Being Called From Capture App
 
 
Q