Looking for example code from presentation

Great to have this new capability. I downloaded the sample App but none of the code from the presentation was in the code. It appears to be the older version from 2019 or 2020. Will the code from the presentation be made available?

Thanks, Chris

Post not yet marked as solved Up vote post of cnelson143 Down vote post of cnelson143
600 views

Replies

You do not name the presentation, so hard to say.

The presentation was "Support external cameras in your iPadOS app". I believe this is the identifier for the presentation 2023-10106.

I'm also looking for example code from the same "Support External Cameras in your iPadOS app". I'm stuck on the portion where you have to classify the context of the observer and it states that cannot find &systemPreferredCameraContext in scope. I'm also running into an issue where I'm trying to follow along with the "changeCamera" function but in the example app "AVCam" he is using a different function and I didn't see where it was defined. Any help is appreciated! @cnelson143

  • My use case is simply and I wanted the external camera or no camera. I should get back to it soon. To answer your issue the line of code that is added is

    AVCaptureDevice.self.addObserver(self, forKeyPath: "systemPreferredCamera", options: [.new], context: &systemPreferredCameraContext)

    You need to add the following property to your class

    var systemPreferredCameraContext: AVCaptureDevice? = AVCaptureDevice.systemPreferredCamera

    Hope that is what you are asking about.

Add a Comment