ios – iPhone 16 Digital camera Management and AVCaptureSlider – Is there a technique to detect which slider is lively?

0
14
ios – iPhone 16 Digital camera Management and AVCaptureSlider – Is there a technique to detect which slider is lively?


I’m following the Apple pattern code and attempting so as to add a guide focus lens place slider:

@out there(iOS 18.0, *)
non-public func addCameraControls() {
   
       if !self.session.controls.isEmpty {
           for management in self.session.controls {
               self.session.removeControl(management)
           }
       }
       
       self.cameraControlFocusSlider = nil

       //Focus Slider
       if self.videoDevice!.isLockingFocusWithCustomLensPositionSupported {
           self.cameraControlFocusSlider = AVCaptureSlider("Focus", symbolName: "dot.sq.", in: 0.0...1.0)
           self.cameraControlFocusSlider!.setActionQueue(self.sessionQueue) { focusValue in
               
             //Do guide focus
               
               
           }
           if self.session.canAddControl(self.cameraControlFocusSlider!) {
               self.session.addControl(self.cameraControlFocusSlider!)
           }
       }
}

So there are these AVCaptureSessionControlsDelegate strategies:

   closing func sessionControlsDidBecomeActive(_ session: AVCaptureSession) {
        print ("sessionControlsDidBecomeActive")

    }
    
    closing func sessionControlsWillEnterFullscreenAppearance(_ session: AVCaptureSession) {
        print ("sessionControlsWillEnterFullscreenAppearance")

    }
    
    closing func sessionControlsWillExitFullscreenAppearance(_ session: AVCaptureSession) {
        print ("sessionControlsWillExitFullscreenAppearance")

    }
    
    closing func sessionControlsDidBecomeInactive(_ session: AVCaptureSession) {
        print ("sessionControlsDidBecomeInactive")

    }

So when self.cameraControlFocusSlider is introduced, I’ve to point out the present worth of the lense place. Lens place can change from auto focus and in addition from guide focus by the person utilizing the app UI. Is there a technique to see if self.cameraControlFocusSlider is lively or getting used?

Please be aware that I’ll have a couple of AVCaptureSlider within the closing code.

LEAVE A REPLY

Please enter your comment!
Please enter your name here