How to get camera access in Vision Pro

Generated on 8/2/2024

1 search

To get camera access in Vision Pro, you can use the new API introduced in the session Introducing enterprise APIs for visionOS. Here are the steps to achieve this:

  1. Set Up Entitlements and License:

    • Ensure you have the main camera access entitlement and a valid enterprise license file built with your app.
  2. Initialize Core Variables:

    • Set up a camera frame provider with the supported formats defined as main.
    • Create an ARKit session and a CVPixelBuffer to store and display the feed.
  3. Request User Authorization:

    • Make sure to request the user's authorization for main camera access.
  4. Run the ARKit Session:

    • Pass your camera frame provider into the ARKit session and run it.
  5. Access Video Frames:

    • Pull the video frames from the camera frame provider by requesting the camera frame updates for the main format and store them in a variable for access.

For a detailed walkthrough, you can refer to the session Introducing enterprise APIs for visionOS.

This API allows apps to access the device's main camera video feed, enabling various enhanced spatial capabilities. For example, it can be used in a production line for anomaly detection or in other enterprise applications.